Import contacts from a CSV file
Queue an import of contacts from a CSV file. Send it as multipart/form-data with the file in the file field, or as application/json for a caller that cannot send multipart: { csv, filename? }, the whole file as text. The first row is the header and must include an email column; other columns become custom fields.
The file may be up to 5 MB and must hold no more rows than the project's per-import limit; a file over either limit, or one with no email column, is refused with 400 VALIDATION_ERROR (IMPORT_LIMIT_EXCEEDED for the row limit) before anything is queued, as is a call with no body, a body that is neither multipart nor valid JSON, or no file part. A JSON body that is not { csv, filename? } answers 422 VALIDATION_ERROR. The import runs in the background, so new contacts appear in the contact list as it finishes.
Requires the contacts:write scope — Create, update, and delete your contacts.
API key authentication. Use a sk_* (FULL) or pk_* (SENDING_ONLY) key as the bearer token. Public keys (pk_*) are restricted to the email-send endpoints and the self-serve list subscribe/unsubscribe pair; every other endpoint — event tracking included — answers 403 for them. In scope terms (used by /api/v1/* operations): FULL keys hold every scope; SENDING_ONLY keys hold only emails:send.
In: header
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/contacts/import" \ -H "Content-Type: application/json" \ -d '{ "csv": "string" }'{
"success": true,
"data": {
"message": "string"
}
}{
"success": false,
"error": {
"message": "string",
"code": "string",
"details": {
"errors": [
null
]
}
}
}{
"success": false,
"error": {
"message": "string",
"code": "string",
"details": {
"errors": [
null
]
}
}
}{
"success": false,
"error": {
"message": "string",
"code": "string",
"details": {
"errors": [
null
]
}
}
}{
"success": false,
"error": {
"message": "string",
"code": "string",
"details": {
"errors": [
null
]
}
}
}{
"success": false,
"error": {
"message": "string",
"code": "string",
"details": {
"errors": [
null
]
}
}
}{
"success": false,
"error": {
"message": "string",
"code": "string",
"details": {
"errors": [
null
]
}
}
}{
"success": false,
"error": {
"message": "string",
"code": "string",
"details": {
"errors": [
null
]
}
}
}