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:
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
Your API key, issued by ParsChat sales. One key per account, spanning every robot you own. Send it as Authorization: Bearer pk_live_….
Request
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.
Response
The file was stored. Pass id as attachment_ids when you send the message.
Pass this as attachment_ids on the message.
Where the file is stored. Time-limited.