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>>
Optional
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.
Optional
The end date of the statistics to retrieve. Defaults to today. Must follow format YYYY-MM-DD.
Optional
Limits the number of results returned per page.
5
Optional
The point in the list to begin retrieving results from.
0
Optional
How to group the statistics. Defaults to today. Must follow format YYYY-MM-DD.
Optional
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 = {5start_date: "2010-01-22",6limit: 5,7sort_by_metric: "delivered",8};910const request = {11url: `/v3/subusers/stats/sums`,12method: "GET",13qs: queryParams,14};1516client17.request(request)18.then(([response, body]) => {19console.log(response.statusCode);20console.log(response.body);21})22.catch((error) => {23console.error(error);24});