Skip to contentSkip to navigationSkip to topbar
On this page

Statistics


(warning)

This documentation is for the SendGrid Web API v2

We will deprecate this version on February 10, 2025. To access all the latest features and upcoming developments, please see our v3 API. For assistance with transitioning, refer to our migration guide.

Subuser Statistics


Retrieve Subuser Statistics

retrieve-subuser-statistics page anchor

Retrieve daily statistics for a subuser.

(information)

Info

The days argument and the start_date/end_date arguments are exclusive from each other.

URI ParameterRequiredRequirementsDescription
userYesSubuser must be under your accountSubuser to retrieve statistics from
daysNoUnsigned IntegerNumber of days in the past to include statistics (includes today)
start_dateNoDate must be in YYY-mm-dd format and be before the end_date parameterBeginning of date range
end_dateNoDate must be in YYY-mm-dd format and be after the start_date parameterEnd of date range
JSONXML

Call

POSThttps://api.sendgrid.com/apiv2/customer.stats.json
POST Dataapi_user=your_sendgrid_username&api_key=your_sendgrid_password&user=subuser_username

Response

1
[
2
{
3
"date": "2014-11-27",
4
"requests": 0,
5
"delivered": 0,
6
"bounces": 0,
7
"repeat_bounces": 0,
8
"unsubscribes": 0,
9
"repeat_unsubscribes": 0,
10
"clicks": 0,
11
"opens": 0,
12
"spamreports": 0,
13
"repeat_spamreports": 0,
14
"invalid_email": 0,
15
"blocks": 0,
16
"unique_clicks": 0,
17
"unique_opens": 0
18
}
19
]

Retrieve Aggregate Statistics

retrieve-aggregate-statistics page anchor

Retrieve lifetime total statistics for a subuser.

URI ParameterRequiredRequirementsDescription
userYesSubuser must be under your accountSubuser to retrieve statistics from
aggregateYesMust be set to 1argument to provide total statistics instead of daily
JSONXML
POSThttps://api.sendgrid.com/apiv2/customer.stats.json
POST Dataapi_user=your_sendgrid_username&api_key=your_sendgrid_password&user=subuser_username&aggregate=1
1
{
2
"requests": "12342",
3
"bounces": "12",
4
"clicks": "10223",
5
"opens": "9992",
6
"spamreports": "5"
7
}

(information)

Info

Category statistics are available for the previous thirteen months only.

Retrieve a list of all the categories used by a subuser.

URI ParameterRequiredRequirementsDescription
userYesSubuser must be under your accountSubuser to pull categories from
listYesThe value must be set to trueTask to retrieve list of categories
JSONXML
POSThttps://api.sendgrid.com/apiv2/customer.stats.json
POST Dataapi_user=your_sendgrid_username&api_key=your_sendgrid_password&user=subuser_username&list=true
1
[
2
{
3
"category": "categoryA"
4
},
5
{
6
"category": "categoryB"
7
},
8
{
9
"category": "categoryC"
10
}
11
]

Retrieve statistics broken down by category. If the category does not exist, it will return an empty result set.

(information)

Info

The days argument and the start_date/end_date arguments are exclusive from each other.

URI ParameterRequiredRequirementsDescription
userYesSubuser must be under your accountSubuser to retrieve statistics from
categoryYesExisting category on the accountCategory to retrieve statistics from
daysNoUnsigned IntegerNumber of days in the past to include statistics (includes today)
start_dateNoDate must be in YYY-mm-dd format and be before the end_date parameterBeginning of date range
end_dateNoDate must be in YYY-mm-dd format and be after the start_date parameterEnd of date range
JSONXML
POSThttps://api.sendgrid.com/apiv2/customer.stats.json
POST Dataapi_user=your_sendgrid_username&api_key=your_sendgrid_password&user=subuser_username&category=categoryA
1
[
2
{
3
"date": "2009-06-20",
4
"category": "categoryA",
5
"requests": 12342,
6
"bounces": 12,
7
"clicks": 10223,
8
"opens": 9992,
9
"spamreports": 5
10
}
11
]

Multiple Category Statistics

multiple-category-statistics page anchor

When retrieving statistics for more than one category, use an array category argument.

JSONXML
POSThttps://api.sendgrid.com/apiv2/customer.stats.json
POST Dataapi_user=your_sendgrid_username&api_key=your_sendgrid_password&user=subuser_username&category[]=categoryA&category[]=categoryB
1
[
2
{
3
"date": "2009-06-20",
4
"category": "categoryA",
5
"requests": 12342,
6
"bounces": 12,
7
"clicks": 10223,
8
"opens": 9992,
9
"spamreports": 5
10
},
11
{
12
"date": "2009-06-21",
13
"category": "categoryB",
14
"requests": 32342,
15
"bounces": 10,
16
"clicks": 14323,
17
"opens": 10995,
18
"spamreports": 7
19
}
20
]

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.