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.
This endpoint allows you to retrieve the total sums of each email statistic metric for all subusers over the given date range.
Bearer <<YOUR_API_KEY_HERE>>
The direction you want to sort.
desc
Possible values: desc
asc
The starting date of the statistics to retrieve. Must follow format YYYY-MM-DD.
The end date of the statistics to retrieve. Defaults to today. Must follow format YYYY-MM-DD.
Limits the number of results returned per page.
5
The point in the list to begin retrieving results from.
0
How to group the statistics. Defaults to today. Must follow format YYYY-MM-DD.
The metric that you want to sort by. Must be a single metric.
delivered
The date the statistics were gathered.
1const client = require('@sendgrid/client');2client.setApiKey(process.env.SENDGRID_API_KEY);34const queryParams = {5"start_date": "2010-01-22",6"limit": 5,7"sort_by_metric": "delivered"8};910const request = {11url: `/v3/subusers/stats/sums`,12method: 'GET',13qs: queryParams14}1516client.request(request)17.then(([response, body]) => {18console.log(response.statusCode);19console.log(response.body);20})21.catch(error => {22console.error(error);23});