Leanplum's user guides and developer documentation.

Leanplum Documentation

Leanplum's user guides, SDK setup, API docs, and more resources are here to help you get the most out of A/B testing, Campaigns, Messaging, and Analytics.

Import user data with a CSV file upload

You can use a CSV upload for larger, one-time imports of user data such as historic push tokens or email addresses. For this, you'll use the multi (CSV) API call.

Once uploaded and processed, this information will be stored in Leanplum and available on our platform for targeting and segmenting users. Note that it may take up to 15 minutes after the import has finished to be able to segment based on the imported data.

Follow these steps to upload a CSV file using the multi (CSV) call.

Step 1: Prepare the CSV file

Save your file in regular CSV format without any encoding.

Depending on what type of data you want to import, you'll need to include different parameter fields in your file. The upload will fail if the CSV is formatted incorrectly.

The header row of your file will include the parameter fields for the data you're importing (such as user attributes), separated by commas. Use a dot to indicate nested parameters. For example:

userId,userAttributes.Gender,userAttributes.Age
user1,Male,25
user2,Female,37

Here are the various types of info you can import — click each to learn how to format the CSV.

For more about file formatting, see Prepare a CSV file to import user data.

Step 2: Upload the CSV to your Leanplum Google Bucket

Leanplum Technical Support will provide you with access to your Leanplum Google Bucket. You'll need to link the appropriate Google Bucket folder in your API call path.

📘

G Suite or Google account is required

To be able to upload the file in your assigned bucket you will need either a G Suite or a regular Google account.

Step 3: Construct the API call

The API method for CSV upload is multi (CSV). You will need to pass different values to the defaultAction parameter depending on what kind of data you are uploading.

https://www.leanplum.com/api?action=multi&apiVersion=1.0.6&appId={App_ID}&clientKey={Dev_Key}&defaultAction={leanplum_api_action}&gcsBucket={bucket_name}&file={path/file_name}&createJob=true

Step 4: Monitor the uploading status

You can use the getMultiResults API call to check the status of the uploading job.

Your response will be one of these:

  • Pending. The job is still waiting in the queue and has not started processing yet.
  • Running. The job is currently being processed.
  • Finished. The job has finished. (This means the file has processed, not necessarily that the upload was 100% successful.)
  • Failed. The job failed before it could execute. The most common reason is Leanplum's backend could not read the file, perhaps due to file permissions or the file not being public.

To perform the getMultiResults call, you'll need the original multi call ID, found here:

You will get this jobId when you perform the initial multi call.

Updated about a month ago



Import user data with a CSV file upload


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.