Skip to main content
POST
/
api
/
v3
/
batches
Create a batch (Phase 1)
curl --request POST \
  --url https://api.trigger.dev/api/v3/batches \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "runCount": 2,
  "parentRunId": "<string>",
  "resumeParentOnCompletion": true,
  "idempotencyKey": "<string>"
}
'
{
  "id": "<string>",
  "runCount": 123,
  "isCached": true,
  "idempotencyKey": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
runCount
integer
required

Expected number of items in the batch. Must be a positive integer.

Required range: x >= 1
parentRunId
string

Parent run ID (friendly ID) for batchTriggerAndWait.

resumeParentOnCompletion
boolean

Whether to resume parent on completion. Set to true for batchTriggerAndWait.

idempotencyKey
string

Idempotency key for the batch. If provided and a batch with this key already exists, the existing batch will be returned.

Response

Batch successfully created

id
string
required

The batch ID (friendly ID). Use this to stream items via POST /api/v3/batches/{batchId}/items.

runCount
integer
required

The expected run count.

isCached
boolean
required

Whether this response came from a cached/idempotent batch.

idempotencyKey
string

The idempotency key if provided.