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

# Replay spend events to an endpoint

> Re-delivers the window's spend envelopes to ONE endpoint through the normal delivery path (per-endpoint stream, retry ladder, delivery log), honoring the endpoint's event subscriptions. Envelope ids are UNCHANGED: your consumer's event-id dedup decides what a redelivery means. Mind your downstream billing system's finite dedup window (Metronome 34 days, Stripe 24h+): replaying older than that window can double-bill on your side, so prefer pull-and-diff for old ranges. The window is capped at 7 days and 10,000 envelopes per call; both caps are checked before any delivery is queued, so a refused replay ships nothing.



## OpenAPI

````yaml POST /api/gateway/v1/spend-events/replay
openapi: 3.1.0
info:
  title: LangWatch API
  version: 1.0.0
  description: LangWatch openapi spec
servers:
  - url: https://app.langwatch.ai
security:
  - project_api_key: []
paths:
  /api/gateway/v1/spend-events/replay:
    post:
      tags:
        - Gateway Spend
      summary: Replay spend events to an endpoint
      description: >-
        Re-delivers the window's spend envelopes to ONE endpoint through the
        normal delivery path (per-endpoint stream, retry ladder, delivery log),
        honoring the endpoint's event subscriptions. Envelope ids are UNCHANGED:
        your consumer's event-id dedup decides what a redelivery means. Mind
        your downstream billing system's finite dedup window (Metronome 34 days,
        Stripe 24h+): replaying older than that window can double-bill on your
        side, so prefer pull-and-diff for old ranges. The window is capped at 7
        days and 10,000 envelopes per call; both caps are checked before any
        delivery is queued, so a refused replay ships nothing.
      operationId: postApiGatewayV1Spend-eventsReplay
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                from:
                  type: integer
                  minimum: -9007199254740991
                  maximum: 9007199254740991
                to:
                  type: integer
                  minimum: -9007199254740991
                  maximum: 9007199254740991
                endpoint_id:
                  type: string
                  minLength: 1
                  maxLength: 200
              required:
                - from
                - to
                - endpoint_id
      responses:
        '200':
          description: Replay accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      endpoint_id:
                        type: string
                      replay_id:
                        type: string
                      replayed:
                        type: integer
                      window:
                        type: object
                        properties:
                          from:
                            type: string
                          to:
                            type: string
                        required:
                          - from
                          - to
                    required:
                      - endpoint_id
                      - replay_id
                      - replayed
                      - window
                required:
                  - data
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
components:
  securitySchemes:
    project_api_key:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: >-
        Project API key for sending traces and accessing project-scoped
        resources. Format: sk-lw-... (no underscore). Obtain one by creating a
        project via the Admin API or the LangWatch UI.

````