reflex

Upload an async batch

Queue up to 10,000 rows for offline classification at the discounted batch rate. Returns immediately with a batch_id once the rows are queued — it does not wait for classification. model must be an array here, even for one model. Pass an Idempotency-Key header to make retries safe (a replay returns the existing batch).

post/v1/reflex/asynchronous_batches/upload

Headers

Idempotency-Keystring

Client-generated key that identifies this upload attempt.

Example:a7c1f0e2-3b44-4c9a-9f10-2f5c8d6b1e33

Replaying the same key returns the existing batch instead of creating a duplicate.

Request body

Example request

{
  "requests": [
    {
      "id": "row-1",
      "model": [
        "guardrail",
        "jailbreak"
      ],
      "text": "text to classify"
    },
    {
      "id": "row-2",
      "model": [
        "stuck-in-a-loop"
      ],
      "text": "let me try that again. let me try that again."
    }
  ]
}

Response

Existing batch returned for a replayed Idempotency-Key.

idstring required

Identifier for the queued batch.

objectstring required

Object type, always reflex.batch.

status'queued' | 'in_progress' | 'completed' required

Where the batch is in the queue.

created_atinteger required

Unix timestamp (seconds).

Example response

{
  "id": "rbatch-a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
  "object": "reflex.batch",
  "status": "queued",
  "request_counts": {
    "total": 2,
    "completed": 0,
    "failed": 0
  },
  "created_at": 1780000000
}

Changes