Search code examples
phpsendgrid-api-v3

SendGrid API: Get Campaign Stats


I've been looking for a way to get SendGrid stats for specific campaigns. I can see the stats on the Campaigns page of the SendGrid dashboard, but I can't find an API endpoint to get that data.

I could retrieve the Global and Overview stats, no problem, but in this case, those are not helpful for me. I need per-campaign stats. Is there a way to get those reports through the API?


Solution

  • I solved my situation by creating unique (ID-like) categories for each campaign. This way, I can use the Category Stats API Endpoint. It's not a semantically correct usage of categories, but this is the only way I found to achieve this.

    Update July 2017:

    I also achieved this goal + much more by using SendGrid Subusers and the on-behalf-of: subuser_<username> header (search on behalf of subuser in the left searchbox). This header allows you to create requests using the parent account on behalf the subuser.