Skip to contentSkip to navigationSkip to topbar
On this page

Export recipients status



API Overview

api-overview page anchor
(warning)

Legacy Marketing Campaigns

You are viewing the Legacy Marketing Campaigns API reference. For guidance migrating to the current version of Marketing Campaigns, see Migrating from Legacy Marketing Campaigns

(information)

Info

You can use this endpoint only after your system has been upgraded. Learn more about the updates to the SendGrid Legacy API.

You can export recipients, get all existing exports, or check the export status using the /v3/contactdb/exports and /v3/contactdb/exports/{id} endpoints.


GET/v3/contactdb/exports/{id}

Base url: https://api.sendgrid.com (The Twilio SendGrid v3 API)

This endpoint can be used to check the status of a recipient export job.

To use this call, you will need the id from the "Export Recipients" call.

If you would like to download a list, take the id that is returned from the "Export Recipients" endpoint and make an API request here to get the urls. Once you have the list of URLs, make a GET request on each URL to download your CSV file(s).

Twilio SendGrid recommends exporting your recipients regularly as a backup to avoid issues or lost data.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
authorizationstring
required
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
idstring
required
200400401403404500
Schema
Property nameTypeRequiredDescriptionChild properties
idstring

Optional


statusenum<string>

Optional

The export job's status. Allowed values: pending, ready, or failure.

Possible values:
pendingreadyfailure

createdAtstring

Optional

The ISO8601 timestamp when the export was begun.


updatedAtstring

Optional

The ISO8601 timestamp when the export was updated.


completedAtstring

Optional

The ISO8601 timestamp when the export was completed.


expiresAtstring

Optional

The ISO8601 timestamp when the exported file on S3 will expire.


urlsarray[string]

Optional

One or more download URLs for the recipient file if the status is ready.


messagestring

Optional

A human readable message if the status is failure.


Metadatametadata

Optional


recipientCountinteger

Optional

The total number of exported recipients.

Export recipients statusLink to code sample: Export recipients status
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const id = "id";
5
6
const request = {
7
url: `/v3/contactdb/exports/${id}`,
8
method: "GET",
9
};
10
11
client
12
.request(request)
13
.then(([response, body]) => {
14
console.log(response.statusCode);
15
console.log(response.body);
16
})
17
.catch((error) => {
18
console.error(error);
19
});