Batches and files
Many cards for one Postflow at once: a batch of up to 5,000 items in one request, or a file of up to 250 MB (NDJSON or CSV, a million typical cards) put through a signed link. Both are answered 202 with an ingestion: a job then makes the cards with exactly the rules of the single create (POST /v1/postflows/{id}/items), in order, and every row's outcome can be read back. Batches and files are part of the Postflows of your plan; without them every route answers 403 feature_not_entitled.
A batch
POST /v1/postflows/{id}/items/batch takes { "items": [...] }, each item the body of a single create. The whole body is at most 20 MB (larger answers 413 import_too_large).
POST /v1/postflows/pf_…/items/batch
Authorization: Bearer pb_live_…
Idempotency-Key: crm-export-2026-12-03
Content-Type: application/json
{
"items": [
{
"recipient": { "name": "Anna de Vries", "addressLine1": "Dam 1", "postalCode": "1012 JS", "city": "Amsterdam" },
"variables": { "firstName": "Anna" },
"externalId": "crm-1001"
},
{
"recipient": { "name": "Bert Jansen", "addressLine1": "Kerkstraat 12", "postalCode": "1234 AB", "city": "Utrecht" },
"variables": { "firstName": "Bert" },
"sendDate": "2026-12-20"
}
]
}The batch is checked as a whole: the Postflow exists and is not archived (409 postflow_archived), the key holds items.write, the body has between 1 and 5,000 items. An item the single create would refuse does not refuse the batch: it becomes a refused row with the same reason. The answer is always 202 with the ingestion; its cards are made by a job, usually within seconds.
A file
A file holds any number of cards up to 250 MB, in one of two forms:
- NDJSON (
application/x-ndjson): one single create's body per line, UTF-8. Blank lines are left out; a line longer than 1 MB is refused by its number. - CSV (
text/csv): the single create's names flattened with dots as the header row (see below).
Three steps:
POST /v1/postflows/{id}/items/fileswith{ "format": "ndjson" | "csv", "fileName": "...", "sizeBytes": 123456 }answers201with anuploadIdand a signedupload(url,method,headers), valid for an hour.PUTthe file's bytes toupload.urlwith exactlyupload.headers(no API key; the link is the permission).POST /v1/postflows/{id}/items/files/startwith{ "uploadId": "..." }answers202with the ingestion. Starting the same upload again answers the same ingestion. A start without an uploaded file, or with a file of another size than announced, answers422.
The job scans the file like every upload, reads it as a stream (never whole) and makes the cards a thousand at a time. An upload never started is removed after a day.
The CSV columns
There is no mapping: the header names are fixed, and GET /v1/postflows/{id}/items/files/template downloads the header row of a Postflow, with its design's fields.
| Column | Holds |
|---|---|
recipient.name, recipient.addressLine1, recipient.addressLine2, recipient.postalCode, recipient.city, recipient.country | The recipient, as in the single create |
variables.<name> | A field of the design, typed by the field: a number with a dot or a comma (12.5, 12,5), yes or no words (true, ja, yes, 1; false, nee, no, 0), otherwise text |
variables.<list> | A list field's entries as JSON, for example [{"product":"Tent","price":120}] |
metadata.<key> | A metadata value, as text |
externalId, sendDate, advertisingCategory | As in the single create |
- An empty cell leaves the field out, as an absent field in JSON does (so a CSV cannot set
advertisingCategorytonull; the Postflow's category applies). - A header the cards do not take, or a header given twice, fails the file before any card is made (
FAILEDwithfile_invalidnaming the columns). - The delimiter is a comma, a semicolon or a tab, read from the header row; the file is UTF-8 (a byte order mark is ignored); quotes follow RFC 4180.
- A row with another number of cells than the header is refused by its number.
recipient.name,recipient.addressLine1,recipient.postalCode,recipient.city,variables.firstName,variables.amount,externalId
Anna de Vries,Dam 1,1012 JS,Amsterdam,Anna,"12,5",crm-1001
Bert Jansen,Kerkstraat 12,1234 AB,Utrecht,Bert,3,crm-1002The ingestion
GET /v1/ingestions/{id} shows the batch or file; GET /v1/ingestions lists them newest first (a key sees its own mode; filter with postflowId).
{
"id": "ing_01JF8Q2W3E4R5T6Y7U8I9O0P1A",
"kind": "postflow_batch",
"status": "DONE",
"postflowId": "pf_01JF8Q2W3E4R5T6Y7U8I9O0P1B",
"format": "json",
"isTest": false,
"counts": {
"total": 5000,
"processed": 5000,
"created": 4962,
"needsAttention": 21,
"suppressed": 9,
"duplicates": 6,
"refused": 2
},
"errors": [],
"errorFile": { "rows": 38, "path": "/v1/ingestions/ing_01JF8Q2W3E4R5T6Y7U8I9O0P1A/errors" },
"createdAt": "2026-12-03T09:00:00.000Z",
"startedAt": "2026-12-03T09:00:00.000Z",
"finishedAt": "2026-12-03T09:00:07.000Z",
"purgedAt": null
}status runs UPLOADED (a file waiting for its job), PARSING (a file being read), PROCESSING (cards being made) and DONE; FAILED with errors when a file cannot be read. An accepted batch or file always finishes: a job that stopped is picked up again within minutes and goes on where it stopped, and no card is made twice.
Rows and outcomes
Every unit has a row number: its position in the batch (from 1), its line in an NDJSON file, its record in a CSV file (the header is row 1). GET /v1/ingestions/{id}/rows lists them in that order, cursor paged (limit up to 500), with outcome as a filter:
| Outcome | Meaning |
|---|---|
created | A card was made as it is (itemId); its own status says where it is |
needs_attention | A card was made that needs a fix (itemId, the warnings as reasons), as the single create's NEEDS_ATTENTION |
suppressed | A card was made and held back by the suppression list |
duplicate | No card: the same address, or the same externalId, as an earlier row of this batch or file (duplicateOf.itemId) |
refused | No card: the first reason's code is what the single create would have answered (validation_failed with the fields, allowance_exceeded) |
A row not sent as it is carries its values under the flattened names (recipient.name, variables.firstName); without personal_data.read each value reads [hidden]. A created row carries no values.
Duplicates are found within one batch or file only; the same externalId in a later batch makes a new card, and the Idempotency-Key is what stops a batch or file from being taken twice.
The error file
Once the ingestion is DONE with rows not sent as they are, errorFile.path (GET /v1/ingestions/{id}/errors) downloads a CSV with a line per such row: its number, the outcome, the reason, then its values per column. It is formula-safe and needs personal_data.read.
Rows, values and the error file are kept until 7 days after the end; the counts stay. See data retention.
Events
The cards of a chunk of up to 1,000 lines are told together, written with them: one list event per type (items.created, items.needs_attention, items.suppressed or a journey's, such as items.in_flow) with the cards in data.items, each the item its single create would send. An endpoint subscribed to item.created receives items.created, or the cards one by one when it is set to per card (bulkDelivery: "per_card"). At the end ingestion.completed carries the ingestion's id, kind, status, Postflow, test flag, counts, errorRows and the codes of its errors, never a recipient or a field value. It belongs to the Postflows of your plan. See webhooks.
Idempotency, limits and load
- An
Idempotency-Keyon the batch or the file's start stays with the ingestion for its life: the same key and body answers the same ingestion (202), the same key with another body422 idempotency_key_reused. See idempotency. - A batch counts toward the
itemCreaterate limit by its items: it is let in while the minute's window has room left and then counts in full, so the window can end over its budget and further cards of that key wait for the next minute. A file is not counted by its rows; its two routes are in theuploadclass. See rate limits. - While the platform works through a large backlog, new batches and files are refused with
429 ingestions_busyandRetry-After; retry after that many seconds. Single cards are still taken, and batches and files already accepted always finish. - Test keys make test ingestions with test cards, which never reach production.
With the SDKs
The SDKs send a fresh Idempotency-Key unless you give one, retry a 429 after its Retry-After, and wait for the end when you ask them to.
const batch = await client.createItemBatch(postflow.id, items, {
idempotencyKey: 'crm-export-2026-12-03',
});
const done = await client.waitForIngestion(batch.id);
for await (const row of client.ingestionRows(done.id, { outcome: 'refused' }))
console.log(row.rowNumber, row.reasons[0]?.code);
const file = await client.uploadItemFile(postflow.id, ndjson, { format: 'ndjson' });
const template = await client.itemFileTemplate(postflow.id);
const errors = await client.downloadIngestionErrors(file.id);batch = client.create_item_batch(postflow_id, items, idempotency_key="crm-export-2026-12-03")
done = client.wait_for_ingestion(batch["id"])
for row in client.ingestion_rows(done["id"], outcome="refused"):
print(row["rowNumber"], row["reasons"][0]["code"])
file = client.upload_item_file(postflow_id, open("cards.csv", "rb").read(), format="csv")
template = client.item_file_template(postflow_id)
errors = client.download_ingestion_errors(file["id"])The generated operations are client.postflows.createItemBatch, announceItemFile, startItemFile and itemFileTemplate, and client.ingestions.list, get, rows and errors (snake case in Python). See SDKs.