{"owner":"triggerdotdev","repo":"trigger.dev","hasSpec":true,"specFile":"docs/openapi.yml","branch":"HEAD","format":"yaml","version":"3.x (YAML)","title":"trigger.dev","description":"","endpoints":[],"spec":"openapi: 3.0.0\ninfo:\n  title: Trigger.dev API\n  description: API for triggering events in Trigger.dev\n  version: 1.0.0\nservers:\n  - url: https://api.trigger.dev\n    description: Trigger.dev API server\nsecurity:\n  - BearerAuth: []\npaths:\n  /api/v1/events:\n    post:\n      operationId: sendEvent\n      externalDocs:\n        description: Find more info here\n        url: \"https://trigger.dev/docs/api/events/send-event\"\n      tags:\n        - Events\n      summary: Create an event\n      description: Send an event to Trigger.dev to trigger job runs through eventTrigger()\n      requestBody:\n        required: true\n        content:\n          application/json:\n            schema:\n              $ref: \"#/components/schemas/EventRequest\"\n      responses:\n        \"200\":\n          description: Event successfully sent\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/EventResponse\"\n        \"400\":\n          description: Invalid request\n        \"401\":\n          description: Unauthorized - API key is missing or invalid\n        \"422\":\n          description: Invalid request body\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n\n  /api/v3/batches:\n    post:\n      operationId: createBatch\n      externalDocs:\n        description: Find more info here\n        url: \"https://trigger.dev/docs/triggering\"\n      tags:\n        - Batches\n      summary: Create a batch (Phase 1)\n      description: |\n        Phase 1 of 2-phase batch API. Creates a batch record and optionally blocks the parent run for batchTriggerAndWait.\n        After creating a batch, stream items via POST /api/v3/batches/{batchId}/items.\n      requestBody:\n        required: true\n        content:\n          application/json:\n            schema:\n              $ref: \"#/components/schemas/CreateBatchRequest\"\n      responses:\n        \"202\":\n          description: Batch successfully created\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/CreateBatchResponse\"\n          headers:\n            x-trigger-jwt-claims:\n              description: JWT claims for the batch\n              schema:\n                type: string\n            x-trigger-jwt:\n              description: JWT token for browser clients\n              schema:\n                type: string\n        \"400\":\n          description: Invalid request (e.g., runCount <= 0 or exceeds maximum)\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n        \"401\":\n          description: Unauthorized - API key is missing or invalid\n        \"422\":\n          description: Validation error\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n        \"429\":\n          description: Rate limit exceeded\n          headers:\n            X-RateLimit-Limit:\n              description: Maximum number of requests allowed\n              schema:\n                type: integer\n            X-RateLimit-Remaining:\n              description: Number of requests remaining\n              schema:\n                type: integer\n            X-RateLimit-Reset:\n              description: Unix timestamp when the rate limit resets\n              schema:\n                type: integer\n            Retry-After:\n              description: Seconds to wait before retrying\n              schema:\n                type: integer\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n        \"500\":\n          description: Internal server error\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n\n  /api/v3/batches/{batchId}/items:\n    post:\n      operationId: streamBatchItems\n      externalDocs:\n        description: Find more info here\n        url: \"https://trigger.dev/docs/triggering\"\n      tags:\n        - Batches\n      summary: Stream batch items (Phase 2)\n      description: |\n        Phase 2 of 2-phase batch API. Accepts an NDJSON stream of batch items and enqueues them.\n        Each line in the body should be a valid BatchItemNDJSON object.\n        The stream is processed with backpressure - items are enqueued as they arrive.\n        The batch is sealed when the stream completes successfully.\n      parameters:\n        - name: batchId\n          in: path\n          required: true\n          description: The batch ID returned from POST /api/v3/batches\n          schema:\n            type: string\n      requestBody:\n        required: true\n        content:\n          application/x-ndjson:\n            schema:\n              type: string\n              description: |\n                NDJSON (newline-delimited JSON) stream where each line is a BatchItemNDJSON object.\n                Example:\n                {\"index\":0,\"task\":\"my-task\",\"payload\":{\"key\":\"value1\"}}\n                {\"index\":1,\"task\":\"my-task\",\"payload\":{\"key\":\"value2\"}}\n          application/ndjson:\n            schema:\n              type: string\n              description: |\n                NDJSON (newline-delimited JSON) stream where each line is a BatchItemNDJSON object.\n      responses:\n        \"200\":\n          description: Items successfully processed\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/StreamBatchItemsResponse\"\n        \"400\":\n          description: Invalid request (e.g., invalid JSON, item exceeds maximum size)\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n        \"401\":\n          description: Unauthorized - API key is missing or invalid\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n        \"415\":\n          description: Unsupported Media Type - Content-Type must be application/x-ndjson or application/ndjson\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n        \"422\":\n          description: Validation error\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n        \"500\":\n          description: Internal server error\n          content:\n            application/json:\n              schema:\n                $ref: \"#/components/schemas/Error\"\n\ncomponents:\n  schemas:\n    Error:\n      type: object\n      properties:\n        message:\n          type: string\n    EventRequest:\n      type: object\n      properties:\n        event:\n          type: object\n          required:\n            - name\n          properties:\n            name:\n              type: string\n              description: The name of the event\n            payload:\n              type: object\n              additionalProperties: true\n              description: The payload of the event\n            context:\n              type: object\n              additionalProperties: true\n              description: An optional context object\n            id:\n              type: string\n              description: Unique identifier for the event. Auto-generated if not provided. If you provide an ID that already exists, the event will not be redelivered.\n            timestamp:\n              type: string\n              format: date-time\n              description: Event timestamp. Defaults to current timestamp if not provided.\n            source:\n              type: string\n              description: Event source, default is 'trigger.dev'.\n        options:\n          type: object\n          properties:\n            deliverAt:\n              type: string\n              format: date-time\n              description: Optional Date to deliver the event.\n            deliverAfter:\n              type: integer\n              description: Optional delay in seconds before delivering the event.\n            accountId:\n              type: string\n              description: Optional account ID to associate with the event.\n    EventResponse:\n      type: object\n      properties:\n        id:\n          type: string\n          description: The ID of the event that was sent.\n        name:\n          type: string\n          description: The name of the event that was sent.\n        payload:\n          $ref: \"#/components/schemas/DeserializedJson\"\n        context:\n          $ref: \"#/components/schemas/DeserializedJson\"\n          nullable: true\n          description: The context of the event that was sent. Null if no context was set.\n        timestamp:\n          type: string\n          format: date-time\n          description: The timestamp of the event that was sent.\n        deliverAt:\n          type: string\n          format: date-time\n          nullable: true\n          description: The timestamp when the event will be delivered. Null if not applicable.\n        deliveredAt:\n          type: string\n          format: date-time\n          nullable: true\n          description: The timestamp when the event was delivered. Null if not applicable.\n        cancelledAt:\n          type: string\n          format: date-time\n          nullable: true\n          description: The timestamp when the event was cancelled. Null if the event wasn't cancelled.\n    DeserializedJson:\n      type: object\n      additionalProperties: true\n      description: A JSON object that represents the deserialized payload or context.\n    CreateBatchRequest:\n      type: object\n      required:\n        - runCount\n      properties:\n        runCount:\n          type: integer\n          minimum: 1\n          description: Expected number of items in the batch. Must be a positive integer.\n        parentRunId:\n          type: string\n          description: Parent run ID (friendly ID) for batchTriggerAndWait.\n        resumeParentOnCompletion:\n          type: boolean\n          description: Whether to resume parent on completion. Set to true for batchTriggerAndWait.\n        idempotencyKey:\n          type: string\n          description: Idempotency key for the batch. If provided and a batch with this key already exists, the existing batch will be returned.\n    CreateBatchResponse:\n      type: object\n      required:\n        - id\n        - runCount\n        - isCached\n      properties:\n        id:\n          type: string\n          description: The batch ID (friendly ID). Use this to stream items via POST /api/v3/batches/{batchId}/items.\n        runCount:\n          type: integer\n          description: The expected run count.\n        isCached:\n          type: boolean\n          description: Whether this response came from a cached/idempotent batch.\n        idempotencyKey:\n          type: string\n          description: The idempotency key if provided.\n    BatchItemNDJSON:\n      type: object\n      required:\n        - index\n        - task\n      properties:\n        index:\n          type: integer\n          minimum: 0\n          description: Zero-based index of this item. Used for idempotency and ordering.\n        task:\n          type: string\n          description: The task identifier to trigger.\n        payload:\n          description: The payload for this task run. Can be any JSON value.\n        options:\n          type: object\n          additionalProperties: true\n          description: Options for this specific item.\n    StreamBatchItemsResponse:\n      type: object\n      required:\n        - id\n        - itemsAccepted\n        - itemsDeduplicated\n        - sealed\n      properties:\n        id:\n          type: string\n          description: The batch ID.\n        itemsAccepted:\n          type: integer\n          description: Number of items successfully accepted.\n        itemsDeduplicated:\n          type: integer\n          description: Number of items that were deduplicated (already enqueued).\n        sealed:\n          type: boolean\n          description: |\n            Whether the batch was sealed and is ready for processing.\n            If false, the batch needs more items before processing can start.\n            Clients should check this field and retry with missing items if needed.\n        enqueuedCount:\n          type: integer\n          description: Total items currently enqueued. Only present when sealed=false to help with retries.\n        expectedCount:\n          type: integer\n          description: Expected total item count. Only present when sealed=false to help with retries.\n  securitySchemes:\n    BearerAuth:\n      type: http\n      scheme: bearer\n      bearerFormat: JWT\n"}