> ## Documentation Index
> Fetch the complete documentation index at: https://docs.closient.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Replay events from a cursor (gap-fill on reconnect)

> Walk your organization's durable event log forward, **oldest first**. This is how a subscriber that was offline recovers: every event is logged when it is emitted, before any delivery is attempted, so an outage — yours or ours — leaves a record you can replay rather than a silent gap.

The loop is: persist the ``cursor`` of the last event you durably processed; on reconnect call this endpoint with ``?after=<cursor>``; process the page; repeat with the last cursor of that page until it comes back short. The walk is gap-free and duplicate-free even when two events share a timestamp, because the cursor is a keyset over ``(occurred_at, id)`` rather than a timestamp.

``envelope`` is byte-identical to what a live delivery would have POSTed at that version, so replayed events need no special casing in your handler. ``event_id`` is stable across the live delivery and every replay — deduplicate on it.



## OpenAPI

````yaml /openapi/openapi-integrations.json get /integrations/api/v1/webhooks/events/
openapi: 3.1.0
info:
  title: Integrations API
  version: 1.0.0
  description: >
    Webhook endpoint management, event catalog, delivery tracking, and event
    replay.


    ## Authentication


    All endpoints require an API key passed via the `X-API-Key` HTTP header,
    unless otherwise noted.


    ```

    X-API-Key: csb_<body>_<checksum>

    ```


    Generate API keys in **Settings > API Keys** in your dashboard, or via the
    Account API.

    Session-based (cookie) authentication is also accepted for browser-based
    access.


    ## Rate Limits


    | Tier        | Requests / minute | Requests / day |

    |-------------|-------------------|----------------|

    | Default     | 300               | 10,000         |

    | Custom      | Contact us        | Contact us     |


    Rate-limit headers are included on every response so callers can
    self-throttle without

    hitting our 429s ("informed governor"):


    - `RateLimit-Policy` — every active window, e.g. `300;w=60, 10000;w=86400`

    - `RateLimit-Limit` — quota for the **most-restrictive** currently-active
    window

    - `RateLimit-Remaining` — requests left in that window

    - `RateLimit-Reset` — seconds until that window resets (relative; clock-skew
    safe)


    Legacy `X-RateLimit-*` aliases are also emitted for back-compat.
    `X-RateLimit-Reset`

    keeps the absolute Unix-timestamp shape to avoid breaking existing
    consumers.


    When rate-limited, you receive `429 Too Many Requests` with a
    `retry_after_seconds` field

    in the error envelope and a `Retry-After` header.


    ## Pagination


    List endpoints return paginated results in this envelope:


    ```json

    {
      "data": [...],
      "pagination": {
        "page": 1,
        "page_size": 25,
        "total_count": 342,
        "total_pages": 14,
        "has_next": true,
        "has_previous": false
      }
    }

    ```


    Use `?page=2&page_size=50` query parameters. Maximum page size is 100.


    ## Error Responses


    All errors conform to [RFC 9457 Problem
    Details](https://www.rfc-editor.org/rfc/rfc9457)

    with `Content-Type: application/problem+json`:


    ```json

    {
      "type": "https://closient.com/docs/errors/not_found",
      "title": "Not Found",
      "status": 404,
      "detail": "The requested resource was not found.",
      "error_code": "not_found",
      "retryable": false,
      "timestamp": "2026-03-31T12:00:00+00:00"
    }

    ```


    Common error codes: `unauthorized` (401), `forbidden` (403), `not_found`
    (404),

    `validation_error` (422), `rate_limited` (429), `internal_error` (500).
  termsOfService: https://www.closient.com/terms/
servers:
  - url: https://www.closient.com
security: []
tags:
  - name: Webhook Endpoints
    description: Register and manage webhook delivery endpoints.
  - name: Webhook Event Catalog
    description: >-
      Discover every subscribable event type and the envelope versions
      available.
  - name: Webhook Deliveries
    description: Track and replay webhook delivery attempts.
  - name: Webhook Events
    description: >-
      Durable event log with cursor-based replay, for recovering from a
      subscriber outage.
externalDocs:
  description: Closient Documentation
  url: https://docs.closient.com
paths:
  /integrations/api/v1/webhooks/events/:
    get:
      tags:
        - Webhook Events
      summary: Replay events from a cursor (gap-fill on reconnect)
      description: >-
        Walk your organization's durable event log forward, **oldest first**.
        This is how a subscriber that was offline recovers: every event is
        logged when it is emitted, before any delivery is attempted, so an
        outage — yours or ours — leaves a record you can replay rather than a
        silent gap.


        The loop is: persist the ``cursor`` of the last event you durably
        processed; on reconnect call this endpoint with ``?after=<cursor>``;
        process the page; repeat with the last cursor of that page until it
        comes back short. The walk is gap-free and duplicate-free even when two
        events share a timestamp, because the cursor is a keyset over
        ``(occurred_at, id)`` rather than a timestamp.


        ``envelope`` is byte-identical to what a live delivery would have POSTed
        at that version, so replayed events need no special casing in your
        handler. ``event_id`` is stable across the live delivery and every
        replay — deduplicate on it.
      operationId: apps_integrations_webhooks_api_list_events_view
      parameters:
        - in: query
          name: after
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Resume strictly after this cursor. Pass the ``cursor`` of the last
              event you **durably processed** — not the last one you received.
              Omit to start from the oldest retained event. An unrecognised
              cursor is a 422: silently restarting from the beginning would
              flood you, and silently starting from now would hide the very gap
              you are reconnecting to close.
            title: After
          required: false
          description: >-
            Resume strictly after this cursor. Pass the ``cursor`` of the last
            event you **durably processed** — not the last one you received.
            Omit to start from the oldest retained event. An unrecognised cursor
            is a 422: silently restarting from the beginning would flood you,
            and silently starting from now would hide the very gap you are
            reconnecting to close.
        - in: query
          name: event_type
          schema:
            anyOf:
              - items:
                  $ref: '#/components/schemas/WebhookEventTypeEnum'
                type: array
              - type: 'null'
            description: >-
              Restrict to these event types. Repeat the parameter for multiple
              values. Omit for everything.
            title: Event Type
          required: false
          description: >-
            Restrict to these event types. Repeat the parameter for multiple
            values. Omit for everything.
        - in: query
          name: recalls_only
          schema:
            default: false
            description: >-
              Shorthand for the whole recall domain. Prefer this over listing
              the four ``recall.*`` values, because it keeps covering you when a
              fifth recall event ships.
            title: Recalls Only
            type: boolean
          required: false
          description: >-
            Shorthand for the whole recall domain. Prefer this over listing the
            four ``recall.*`` values, because it keeps covering you when a fifth
            recall event ships.
        - in: query
          name: api_version
          schema:
            anyOf:
              - $ref: '#/components/schemas/EnvelopeVersionEnum'
              - type: 'null'
            description: >-
              Render each ``envelope`` at this version. Defaults to the version
              pinned on your endpoints, so a replayed event goes through the
              same handler as a live delivery.
          required: false
          description: >-
            Render each ``envelope`` at this version. Defaults to the version
            pinned on your endpoints, so a replayed event goes through the same
            handler as a live delivery.
        - in: query
          name: limit
          schema:
            default: 100
            description: Events per page. Clamped to 200.
            maximum: 200
            minimum: 1
            title: Limit
            type: integer
          required: false
          description: Events per page. Clamped to 200.
        - in: query
          name: page
          schema:
            default: 1
            description: Page number (1-indexed).
            minimum: 1
            title: Page
            type: integer
          required: false
          description: Page number (1-indexed).
        - in: query
          name: page_size
          schema:
            default: 25
            description: Number of items per page (max 100).
            maximum: 100
            minimum: 1
            title: Page Size
            type: integer
          required: false
          description: Number of items per page (max 100).
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagedFeedEventSchema'
      security:
        - APIKeyHeaderAuth: []
        - OAuthTokenAuth: []
        - SessionAuth: []
components:
  schemas:
    WebhookEventTypeEnum:
      description: >-
        Every subscribable event type (C-4296).


        Mirrors :class:`apps.integrations.webhooks.catalog.WebhookEventType`.
        The

        two are asserted value-identical by

        ``test_webhook_catalog.py::TestCatalogIntegrity`` — this is the mirror
        the

        ``apps/CLAUDE.md`` API-empathy rule asks for, and typing the API's

        event-type fields as this enum is what puts the catalog in the published

        OpenAPI spec as ``enum: [...]`` instead of "any string".


        Members are named after the wire value with dots and hyphens replaced,
        but

        the **value** is the wire string and is what everything round-trips on.
      enum:
        - recall.opened
        - recall.amended
        - recall.expanded
        - recall.closed
        - signal.received
        - adverse_report.received
        - adverse_report.threshold_alert
        - serial_verification.flagged
        - test.ping
        - offer.updated
        - product.recalled
        - retailer.created
      title: WebhookEventTypeEnum
      type: string
    EnvelopeVersionEnum:
      description: |-
        Payload-envelope versions an endpoint can be pinned to (C-4296).

        Mirrors :class:`apps.integrations.webhooks.catalog.EnvelopeVersion`.

        ``v1`` is the pre-catalog envelope, retained permanently because every
        endpoint created before C-4296 is pinned to it. ``2026-07-01`` is the
        current shape; versions are dated from here on.
      enum:
        - v1
        - '2026-07-01'
      title: EnvelopeVersionEnum
      type: string
    PagedFeedEventSchema:
      properties:
        data:
          description: >-
            Items on the current page, each conforming to the endpoint's item
            schema. Empty when the result set is empty or ``page`` is past the
            end.
          items:
            $ref: '#/components/schemas/FeedEventSchema'
          title: Data
          type: array
        pagination:
          $ref: '#/components/schemas/PaginationMeta'
          description: Pagination envelope describing position within the full result set.
      required:
        - data
        - pagination
      title: PagedFeedEventSchema
      type: object
    FeedEventSchema:
      description: >-
        One event from the replay feed (``GET /webhooks/events/``).


        ``envelope`` is the exact object that was (or would have been) POSTed to

        an endpoint at the requested ``api_version``, so a subscriber can run a

        replayed event through the same handler as a live delivery with no
        special

        casing.
      examples:
        - cursor: 2026-07-29T08:00:00+00:00~4t3rmMvzGQrqAqZ3vPPGmM
          envelope:
            cursor: 2026-07-29T08:00:00+00:00~4t3rmMvzGQrqAqZ3vPPGmM
            data:
              gtins:
                - '00012345600012'
              recall_id: ...
            id: evt_9f0c2b1a4d6e4f0b8a1c2d3e4f5a6b7c
            source: closient
            specversion: '2026-07-01'
            time: '2026-07-29T08:00:00+00:00'
            type: recall.opened
          event_id: evt_9f0c2b1a4d6e4f0b8a1c2d3e4f5a6b7c
          event_type: recall.opened
          occurred_at: '2026-07-29T08:00:00Z'
      properties:
        cursor:
          description: >-
            Opaque resume token **for this event**. Persist the cursor of the
            last event you durably processed and pass it as ``?after=`` on
            reconnect to receive everything after it, gap-free and
            duplicate-free. Do not parse it — the format is not part of the
            contract.
          title: Cursor
          type: string
        event_id:
          description: >-
            Stable ``evt_...`` identifier, identical to the live delivery's. Use
            it to deduplicate.
          maxLength: 255
          title: Event Id
          type: string
        event_type:
          $ref: '#/components/schemas/WebhookEventTypeEnum'
          description: Catalog wire value.
        occurred_at:
          description: >-
            When the event happened — not when it was delivered, and not when
            you replayed it.
          format: date-time
          title: Occurred At
          type: string
        envelope:
          additionalProperties: true
          description: >-
            The full payload envelope, rendered at the ``api_version`` you
            requested.
          title: Envelope
          type: object
      required:
        - cursor
        - event_id
        - event_type
        - occurred_at
        - envelope
      title: FeedEventSchema
      type: object
    PaginationMeta:
      description: >-
        Page envelope returned alongside ``data`` on every paginated list
        endpoint.
      examples:
        - has_next: true
          has_previous: false
          page: 1
          page_size: 25
          total_count: 342
          total_pages: 14
      properties:
        page:
          description: >-
            1-indexed page number that was returned. Echoes the ``?page=`` query
            parameter.
          examples:
            - 1
          minimum: 1
          title: Page
          type: integer
        page_size:
          description: >-
            Number of items returned in ``data`` for this page. Capped at the
            endpoint's ``max_page_size`` (typically 100).
          examples:
            - 25
          minimum: 1
          title: Page Size
          type: integer
        total_count:
          description: Total number of items matching the query across all pages.
          examples:
            - 342
          minimum: 0
          title: Total Count
          type: integer
        total_pages:
          description: >-
            Total number of pages at the current ``page_size``. Always at least
            1 (an empty result still reports ``total_pages: 1``).
          examples:
            - 14
          minimum: 1
          title: Total Pages
          type: integer
        has_next:
          description: >-
            True when ``page < total_pages`` — clients can request
            ``page=page+1`` to continue.
          examples:
            - true
          title: Has Next
          type: boolean
        has_previous:
          description: >-
            True when ``page > 1`` — clients can request ``page=page-1`` to go
            back.
          examples:
            - false
          title: Has Previous
          type: boolean
      required:
        - page
        - page_size
        - total_count
        - total_pages
        - has_next
        - has_previous
      title: PaginationMeta
      type: object
  securitySchemes:
    APIKeyHeaderAuth:
      type: apiKey
      in: header
      name: X-API-Key
    OAuthTokenAuth:
      type: http
      scheme: bearer
    SessionAuth:
      type: apiKey
      in: cookie
      name: sessionid

````