Upload contacts via CSV
POST /:account/contacts/upload
You may bulk-upload a CSV of contacts, if you need to import them from another system.
Examples
Importing a CSV
Request
POST /my_account/contacts/upload
Body
{
"file": "contacts.csv", // type: file
"headers": ["name","phone_number","business","tags"] // type: text
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
-H Authorization:"Bearer {token}" \
-X POST /my_account/contacts/upload
-d '{
"file": "contacts.csv", // type: file
"headers": ["name","phone_number","business","tags"] // type: text
}'
Response
Status
201
Response Type
No body
Example Body
{
"contact_import_slug": "some-slug"
}
Missing file parameter
Request
POST /my_account/contacts/upload
Body
{
"headers": ["name","phone_number"]
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
-H Authorization:"Bearer {token}" \
-X POST /my_account/contacts/upload
-d '{
"headers": ["name","phone_number"]
}'
Response
Status
422
Response Type
No body
Example Body
{
"error": "File is required."
}
Missing headers parameter
Request
POST /my_account/contacts/upload
Body
{
"file": "contact.csv",
"headers": null
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
-H Authorization:"Bearer {token}" \
-X POST /my_account/contacts/upload
-d '{
"file": "contact.csv",
"headers": null
}'
Response
Status
422
Response Type
No body
Example Body
{
"error": "Headers are a required field."
}
Headers missing required values
Request
POST /my_account/contacts/upload
Body
{
"file": "contacts.csv",
"headers": ["phone_number"]
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
-H Authorization:"Bearer {token}" \
-X POST /my_account/contacts/upload
-d '{
"file": "contacts.csv",
"headers": ["phone_number"]
}'
Response
Status
422
Response Type
No body
Example Body
{
"errors": [
"Missing required headers: name."
]
}
Headers include invalid headers
Request
POST /my_account/contacts/upload
Body
{
"file": "contacts.csv",
"headers": ["name","phone_number","invalid"]
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
-H Authorization:"Bearer {token}" \
-X POST /my_account/contacts/upload
-d '{
"file": "contacts.csv",
"headers": ["name","phone_number","invalid"]
}'
Response
Status
422
Response Type
No body
Example Body
{
"errors": [
"Invalid headers provided: invalid."
]
}
File is not a CSV
Request
POST /my_account/contacts/upload
Body
{
"file": "contacts.pdf",
"headers": ["name","phone_number","business","tags"]
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
-H Authorization:"Bearer {token}" \
-X POST /my_account/contacts/upload
-d '{
"file": "contacts.pdf",
"headers": ["name","phone_number","business","tags"]
}'
Response
Status
422
Response Type
No body
Example Body
{
"errors": [
"File must be a CSV (text/csv)."
]
}