Skip to contentSkip to navigationSkip to topbar
On this page

Request a CSV



API Overview

api-overview page anchor

You must purchase additional email activity history(link takes you to an external page) to gain access to the Email Activity Feed API.

The Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages.

Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them.

See "Getting Started with the Email Activity Feed API" for help building queries and working with the API.

You can also work with email activity in the Activity section of the Twilio SendGrid App(link takes you to an external page).


POST/v3/messages/download

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

This request will kick off a backend process to generate a CSV file. Once generated, the worker will then send an email for the user download the file. The link will expire in 3 days.

The CSV will contain the events from the last 30 days, limited to the last 1 million events maximum. This endpoint will be rate limited to 1 request every 12 hours (rate limit may change).

This endpoint is similar to the GET Single Message endpoint - the only difference is that /download is added to indicate that this is a CSV download requests but the same query is used to determine what the CSV should contain.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
querystring

Optional

Uses a SQL like syntax to indicate which messages to include in the CSV

202400429500
SchemaExample
Property nameTypeRequiredDescriptionChild properties
statusenum<string>
Possible values:
pending

messagestring
Request CSVLink to code sample: Request CSV
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const request = {
5
url: `/v3/messages/download`,
6
method: "POST",
7
};
8
9
client
10
.request(request)
11
.then(([response, body]) => {
12
console.log(response.statusCode);
13
console.log(response.body);
14
})
15
.catch((error) => {
16
console.error(error);
17
});

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.