Exporting contacts from a Segment or List, via API (Minimal cURL version)

Objective

The objective of this guide is to provide a step-by-step procedure for exporting contacts from a Segment or List in SendGrid. This is useful for managing your contact data, integrating with other platforms, or simply backing up your contact information.

 

Product

Twilio SendGrid (Email) - Marketing Campaigns

 

User Account Permission/Role(s) Required 

Full Administration permissions, or Teammate with Marketing permissions

 

Procedure 

1. Initiate Export Request

  • Use the POST /v3/marketing/contacts/exports endpoint.
  • In the request body, specify the segment_ids of the segments you wish to export. Example:
{
"segment_ids": ["Your_Segment_ID"],
"notifications": {"email": false}
}
  • The payload to export contacts from a list, is very similar. In this case, you'll need to specify the list_ids of the lists you wish to export. For example:
{
"list_ids": ["Your_List_ID"],
"notifications": {"email": false}
}
  • This request will return a Job ID

Note: If you set "notifications": {"email": true} within the payload, there is no need to continue with the second step. Instead, an email with a download link will be sent to the email address set up for notification purposes. 

2. Check Export Status

  • Use the GET /v3/marketing/contacts/exports/{job_id} endpoint to check the status of your export job.
  • Once the status is "ready", the response will include a URL to download the CSV file.

3. Download the CSV file

Use the URL provided in the response to download the CSV file containing your segment's contacts.

 

Additional Information 

1. When trying to export segments/lists with more than 1M rows, multiple download links will be generated. 

2. Information about other options available for the POST and GET calls described above, are available in the following Help Center articles:

Export Contacts

Export Contacts Status

 

Have more questions? Submit a request