Retrieve email statistics for your subuser
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.
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.
Bearer <<YOUR_API_KEY_HERE>>
Optional
Limits the number of results returned per page.
Optional
The point in the list to begin retrieving results from.
Optional
How to group the statistics. Must be either "day", "week", or "month".
day
week
month
The subuser you want to retrieve statistics for. You may include this parameter up to 10 times to retrieve statistics for multiple subusers.
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.
Array of:
Optional
The date the statistics were gathered.
Optional
1const client = require("@sendgrid/client");2client.setApiKey(process.env.SENDGRID_API_KEY);34const queryParams = {5start_date: "2009-07-06",6subusers: "subusers",7};89const request = {10url: `/v3/subusers/stats`,11method: "GET",12qs: queryParams,13};1415client16.request(request)17.then(([response, body]) => {18console.log(response.statusCode);19console.log(response.body);20})21.catch((error) => {22console.error(error);23});