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.
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:
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.
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.
Google Workspace (former Google Suite) or Google account is required
To be able to upload the file in your assigned bucket you will need either a Google Workspace or a regular Google account.
Development Key Required
For security reasons CSV imports are allowed only with the Development key for the app where you are uploading the data.
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.
- User Attributes: defaultAction=setUserAttributes
- Device Attributes: defaultAction=setDeviceAttributes
- Events: defaultAction=track
- Historical Events: defaultAction=setUserAttributes
- Email Unsubscribe: defaultAction=setUserAttributes
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:
Updated 13 days ago