SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How to Handle Pagination in SendGrid Email Activity API

Objective

This article explains how to handle pagination limitations when using the SendGrid Email Activity Feed API. If you are experiencing issues trying to page through large amounts of historical email log data, this guide outlines the intended use case for the Activity API, clarifies its strict volume caps, and provides the recommended solution for capturing high-volume event data.

Product

Twilio SendGrid Email API

Environment

SendGrid v3 API

User Account Permission/Role(s) Required

Admin or Developer access (with API Key permissions enabled)

Procedure

1. Understand the Email Activity API Limitations

The Email Activity API is designed exclusively for small, targeted queries (such as looking up a single recipient's email status or checking a specific Message ID).

  • No Pagination Support: The current API does not offer built-in pagination or page-by-page navigation for the Email Activity Feed.
  • Strict Capping: The limit parameter for queries is strictly capped at a maximum of 1,000 records.
  • Data Retention Cap: The Activity Feed only holds a maximum of 30 days of rolling data.
  • Add-On Requirement: To make API calls to the Email Activity endpoint, your account must have the Extended Email Activity History Add-On enabled.

2. Transition to the Event Webhook for Large Datasets

For a larger scope of data needs, the Email Activity API is not suitable. Instead, we recommend that users utilize the Event Notification Webhook.

Our platform allows accounts to link an Event Notification Webhook to automatically stream data. This feature pushes real-time delivery and engagement events (like processed, delivered, bounced, opened, and clicked) directly to your server as they happen, completely eliminating the need for manual API scraping or pagination.

Additional Information

Have more questions? Submit a request
Powered by Zendesk