Upload an attachment

Uploads a file so you can send it in a message. Two steps, deliberately: upload here, then pass the returned `id` as `attachment_ids` when you send the message. That way a large upload that fails can be retried without re-sending the message, and one file can go to several conversations. Send the file as `multipart/form-data`. **Size is a plan dimension, checked per file at upload:** | Kind | Basic | Professional | Accepted types | |---|---|---|---| | Image | 2 MB | **4 MB** | `image/jpeg`, `image/png` | | Video | 10 MB | **20 MB** | `video/mp4`, `video/mov`, `video/webm` | | Voice / audio | 5 MB | **10 MB** | `audio/wav`, `audio/aac`, `audio/x-m4a` | | Document | 5 MB | **10 MB** | `application/pdf` | Every plan with API access sends all four types; the difference between tiers is size, not which kinds of file are allowed. If your agreement sets different caps, those apply instead. Anything outside the allowlist, or over your plan's cap, is rejected with `400` before it is stored. An uploaded attachment that is never sent is discarded after 24 hours.

Authentication

AuthorizationBearer

Your API key, issued by ParsChat sales. One key per account, spanning every robot you own. Send it as Authorization: Bearer pk_live_….

Request

This endpoint expects a multipart form containing a file.
filefileRequired
The file itself.
typeenumOptional
How the file should be presented. Inferred from the media type when omitted.
Allowed values:

Response

The file was stored. Pass id when you send the message.

idstringOptional

Pass this as attachment_ids.

typeenumOptional
How it will be presented.
mimestringOptional
Detected media type.
filenamestringOptional
The filename you uploaded.
size_bytesintegerOptional
File size.
expires_atdatetimeOptional
When an unsent attachment is discarded.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
422
Unprocessable Entity Error
429
Too Many Requests Error