Request a presigned upload URL

Step 1 of the three-step direct upload. File bytes never travel through this API; they go straight to storage.

  1. POST /files/upload-url — declare usage, content_type and size_bytes. The response carries the new file_id and a presigned url, and the file starts in status pending.
  2. PUT the bytes to that url, with Content-Type equal to the declared content_type and Content-Length equal to size_bytes. Both are signed into the URL, so storage rejects a PUT that deviates from either. Send no API credentials on this request.
  3. POST /files/{file_id}/confirm — the file flips to uploaded and can be used.

kind is derived from content_type and must be one the declared usage allows; size_bytes must fit that kind's limit. GET /files/constraints lists both. Past expires_at the URL no longer works — request a new one, which creates a new file.

Body Params

Declares the file about to be uploaded directly to storage.

string
enum
required

What the file is for; it decides which content types are accepted.

Allowed:
string
required
^[a-z]+/[a-z0-9.+-]+$

MIME type of the bytes to upload. Must be one GET /files/constraints lists for a kind the usage allows, and must be sent as the Content-Type header on the upload PUT.

int64
required
≥ 1

Exact size of the bytes to upload. Signed into the upload URL, so the PUT must send the same Content-Length, and it must fit the kind's max_size_bytes.

Responses

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