Skip to contentSkip to navigationSkip to topbar
On this page

Retrieve email statistics for your subuser



API Overview

api-overview page anchor

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.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
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.


aggregated_byenum<string>

Optional

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

Possible values:
dayweekmonth

subusersstringrequired

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


start_datestringrequired

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


end_datestring

Optional

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

200
SchemaExample

Array of:

Property nameTypeRequiredDescriptionChild properties
datestring

The date the statistics were gathered.


statsarray[object]
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
subusers: "ZGkrHSypTsudrGkmdpJJ",
6
start_date: "2010-01-22",
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
});

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.