Skip to contentSkip to navigationSkip to topbar
Rate this page:
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

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
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
limitinteger

Limits the number of results returned per page.


offsetinteger

The point in the list to begin retrieving results from.


aggregated_byenum<string>

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

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

200
SchemaExample

Array of:

datestring

The date the statistics were gathered.


statsarray[object]

Retrieve email statistics for your subusers.

retrieve-email-statistics-for-your-subusers page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_22
const client = require('@sendgrid/client');
_22
client.setApiKey(process.env.SENDGRID_API_KEY);
_22
_22
const queryParams = {
_22
"subusers": "ZGkrHSypTsudrGkmdpJJ",
_22
"start_date": "2010-01-22"
_22
};
_22
_22
const request = {
_22
url: `/v3/subusers/stats`,
_22
method: 'GET',
_22
qs: queryParams
_22
}
_22
_22
client.request(request)
_22
.then(([response, body]) => {
_22
console.log(response.statusCode);
_22
console.log(response.body);
_22
})
_22
.catch(error => {
_22
console.error(error);
_22
});


Rate this page: