Skip to contentSkip to navigationSkip to topbar
On this page

Export Single Send Stats



API Overview

api-overview page anchor

As a Marketing Campaigns customer, you have access to rich statistics about your Single Sends and Automations. The Marketing Campaigns Statistics API allows you to retrieve these statistics programmatically. for detailed information about the statistics available, see the Marketing Campaigns Stats Overview.

(information)

Note

These endpoints provide stats for Marketing Campaigns only. For stats related to event tracking, please see the Stats API.


GET/v3/marketing/stats/singlesends/export

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

This endpoint allows you to export Single Send stats as .CSV data.

You can specify one Single Send or many: include as many Single Send IDs as you need, separating them with commas, as the value of the ids query string parameter.

The data is returned as plain text response but in .CSV format, so your application making the call can present the information in whatever way is most appropriate, or just save the data as a .csv file.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
idsarray[string]Optional

The IDs of Single Sends for which to export stats.


timezonestringOptional

The IANA Area/Region(link takes you to an external page) string representing the timezone in which the stats are to be presented; i.e. "America/Chicago". This parameter changes the timezone format only; it does not alter which stats are returned.

Default: UTC
200400
Schema
string

CSV data

Export Single Send StatsLink to code sample: Export Single Send Stats
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const queryParams = {
5
timezone: "UTC",
6
};
7
8
const request = {
9
url: `/v3/marketing/stats/singlesends/export`,
10
method: "GET",
11
qs: queryParams,
12
};
13
14
client
15
.request(request)
16
.then(([response, body]) => {
17
console.log(response.statusCode);
18
console.log(response.body);
19
})
20
.catch((error) => {
21
console.error(error);
22
});

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.