Skip to navigation

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.

conversation_id is required. An attachment belongs to the channel it will be sent on, so one upload serves one conversation — to send the same file to two conversations, upload it twice.

Send the file as multipart/form-data.

Size is a plan dimension, checked per file at upload:

KindBasicProfessionalAccepted types
Image2 MB4 MBimage/jpeg, image/png
Video10 MB20 MBvideo/mp4, video/quicktime (.mov), video/webm, video/ogg, video/x-msvideo (.avi)
Voice / audio5 MB10 MBaudio/aac, audio/mp4, audio/x-m4a, audio/wav
Document5 MB10 MBapplication/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.

The usual alternative spellings are accepted too (image/jpg, video/avi, audio/m4a, audio/wave, audio/x-wav, audio/vnd.wave). This is exactly what Instagram delivers: GIF, WebP and other formats are refused at upload, rather than accepted and then failing when you send.

An uploaded attachment that is never sent is discarded after 24 hours.

A file type your plan does not include is refused with 403 attachment_not_in_plan. An unsupported file type, or a file over your plan’s size cap, is 422 validation_failed; for the size cap, details carries kind, cap_mb and size_bytes.

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.
conversation_idstringRequired

The conversation this file will be sent to. Required: a file belongs to the channel it will be sent on, so we must know the destination before it can be stored.

filefileRequired
The file itself. Its media type decides how it is presented.

Response

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

idstringOptional

Pass this as attachment_ids on the message.

identifierstringOptional
Our storage identifier for the file.
namestringOptional
The filename you uploaded.
urlstringOptionalformat: "uri"

Where the file is stored. Time-limited.

typeenumOptional
How it will be presented, inferred from the media type.
Allowed values:

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error