Saltar al contenido principal

Batches

Bulk submission from an uploaded manifest.

POST /v1/batches​

Register a batch and get the manifest upload

Reserves a batch and returns a presigned request to upload the manifest (CSV or JSONL). Upload it, then call POST /v1/batches/{batchId}/start. Every row goes through the same flow as POST /v1/messages.

  • Authentication: API key in the Authorization: Bearer header
  • Scopes: at least one of batches:write, messages:write
  • operationId: createBatch

Parameters​

NameInTypeRequiredDescription
Idempotency-KeyheaderstringYesClient-generated key, scoped to the tenant. Repeating a request with the same key and the same body returns the original response with Idempotent-Replayed: true; the same key with a different body is rejected with 422 idempotency_key_reused.

Request body (application/json)​

FieldTypeRequiredDescription
formatstring (CSV or JSONL)YesJSONL: one SubmitMessageRequest per line. CSV: header row with a required to column; lists use ;.
bytesintegerYesExact size of the manifest; the upload is rejected if it differs.
sha256Sha256YesSHA-256 digest, lowercase hexadecimal.
namestringNoName of the batch, repeated in reports and in the batch.completed event (1 to 128 characters).
prioritystring (BULK or TRANSACTIONAL)NoDispatch lane of the rows that do not set options.priority.
defaultsobjectNoValues applied to every row unless the row sets them (options and metadata are merged). Accepts from, replyTo, subject, html, text, attachments, options and metadata.

Responses​

CodeDescriptionSchema
200Replay of an earlier request with the same Idempotency-Key.CreateBatchResponse
201Batch created.CreateBatchResponse
400The request is malformed. The body is not valid JSON or not a JSON object, a field is invalid (errors lists each one), a header or query parameter is invalid, or the Content-Type is not application/json where a JSON body is expected (unsupported_media on the control plane).Problem
401Missing or invalid API key.Problem
403The API key is not allowed to perform this operation.Problem
413Manifest larger than the allowed size (manifest_too_large).Problem
422The request is well formed but cannot be accepted.Problem
429Rate limit or quota exceeded.Problem
503A dependency (storage, ledger, vault, renderer or mail service) is temporarily unavailable. Retry after the number of seconds in Retry-After when present.Problem

POST /v1/batches/{batchId}/start​

Start processing an uploaded manifest

Checks that the uploaded manifest matches the declared size and SHA-256 and starts processing. Starting a running batch answers 200.

  • Authentication: API key in the Authorization: Bearer header
  • Scopes: at least one of batches:write, messages:write
  • operationId: startBatch

Parameters​

NameInTypeRequiredDescription
batchIdpathBatchIdYesIdentifier of the batch.

Responses​

CodeDescriptionSchema
200Already running.Batch
202Processing started.Batch
401Missing or invalid API key.Problem
403The API key is not allowed to perform this operation.Problem
404The resource does not exist or belongs to another tenant.Problem
409The batch is finished (batch_not_startable).Problem
422Manifest missing or different from the declaration (manifest_not_uploaded, manifest_mismatch).Problem
429Rate limit or quota exceeded.Problem
503A dependency (storage, ledger, vault, renderer or mail service) is temporarily unavailable. Retry after the number of seconds in Retry-After when present.Problem

POST /v1/batches/{batchId}/cancel​

Cancel a batch

Stops the execution; no row is processed after the cancellation is recorded. Canceling a canceled batch answers 200.

  • Authentication: API key in the Authorization: Bearer header
  • Scopes: at least one of batches:write, messages:write
  • operationId: cancelBatch

Parameters​

NameInTypeRequiredDescription
batchIdpathBatchIdYesIdentifier of the batch.

Responses​

CodeDescriptionSchema
200Already canceled.Batch
202Canceled.Batch
401Missing or invalid API key.Problem
403The API key is not allowed to perform this operation.Problem
404The resource does not exist or belongs to another tenant.Problem
409The batch is finished (batch_not_cancelable).Problem
429Rate limit or quota exceeded.Problem
503A dependency (storage, ledger, vault, renderer or mail service) is temporarily unavailable. Retry after the number of seconds in Retry-After when present.Problem

GET /v1/batches/{batchId}​

Read the state and progress of a batch

Status, counters and progress. When the batch has finished, downloads carries presigned links to the report and the rejected rows.

  • Authentication: API key in the Authorization: Bearer header
  • Scopes: at least one of batches:read, messages:read
  • operationId: getBatch

Parameters​

NameInTypeRequiredDescription
batchIdpathBatchIdYesIdentifier of the batch.

Responses​

CodeDescriptionSchema
200The batch.Batch
401Missing or invalid API key.Problem
403The API key is not allowed to perform this operation.Problem
404The resource does not exist or belongs to another tenant.Problem
429Rate limit or quota exceeded.Problem
503A dependency (storage, ledger, vault, renderer or mail service) is temporarily unavailable. Retry after the number of seconds in Retry-After when present.Problem

GET /v1/batches/{batchId}/items​

List the outcome of each row

Rows in manifest order, with cursor paging.

  • Authentication: API key in the Authorization: Bearer header
  • Scopes: at least one of batches:read, messages:read
  • operationId: listBatchItems

Parameters​

NameInTypeRequiredDescription
batchIdpathBatchIdYesIdentifier of the batch.
statusquerystring (ACCEPTED or REJECTED)NoOnly rows with this outcome.
cursorqueryCursorNoOpaque pagination token. Do not parse or build it.
limitqueryintegerNoMaximum number of rows per page, from 1 to 1000 (default 100).

Responses​

CodeDescriptionSchema
200A page of rows.BatchItemList
400The request is malformed. The body is not valid JSON or not a JSON object, a field is invalid (errors lists each one), a header or query parameter is invalid, or the Content-Type is not application/json where a JSON body is expected (unsupported_media on the control plane).Problem
401Missing or invalid API key.Problem
403The API key is not allowed to perform this operation.Problem
404The resource does not exist or belongs to another tenant.Problem
429Rate limit or quota exceeded.Problem
503A dependency (storage, ledger, vault, renderer or mail service) is temporarily unavailable. Retry after the number of seconds in Retry-After when present.Problem