Upload a file

Uploads one file, sent as the request body itself with its real Content-Type, never as a form. It answers the file with its id, which the request that uses it takes as its file_id.

Rules:

  • Content-Type is one of audio/wav or audio/mpeg (audio/x-wav, audio/wave, audio/vnd.wave and audio/mp3 are taken as those), and the file's first bytes must be what its type says.
  • Content-Length gives the file's size: at most 25 MB.
  • filename names it, as you'll see it in filename: control characters are removed, at most 255 characters; upload when you send none.

Response: 201 with { data }: the file's id, filename, content_type, size_bytes and expires_at, when it is deleted if nothing has used it.

Notes:

  • Send an Idempotency-Key to retry an upload safely: a retry with the same key and the same file answers the first upload again, with Idempotent-Replayed: true, and stores nothing new.
  • A 500 names the file it was storing: wait Retry-After, then GET it to see whether it was uploaded.
  • An answer of 400, 401, 403, 405, 409, 413, 415, 429 or 503 stores nothing.
  • A body typed multipart/form-data, application/x-www-form-urlencoded or text/plain that doesn't carry this site's Origin is refused with a 403 in plain text, not the error object, before this endpoint answers.
  • Every answer carries X-Request-Id and Cache-Control: private, no-store.
Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
string
length ≤ 255

The file's name, as filename answers it: at most 255 characters, control characters removed. upload when absent or empty.

Body Params

The file itself.

Headers
integer
required
0 to 26214400

The file's size in bytes, at most 26214400 (25 MB). Most HTTP clients send it for you.

string
length between 1 and 255

A unique value for this upload (a UUID is usual), 1 to 255 printable ASCII characters. Send it again, unchanged, on every retry, whatever went wrong: an error, a 503 that isn't JSON, a timeout. A retry with the same key never repeats the work: for 24 hours it answers the first answer again. The same key with a different file, filename or Content-Type is 400 idempotency_key_reused; while the first request still runs, 409 idempotency_key_in_use. Use a new key only for a new upload, or once a GET showed that an upload didn't happen. Keys are kept per credentials and per account.

uuid

Send Account-Id when your credentials reach more than one account (GET /me lists them in accounts). An API key acts in its own account, and a person in one organization in theirs: neither needs it. A person in several organizations must name it on every write (400 account_required); their reads without it use their home account. Credentials with no home account in GET /me need it on every request but GET /me. An account your credentials can't act in: 403 forbidden. Empty, not an account id, or sent twice: 400 parameter_invalid. Each names Account-Id in param.

string
enum
Defaults to audio/wav

Generated from available request content types

Allowed:
Responses

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json