Skip to content

Upload a file for a ticket message

PUT /v1/tickets/uploads

Uploads a file to send with a message: send its bytes as the body, with Content-Type: application/octet-stream and its size in Content-Length (400 length_required without it), and its name in filename. Then name its id in fileIds when you open a ticket or reply.

Screenshots (PNG, JPEG, GIF or WebP), PDFs and text files named .txt or .log, up to 10 MB each (413 payload_too_large). What a file is comes from its bytes, not its name (422 unsupported_file). An upload not sent with a message within a day is removed; up to 20 can wait at once (409 too_many_uploads), and up to 60 can be made an hour (429 rate_limited). Location is the upload's address, to remove it. An Idempotency-Key is accepted, but an upload's answer isn't kept: a key can be sent again once its upload has finished.

Time. The whole upload must arrive within 5 minutes of the request's start: a slower one is cut off (the connection is closed, often with a plain 408 that isn't JSON), and nothing is kept.

Scopes

The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).

support:write
Open and answer tickets. Open support tickets and reply to them.

Headers

FieldType and description
Idempotency-Key

string 1 to 255 characters

A key of your own for this request, like a UUID: letters, digits and _ - : . Send the request again with the same key (after a timeout, say) and it's done only once. Keys are kept for 24 hours (see Idempotency).

Query parameters

FieldType and description
filename Required

string 1 to 200 characters

The file's name, like checkout-error.png, up to 200 characters. A text file's name must end in .txt or .log.

Request body

The file itself, as the request's raw body, with Content-Type: application/octet-stream.

Example request

curl -X PUT "https://api.rabbitflare.com/v1/tickets/uploads?filename=checkout-error.png" \
  -H "Authorization: Bearer $RABBITFLARE_TOKEN" \
  -H "Content-Type: application/octet-stream" \
  --data-binary "@upload.bin"

Response

201 Created Returns the TicketFile object in data.

The TicketFile object's fields 4 fields
FieldType and description
id

string

The file's id: what fileIds takes, and what GET /tickets/{ticketRef}/files/{fileId} downloads once it's sent.

filename

string

The file's name, as it's downloaded.

contentType

string

The file's type, found from its bytes: a PNG, JPEG, GIF or WebP picture, a PDF, or plain text.

Known values: image/pngimage/jpegimage/gifimage/webpapplication/pdftext/plain More can appear.

sizeBytes

integer

The file's size, in bytes.

Example response

201 Created
{
  "data": {
    "id": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
    "filename": "checkout-error.png",
    "contentType": "image/png",
    "sizeBytes": 184320
  }
}

Errors

The errors this request can answer besides those every request can (a missing token, a missing scope, the rate limits). Each answer is an Error object (see Errors).

Status and codeWhen, and what to do
400 invalid_parameter

A query parameter is unknown or has a wrong value (fields names it), or the query is too long: over 16,384 characters, or a parameter's name over 64.

Correct or remove the parameter named in fields.

400 length_required

An upload was sent without a Content-Length header.

Send the file's size in Content-Length.

409 too_many_uploads

Twenty uploads already wait to be sent with a message.

Send them with a message, or remove the ones you don't need (DELETE /v1/tickets/uploads/{uploadId}). Uploads not sent within a day are removed.

409 attachments_unavailable

Files can't be attached right now.

Describe the problem in words, or try again later.

413 payload_too_large

The body is larger than the operation accepts (1 MB for JSON).

Send less data; uploads have their own limit.

413 file_too_large

The file is larger than one attachment may be (10 MB).

Send a smaller file.

415 unsupported_media_type

The body isn't sent as application/json (or application/octet-stream for uploads).

Send Content-Type: application/json with a JSON body.

422 empty_file

The file is empty.

Upload the file with its bytes.

422 unsupported_file

The file isn't one that can be attached: screenshots (PNG, JPEG, GIF or WebP), PDFs and text files. What a file is comes from its bytes, not its name.

Send one of those (a text file's name must end in .txt or .log).

429 rate_limited

Too many requests. scope says which limit: token, account, create, operation or network.

Wait for Retry-After seconds, then go on more slowly.

Rate limit

Write requests: 30 a minute per token, 60 per account. More in Rate limits.

Added on .

Popular

API docs