Attachments · 2 min read
Upload an Attachment
Upload a file to a LemuTickets ticket, or to attach to a comment
Uploads a file of up to 25 MB, such as an invoice, a photo of a damaged product or a log file. You can attach it to a ticket straight away, or upload it first and then attach it to a comment with Add a comment (attachment_ids).
/v1/attachmentsAttaching to a ticket needs the tickets.write scope in the ticket's project.
Request body#
Send the file as multipart/form-data, not JSON.
| Field | Type | Required | Description |
|---|---|---|---|
file | file | Yes | The file. Up to 25 MB. |
ticket | string | No | The ticket key (SUP-1042) or id to attach the file to. Leave it out to upload a file for a comment you post next. |
inline | boolean | No | true for an image shown inside a comment's text rather than as a separate file. Default false. |
Executables and scripts are refused, by extension (for example .exe, .msi, .bat, .sh, .js, .apk, .dmg, .ps1, .vbs, .jar) and by content.
Example request:
curl -X POST https://api.tickets.lemuai.com/v1/attachments \
-H "Authorization: Bearer ltk_live_your_api_key" \
-F "file=@invoice-58213.pdf;type=application/pdf" \
-F "ticket=SUP-1042"To attach the file to a comment, upload it without ticket (or with the same ticket), then send its id in attachment_ids:
curl -X POST https://api.tickets.lemuai.com/v1/tickets/SUP-1042/comments \
-H "Authorization: Bearer ltk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"body": "Please find the credit note attached.",
"visibility": "public",
"attachment_ids": ["a9c1e3b5-d7f2-4a4c-9e6b-8d0f2a4c6e8b"]
}'Response#
201
{
"id": "a9c1e3b5-d7f2-4a4c-9e6b-8d0f2a4c6e8b",
"filename": "invoice-58213.pdf",
"content_type": "application/pdf",
"size_bytes": 182344,
"scan_status": "clean",
"inline": false,
"ticket_id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
"comment_id": null,
"created_at": "2026-11-25T10:05:33.902000+00:00",
"download_url": "<signed link to the file>",
"download_expires_in": 900
}| Field | Type | Description |
|---|---|---|
id | string | The attachment's id. Use it in attachment_ids. |
filename | string | The file name, cleaned of unsafe characters. |
content_type | string | The file's type. |
size_bytes | integer | The size. |
scan_status | string | clean when the file is stored and can be downloaded. |
inline | boolean | Whether it is an inline image. |
ticket_id | string or null | The ticket it belongs to. |
comment_id | string or null | The comment it belongs to, once attached to one. |
created_at | string | When it was uploaded. |
download_url | string or null | A link to download the file. It works for 15 minutes. |
download_expires_in | integer or null | Seconds until download_url stops working (900). |
Downloading a file#
download_url expires after 15 minutes, so don't store it. To get a fresh link later, call:
curl https://api.tickets.lemuai.com/v1/attachments/a9c1e3b5-d7f2-4a4c-9e6b-8d0f2a4c6e8b \
-H "Authorization: Bearer ltk_live_your_api_key"It returns the same fields with a new download_url.
Errors#
| Status | code | When |
|---|---|---|
404 | ticket_not_found | ticket does not exist, or you cannot see it |
422 | file_too_large | The file is over 25 MB |
422 | empty_file | The file is empty |
422 | blocked_file_type | The file is an executable or script |
422 | invalid_fields | file is missing |
Was this page helpful?
Docs