Contact imports
Upload a CSV, map it, dry-run it, then commit it with a consent declaration, all with an API key.
Imports bring contacts in from a CSV file with a record of where their consent came from. The flow is the dashboard's: upload, configure, dry run, commit. Imports cost 0 credits; the import is not a send.
| Operation | Scope | Rate class | Idempotency-Key |
|---|---|---|---|
GET /v1/imports | imports:read | read | |
GET /v1/imports/declaration | imports:read | read | |
GET /v1/imports/{id} | imports:read | read | |
GET /v1/imports/{id}/issues | imports:read | read | |
POST /v1/imports | imports:write | write | optional |
PUT /v1/imports/{id}/config | imports:write | write | optional |
POST /v1/imports/{id}/dry-run | imports:write | write | optional |
POST /v1/imports/{id}/commit | imports:write | write | required |
POST /v1/imports/{id}/cancel | imports:write | write | optional |
Every import call acts as a marketer, reads included, because the file and its report hold personal
data. imports:write is a sensitive scope and is never pre-selected.
Upload
The body is the CSV itself, up to 10 MiB, with Content-Type: text/csv:
curl "https://api.messagepipe.dev/v1/imports?brand_id=brd_xxxxxxxx&filename=customers.csv" \
-H "Authorization: Bearer mp_live_xxxxxxxxxxxxxxxx" \
-H "Content-Type: text/csv" \
-H "Idempotency-Key: import-2026-11-customers" \
--data-binary @customers.csvA repeat of the same file under the same Idempotency-Key replays the first answer; a different
file under the same key is 422 idempotency_mismatch. The gateway holds the file (up to the limit)
in memory while it forwards it.
Configure and dry-run
PUT /v1/imports/{id}/config takes a mapping (which CSV header is the email, names, tags,
attributes and the row's own consent date) and options: whether existing contacts are updated or
skipped, the topic_ids to subscribe them to, the consent basis, the consent statement_id and
version, collection_method and the collection_from date. The response says whether the
configuration is valid and lists problems.
POST /v1/imports/{id}/dry-run checks every row without changing anything; read the outcome from
GET /v1/imports/{id} and the row-level issues from GET /v1/imports/{id}/issues (JSON, or CSV with
?format=csv). Changing the configuration discards the dry run.
Commit and the consent declaration
GET /v1/imports/declaration returns the exact declaration text. Committing requires
"declaration_accepted": true (anything else, including the string "true", is refused), a finished
dry run of the saved configuration, and an Idempotency-Key:
curl -X POST https://api.messagepipe.dev/v1/imports/imp_xxxxxxxx/commit \
-H "Authorization: Bearer mp_live_xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: commit-imp_xxxxxxxx" \
-d '{"declaration_accepted": true}'The attestation records the declaration text, the file hash, the person who created the key, and the
key itself. The commit is audited as a warning with the key as actor. Whether a declaration made by
a machine on a person's behalf is acceptable consent evidence in your jurisdiction is a legal
question we have not settled; a workspace that does not want imports through the API simply does
not give any key imports:write.