POST/v1/postbatches/{id}/import

Upload the CSV of a Postbatch

Attaches a completed csv upload (DRAFT or VALIDATED; a previous import is replaced) and starts the parse: encoding and delimiter detection, header checks, the row limit, a sample and a mapping proposal from the template presets or the header names. Pass a mapping to skip the proposal. Poll GET .../import. An Idempotency-Key stays with the import it made for as long as the import exists: the same key with the same upload and mapping answers that import, with another request it is refused (idempotency_key_reused).

Scope postbatches.writeIdempotent with a key

Path parameters

idstringrequired

Headers

Idempotency-Keystringmax length 255

Up to 255 characters, scoped to the organisation and the endpoint, kept for 24 hours: a repeat with the same body replays the stored response with Idempotent-Replayed: true (API-004).

Body

uploadIdstringrequiredmin length 1max length 40
mappingobject

Returns

25 fields of the 202 answer
idstringrequired
postbatchIdstringrequired
uploadIdstringrequired
kindenumrequired

An import is an ingestion of kind postbatch_file

postbatch_filepostflow_batchpostflow_file
statusenumrequired
UPLOADEDPARSINGPARSEDMAPPEDPROCESSINGDONEFAILEDCANCELLEDEXPIRED
encodingstring or nullrequired
delimiterstring or nullrequired
headersarray of stringrequired
sampleRowsarray of objectsrequired
rowCountinteger or nullrequired
malformedRowsarray of integerrequired
targetsarray of objectsrequired
3 fields
namestringrequired
requiredbooleanrequired
kindenumrequired
recipientvariablelistFieldgroup
proposedMappingobject or nullrequired
mappingSourcestring or nullrequired
mappingobject or nullrequired
issuesarray of objectsrequired
5 fields
codeenumrequired
unknown_targetunknown_columnunmapped_requiredunused_columnempty_expression
severityenumrequired
errorwarning
messagestringrequired
targetstring
columnstring
rowCountsobjectrequired

Counts per outcome: total, processed, created, held (valid), invalid (needsAttention), suppressed, duplicates and refused (lines that could not be read)

errorsarray of objectsrequired
3 fields
codestringrequired
messagestringrequired
lineinteger
errorRowsinteger or nullrequired

Rows in the error file once processed; null before, and after the purge

purgedAtdate-time or nullrequired

When the file, its rows and its error file were deleted: 7 days after the Postbatch was approved or cancelled, or when an import untouched for 30 days expired; the counts stay

parsedAtdate-time or nullrequired
startedAtdate-time or nullrequired
finishedAtdate-time or nullrequired
createdAtdate-timerequired
updatedAtdate-timerequired

Responses

202Success
401Authentication required or API key invalid
403Permission or scope missing, organisation suspended
404Not found
409A request with this Idempotency-Key is still in progress (idempotency_in_progress)
422Validation failed
429Rate limited for this API key and class; wait Retry-After seconds
otherError (RFC 9457 problem details)