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 retrive the monthly email statistics for a specific subuser.
When using the sort_by_metric
to sort your stats by a specific metric, you can not sort by the following metrics:
bounce_drops
, deferred
, invalid_emails
, processed
, spam_report_drops
, spam_reports
, or unsubscribe_drops
.
Bearer <<YOUR_API_KEY_HERE>>
The username of the Subuser.
The date of the month to retrieve statistics for. Must be formatted YYYY-MM-DD
The metric that you want to sort by. Metrics that you can sort by are: blocks
, bounces
, clicks
, delivered
, opens
, requests
, unique_clicks
, unique_opens
, and unsubscribes
.'
delivered
The direction you want to sort.
desc
Possible values: desc
asc
Optional field to limit the number of results returned.
5
Optional beginning point in the list to retrieve from.
0
The date the statistics were gathered.
The list of statistics.
1const client = require('@sendgrid/client');2client.setApiKey(process.env.SENDGRID_API_KEY);34const subuser_name = "Miss Christine Morgan";5const queryParams = {6"date": "2010-01-22",7"sort_by_metric": "delivered",8"limit": 59};1011const request = {12url: `/v3/subusers/${subuser_name}/stats/monthly`,13method: 'GET',14qs: queryParams15}1617client.request(request)18.then(([response, body]) => {19console.log(response.statusCode);20console.log(response.body);21})22.catch(error => {23console.error(error);24});