Retrieve email statistics for your subuser



Subuser statistics enable you to view specific segments of your statistics, as compared to the general overview of all email activity on your account. SendGrid tracks your subusers' emails sent, bounces, and spam reports. Unsubscribes, clicks, and opens are tracked if you have enabled the required settings.

For more information, see our Subusers documentation. You can also access Subuser Statistics in the SendGrid console(link takes you to an external page).


GET/v3/subusers/stats

Base url: https://api.sendgrid.com (for global users and subusers)

Base url: https://api.eu.sendgrid.com (for EU regional subusers)

This endpoint allows you to retrieve the email statistics for the given subusers.

You may retrieve statistics for up to 10 different subusers by including an additional subusers parameter for each additional subuser.


Property nameTypeRequiredDescription
authorizationstring
required
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
limitinteger

Optional

Limits the number of results returned per page.


offsetinteger

Optional

The point in the list to begin retrieving results from.


aggregatedByenum<string>

Optional

How to group the statistics. Must be either "day", "week", or "month".

Possible values:
dayweekmonth

subusersstring
required

The subuser you want to retrieve statistics for. You may include this parameter up to 10 times to retrieve statistics for multiple subusers.


startDatestring
required

The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD.


endDatestring

Optional

The end date of the statistics to retrieve. Defaults to today.

200
SchemaExample

Array of:

Property nameTypeRequiredDescriptionChild properties
datestring

Optional

The date the statistics were gathered.


statsarray[object]

Optional

Retrieve email statistics for your subusers.Link to code sample: Retrieve email statistics for your subusers.
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const queryParams = {
5
start_date: "2009-07-06",
6
subusers: "subusers",
7
};
8
9
const request = {
10
url: `/v3/subusers/stats`,
11
method: "GET",
12
qs: queryParams,
13
};
14
15
client
16
.request(request)
17
.then(([response, body]) => {
18
console.log(response.statusCode);
19
console.log(response.body);
20
})
21
.catch((error) => {
22
console.error(error);
23
});