Create an upload
Creating an upload sends one or more files to the Inbox of a project.
POST https://api.send.ai/v2/{team_id}/project/{project_id}/upload
Scope: Uploads › Create. This is the upload endpoint shown under Inbox › Import.
Request
Send the files as multipart/form-data. The request needs a Content-Length header, so send the files in one piece rather than streamed:
- Files: Each file is a form field, under any field name. All files of one request become one upload.
- name: The name is optional. Without it, the upload takes the name of the first file.
- meta: Meta is optional extra information, as a JSON list of names and values. It is kept on the upload and on each of its documents.
curl -X POST "https://api.send.ai/v2/tK3vQ9xLm2Rf8WbN0aZp/project/p3irz/upload" \
-H "Authorization: Bearer $SENDAI_API_KEY" \
-F "file=@order-4471.pdf" \
-F "name=Order 4471" \
-F 'meta=[{"name":"customer","value":"Acme"}]'
Files of these types are processed: PDF, Word, Excel, CSV, images (JPEG, PNG, GIF and TIFF), HTML, text and XML. Emails as .eml or .msg are unpacked into their body and attachments. Other files stay on the upload but are not processed.
Response
The answer comes as soon as the files are received, with the ID of the new upload:
{
"team_id": "tK3vQ9xLm2Rf8WbN0aZp",
"project_id": "p3irz",
"upload_id": "upld_7Hq2LmX9aB3cD4eF5gH"
}
The upload appears in the project a moment later. Until then, Get an upload answers 404.
Errors
| Status | Error | Cause |
|---|---|---|
| 400 | Header of type authorization was missing | The request has no Authorization header. |
| 401 | invalid API KEY | The key cannot be read. |
| 401 | unauthorized API KEY | The key is wrong, or not linked to this project. |