Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Retrieve the totals for each email statistic metric for all subusers.



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/sums

Base url: https://api.sendgrid.com

This endpoint allows you to retrieve the total sums of each email statistic metric for all subusers over the given date range.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
sort_by_directionenum<string>Optional

The direction you want to sort.

Default: descPossible values:
descasc

start_datestringrequired

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


end_datestringOptional

The end date of the statistics to retrieve. Defaults to today. Must follow format YYYY-MM-DD.


limitintegerOptional

Limits the number of results returned per page.

Default: 5

offsetintegerOptional

The point in the list to begin retrieving results from.

Default: 0

aggregated_bystringOptional

How to group the statistics. Defaults to today. Must follow format YYYY-MM-DD.


sort_by_metricstringOptional

The metric that you want to sort by. Must be a single metric.

Default: delivered
200
SchemaExample
Property nameTypeRequiredDescriptionChild properties
datestring

The date the statistics were gathered.


statsarray[object]

Retrieve the totals for each email statistic metric for all subusers.

retrieve-the-totals-for-each-email-statistic-metric-for-all-subusers page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

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


Rate this page: