cursor_expired

HTTP 410 Don’t retry REST API

Your event cursor is well-formed but the events it would resume from have already been trimmed, so there is no correct page to return.

How to fix it

  1. Restart polling with no cursor. You will receive the first remaining event and can resume normally from there.
  2. Treat the gap as real. Events between your old cursor and the new start were not delivered and will not be, so reconcile current state from the REST resources rather than assuming the stream was continuous.
  3. Poll more often, or subscribe a webhook instead. A signed webhook removes the polling window entirely, and the events surface stays available as a backstop.
  4. Do not retry with the same cursor. The response is marked retryable: false and the condition cannot resolve on its own.

Which rule fired

Before serving an event page the endpoint reads the minimum project_sequence still present for the project and compares it with the cursor. If the next sequence you asked for is lower than the oldest surviving event, the gap between your cursor and the retained window is real, and returning the oldest remaining events would look like a normal page while quietly omitting everything in between. A 410 is used rather than a 404 because the resource existed and is gone, which is exactly what 410 is for.

In error.messageMeans
This event cursor is expired. Restart polling from the first remaining event without a cursor. cursor + 1 is less than MIN(project_sequence) for the project, meaning at least one event between your position and the retained window has been removed.

Why it works this way: This is the deliberate opposite of a silent restart. A consumer that lost events needs to know it lost them, because the whole value of the event stream is the guarantee that consecutive sequence numbers mean nothing happened in between.

Example

GET /v1/projects/{project_id}/events?cursor=… → 410
{
  "error": {
    "code": "cursor_expired",
    "message": "This event cursor is expired. Restart polling from the first remaining event without a cursor.",
    "request_id": "req_8Kd2x91",
    "retryable": false,
    "details": {}
  }
}

Where it appears

  • GET /projects/{project_id}/events

Paths are relative to https://api.emailforagents.ai/v1.

View as Markdown

Search docs