batch creates one twin per uploaded file, up to 10,000 per batch. Requests in a batch run in parallel. Use a batch for more than a handful of traces.
The batch object
Statuses
A batch expires 7 days after creation, not counting time paused. At expiry, open requests are set to
expired with error batch_expired, and running twins are cancelled. A paused batch does not expire.
The batch item object
Akennet.batch_item is one request in a batch.
Create a batch
POST /v1/kennet/batches
Creates a batch of twins. Send JSON with an Idempotency-Key header. Max body 4 MiB.
202 with a batch object and a Location header. status is in_progress, or paused if the organization is out of credit. Each request creates a twin; list them with GET /v1/kennet/batches/{id}/items.
The whole batch is validated first. If any request is invalid, nothing is created.
Retrieve a batch
GET /v1/kennet/batches/{id}
Retrieves a batch with its current request_counts. Poll no more than every 30 seconds, or use webhooks.
Returns a batch object, or 404 resource_missing.
List batches
GET /v1/kennet/batches
Lists batches, newest first.
Returns
{object: "list", data, has_more, url}, with batch objects in data.
List a batch’s items
GET /v1/kennet/batches/{id}/items
Lists a batch’s requests, in the order sent.
Returns
{object: "list", data, has_more, url}, with kennet.batch_item objects in data. If has_more is true, pass the last custom_id as starting_after.
Download a batch’s results
GET /v1/kennet/batches/{id}/results
Downloads a batch’s items as JSON Lines, one kennet.batch_item per line, in the order sent. Available once the batch has ended; results_url gives the path.
200, application/x-ndjson. Download each completed item’s twin with GET /v1/kennet/twins/{twin_id}/content.
To retry failed or expired requests, upload their traces again and create a new batch.
Cancel a batch
POST /v1/kennet/batches/{id}/cancel
Cancels a batch. Requests not yet started are set to cancelled; running twins finish.
Returns a batch object, status: cancelling. The batch moves to cancelled and sends kennet.batch.cancelled when its running twins end.
Example: a directory of traces
Uploads every trace intraces/, creates one batch per 10,000 files, and downloads each completed twin into twins/.
Idempotency-Key with the batch, so a retry after a timeout returns that batch.
Test mode
Test mode allows 2 MiB files and 5 twins per organization per 24 hours. Requests beyond that fail withtest_quota_exhausted.