In this article, you’ll learn how to export user data in Auth0 to a CSV file then import it into Marketo using the Bulk Leads endpoint of the Marketo REST API.

Create a user data file

Start by navigating to the Extensions section of the Dashboard and open the User Import / Export Extension. On the extension page, select Export from the menu. Next, set the Export Format to the required file format. Marketo accepts file imports in CSV format so choose the Tab Separated Value file (*.csv) option. At the top in the Fields section, provide a User Field and Column Name for each user attribute to include in the export. For example:
User FieldColumn Name
emailEmail Address
created_atCreated At
given_nameFirst Name
family_nameLast Name
After adding the user fields, click on the Export Users button to start the export. Once the export is complete, download the CSV file to use in the following section.

Import a user data file

Before you get started, you can find more information by visiting Marketo Documentation: Bulk Lead Import. To import the user data file to Marketo, perform a POST request to the Bulk Leads endpoint. Set the content-type header of the request to multipart/form-data and include a file parameter with your exported CSV file as well as format parameter set to csv. For example:
curl --request POST \
  --url https://marketo_rest_api_base_url/bulk/v1/leads.json \
  --header 'authorization: Bearer {MARKETO_ACCESS_TOKEN}' \
  --form file=@auth0_users.csv \
  --form format=csv
The response should look something like this:
{
    "requestId": "e42b#14272d07d78",
    "success": true,
    "result": [{
        "batchId": 1234,
        "status": "Importing"
    }]
}
You can check the status of your import using the Get Import Lead Status API and your import job’s batchId. For example:
curl --request GET \
  --url https://marketo_rest_api_base_url/bulk/v1/leads/batch/BATCH_ID.json \
  --header 'authorization: Bearer {MARKETO_ACCESS_TOKEN}'
And the response:
{
    "requestId": "8136#146daebc2ed",
    "success": true,
    "result": [{
        "batchId": 1234,
        "status": "Complete",
        "numOfLeadsProcessed": 123,
        "numOfRowsFailed": 0,
        "numOfRowsWithWarning": 0
    }]
}
That’s it! You successfully imported your Auth0 users into Marketo.