Attachment schema
An attachment object describes one uploaded file. POST /attachments/upload returns one, attachment_get looks one up, and messages list them in attachments.
{ "id": "550e8400-e29b-41d4-a716-446655440000", "name": "diagram.png", "mime_type": "image/png", "size": 28431, "url": "https://chat.example.com/attachments/550e8400-e29b-41d4-a716-446655440000", "expires_at": 1788782400, "permanent": false, "width": 1280, "height": 720}interface Attachment { id: string; name: string; mime_type: string; size: number; url: string; expires_at: number | null; permanent: boolean; width?: number; height?: number;}| Field | Description |
|---|---|
id |
The upload’s ID. Send { "id": "..." } to attach it to a message. |
name |
The file name given at upload. |
mime_type |
The file’s MIME type, lowercased and without parameters. |
size |
Size in bytes, after any image processing. |
url |
Where to download the file. Usually GET /attachments/{id} on this server, but it can point to the server’s external storage instead. |
expires_at |
When the upload expires, in Unix seconds. null when the server keeps uploads forever. |
permanent |
Always false on the current server. |
width, height |
Pixel size. Present only for PNG and JPEG images. |
In messages
Section titled “In messages”When a message references an upload by id, the server swaps in the stored record above. The sender may override width and height with numbers.
An attachment with an ID the server doesn’t recognise is stored exactly as the sender wrote it. So an attachment object on a message doesn’t prove the server hosts that file, and its fields may not match this schema.
Once an upload expires, the server stops serving it, but messages keep their copy of the object. Its url on this server then returns 404.
See also
Section titled “See also”- Uploading attachments: the full upload flow.
- HTTP routes: upload and download errors.
