Upload a file
POST /v1/media
Uploads a file to send in a message. Send it as multipart/form-data, with the file in a field called file.
Needs messages:send. Counts against the heavy request limit (10 a minute).
Soosh reads the file type from the file itself, not from its name or the Content-Type of the part.
file file Required
The file to upload.
Headers
Section titled “Headers”Accepted files
Section titled “Accepted files”| Kind | Types | Largest |
|---|---|---|
| Image | JPEG, PNG | 5 MB |
| Video | MP4, 3GPP | 14 MB |
| Audio | AAC, MP4, MPEG (MP3), AMR, OGG | 14 MB |
| Document | PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, TXT, CSV | 14 MB |
How long it's kept
Section titled “How long it's kept”An upload is kept for 30 days: expires_at is the day it goes. A message, or a scheduled or running broadcast, that uses it keeps it longer.
Next: send it
Section titled “Next: send it”Send the file with POST /v1/messages, using the returned id as media.media_id. A template with a file in its header takes it as template.header.media_id, in POST /v1/messages and in POST /v1/broadcasts.
Returns
Section titled “Returns”201 The file object. The stored file, with its id.
Errors
Section titled “Errors”Besides the ones every request can get:
invalid_requestThe body isn’t multipart/form-data, has a field other than file, or has more than one file.too_largeThe file is over the size for its type, or the request is over the endpoint’s size limit.idempotency_mismatchThe Idempotency-Key was used before for a different file, or by another of your API keys.