Skip to content

Create an upload

POST/v1/asset-buckets/{uid}/uploads

Starts an upload by reserving an object and returning a presigned URL to send the file to. No file data goes through this endpoint.

Upload flow:

  1. Call this endpoint with the file's name, content type and size. The object is created with status pending_upload.
  2. Send the file's bytes with an HTTP PUT to upload_url (method is always PUT), setting every header in headers exactly as returned. For public buckets these include x-amz-acl: public-read and a Cache-Control header. The URL expires at expires_at (10 minutes by default).
  3. Call Complete an upload with object_id to mark the object ready. Only ready objects count towards storage usage and can be read with Create an object read URL.
bash
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: application/pdf" \
  -H "x-amz-acl: public-read" \
  -H "Cache-Control: public, max-age=31536000, immutable" \
  --data-binary @report.pdf

The object's key is generated for you. It is the bucket's key prefix, then key_prefix (if sent), then a slug of the file name with a short unique suffix, for example report-d5e6f7.pdf.

Things to know:

  • Allowed content types and extensions: application/pdf (.pdf), Word .docx (application/vnd.openxmlformats-officedocument.wordprocessingml.document), image/gif, image/jpeg (.jpg, .jpeg), image/png, image/svg+xml, image/webp, text/csv, text/html (.html, .htm), text/markdown and text/x-markdown (.md), text/plain (.txt, .md, .csv), application/vnd.apple.mpegurl and application/x-mpegurl (.m3u8), video/mp2t (.ts), video/mp4, video/quicktime (.mov, .qt), video/webm, video/x-matroska (.mkv) and video/x-msvideo (.avi).
  • If filename has an extension, it must match content_type.
  • size_bytes must be above zero and no larger than the maximum upload size (1 GiB by default, shown as max_upload_bytes in Get workspace bucket usage).
  • The upload is rejected with 403 if it would take your account's file storage past the free allowance.
  • The bucket must be ready.

Requires the resource write permission (owner, admin or developer role).

Authentication

Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.

Path parameters

uidstringRequired

The bucket's uid.

Headers

X-Workspace-SlugstringRequired

Slug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.

Request body

filenamestringRequired

Original file name. Used for the object's filename and to build its key. Its extension must match content_type.

content_typestringRequired

MIME type of the file. Case-insensitive. Must be one of the allowed types listed above.

size_bytesintegerRequired

Size of the file in bytes. Must be above zero and within the maximum upload size.

min 1

key_prefixstring

Optional folder path to place the object in, for example invoices/2026. Leading and trailing slashes are ignored. Each folder name must start with a letter or number and may contain only letters, numbers, spaces, dots, dashes and underscores.

max length 512

Response

201

The object was reserved and a presigned upload URL was created.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
object_idstringRequired

UID of the reserved object. Pass it to Complete an upload after the PUT succeeds.

keystringRequired

Generated object key inside the S3 bucket.

upload_urlstringRequired

Presigned URL to PUT the file's bytes to. Valid until expires_at.

public_urlstringRequired

Permanent URL the object will have on the public assets host.

read_urlstring

URL to read the object once uploaded. Presigned in private buckets, otherwise the public URL. Omitted if it could not be created.

read_url_expires_atstring (date-time)

When read_url stops working. Only present when it is signed.

read_url_is_signedbooleanRequired

true when read_url is a presigned, expiring URL.

methodstringRequired

HTTP method to use with upload_url. Always PUT.

One ofPUT

headersobjectRequired

Headers you must send with the PUT, exactly as given. Always includes Content-Type. Public buckets also require x-amz-acl and Cache-Control.

expires_atstring (date-time)Required

When upload_url expires (10 minutes after creation by default).

Errors

StatusMeaning
400Validation failed. Possible messages: invalid request (malformed JSON or a missing required field), filename is required, size_bytes must be greater than zero, file exceeds max upload size, unsupported file content_type, filename extension does not match content_type, filename must include a supported file extension, folder path is too long (max 512 characters) and folder names may only contain letters, numbers, spaces, dots, dashes, and underscores.
401The API key is missing, invalid, expired or revoked.
403Your role cannot upload, you cannot access the workspace, or the upload would exceed your account's free file storage allowance.
404The bucket does not exist in this workspace.
409The bucket is not ready.

Errors use the standard error format.