How to export user IDs and user attributes via API

The following guide will walk you through how to export user IDs from Leanplum, along with 1 custom user attribute, associated with those users.

We recommend installing Postman and importing Leanplum's API collection for easier use. Alternatively, you can copy-paste the API calls in your browser's URL bar.

Export all User IDs:

  1. Export CSV file with the user IDs and the desired user attribute via exportUsers API call. Replace the values in bold. Get your API keys from Development > App settings in the top navigation bar.

  2. Use the job ID form the response of step 1. Make a getExportResults API call and download your file, once the job is done and a download URL is returned. Example getMultiResults API call:
    https://api.leanplum.com/api?action=getExportResults&appId=APP_ID&clientKey=EXPORT_KEY&apiVersion=1.0.6&jobId=JOB_ID 

 

Example exportUsers API calls:

Export all User IDs:

  • With 1 chosen user attribute:
    https://api.leanplum.com/api?action=exportUsers&appId=APP_ID&clientKey=EXPORT_KEY&apiVersion=1.0.6&userAttribute=ATTRIBUTE_NAME
  • Without user attribute:
    https://api.leanplum.com/api?action=exportUsers&appId=APP_ID&clientKey=EXPORT_KEY&apiVersion=1.0.6

 

Export User IDs from a saved audience:

  • With 1 chosen user attribute:
    https://api.leanplum.com/api?action=exportUsers&appId=APP_ID&clientKey=EXPORT_KEY&apiVersion=1.0.6&audienceName=AUDIENCE_NAME&userAttribute=ATTRIBUTE_NAME
  • Without user attribute:
    https://api.leanplum.com/api?action=exportUsers&appId=APP_ID&clientKey=EXPORT_KEY&apiVersion=1.0.6&audienceName=AUDIENCE_NAME

 

Additional resources:

You can use the downloaded CSV file to then filter out users and make a CSV upload with updated data for them. 

  1. Delete one or more user attributes for users in bulk via CSV upload
  2. How to create or update multiple users with attributes for testing fast via API
  3. Prepare a valid file for CSV upload
  4. CSV upload process

Was this article helpful?
Have more questions? Submit a request