Batches

Bulk-create up to 1000 passes in a single request. The Worker processes items sequentially, item-level idempotent via your external_ref.

Limits

LimitValue
Items per batch1000
Active batches per tenant10 (Pending + Processing)
Progress checkpoint intervalevery 10 items

Create a Batch

POST /api/v1/batches
POST /api/v1/batches
Headers:
  Authorization:   Bearer eyJhbGci...
  Idempotency-Key: nightly-import-2026-05-18

Body:
{
  "template_id": "3f2a1b4c-...",
  "intent":      "loyalty_card",
  "items": [
    {
      "external_ref": "cust-100",
      "data": { "member_name": "Anna", "member_id": "MBR100", "points": "100" }
    },
    {
      "external_ref": "cust-101",
      "data": { "member_name": "Ben",  "member_id": "MBR101", "points": "250" }
    }
  ]
}
โ— 202 Accepted
{
  "id":              "...",
  "status":          "pending",
  "total_count":     2,
  "completed_count": 0,
  "failed_count":    0,
  "progress_percent": 0,
  "job_id":          "...",
  "created_at":      "2026-05-18T10:00:00Z"
}

Get a Batch (with items)

GET /api/v1/batches/{id}

Returns the same shape as the create response, plus the items array with per-item success, pass_id and error.

Lifecycle

statusMeaning
pendingQueued, worker hasn't started.
processingWorker is iterating items.
completedEvery item succeeded.
partial_successSome items succeeded, others failed.
failedEvery item failed.
cancelledCaller cancelled before processing started.

Cancel a Pending Batch

DELETE /api/v1/batches/{id}

Only pending batches can be cancelled. Once the worker enters processing, DELETE returns 409 invalid_state.

Errors

HTTPerrorWhen
400invalid_request> 1000 items, duplicate external_ref in items, missing fields.
400invalid_templateTemplate not found / archived / wrong intent.
429too_many_batchesTenant already has 10 active batches.
409invalid_stateDELETE on a non-pending batch.