Skip to content

Set bucket allowed origins

PUT/v1/asset-buckets/{uid}/cors

Replaces the browser origins allowed to make cross-origin (CORS) requests to the bucket, for example so a web app can upload directly to a presigned URL or fetch objects with fetch(). The RumptyCloud console's own origin is always allowed and is not listed.

The list you send replaces the current one. Send an empty array to remove all custom origins. The change is saved immediately and pushed to storage. If that push fails, a background sync applies it shortly afterwards.

Rules for each origin:

  • Must be scheme://host[:port] with https:// or http://, for example https://app.example.com. Paths, queries, fragments and credentials are rejected.
  • * allows any site. A leading *. wildcard in the host (for example https://*.example.com) allows subdomains. * is not allowed anywhere else in the host.
  • At most 255 characters each and at most 20 origins. Blank entries are ignored, and origins are lower-cased and de-duplicated.

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

originsarray of strings

The full list of allowed browser origins. Replaces the current list. An empty array or omitted field clears it.

Response

200

The allowed origins were updated. Returns the bucket with the normalised cors_origins.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
uidstringRequired

Unique identifier of the bucket.

namestringRequired

Display name of the bucket.

slugstringRequired

URL-safe version of the name. Unique within the workspace.

statusstringRequired

Lifecycle state. Uploads, access keys and CORS changes need ready.

One ofprovisioningreadyfaileddeletingdeleted

visibilitystringRequired

public objects are served from their public URL. private objects need a signed read URL.

One ofpublicprivate

public_base_urlstringRequired

Base URL recorded for the bucket on the public assets host. Use each object's public_url or read_url to fetch objects, rather than building URLs from this value.

s3_bucket_namestringRequired

Name of the underlying S3 bucket. Use it as the bucket name with S3 clients.

key_prefixstring

Key prefix under which uploads made through the API are stored. Omitted when it cannot be derived.

storage_used_bytesinteger

Total size of the bucket's ready objects, in bytes. Omitted when zero.

free_storage_bytesinteger

Your account's free file storage allowance in bytes. Omitted on some responses (for example after updating allowed origins or deleting).

max_image_size_bytesinteger

Maximum size of a single upload, in bytes. Despite the name it applies to every file type. Omitted on some responses.

created_atstring (date-time)Required

When the bucket was created.

last_failurestring

Why the last create or delete failed. Omitted when there was no failure.

cors_originsarray of stringsRequired

Browser origins allowed to make cross-origin requests. The console's own origin is always allowed and is not listed. Set with Set bucket allowed origins.

Errors

StatusMeaning
400An origin is invalid, or there are more than 20. Possible messages include "<origin>" needs https:// (or http://) at the start, "<origin>" must start with https:// or http://, "<origin>" should be just the scheme, host and port, e.g. https://app.example.com, "<origin>" can only use * at the start of the host, e.g. https://*.example.com, "<origin>" is too long, "<origin>" is not a valid origin, e.g. https://app.example.com, a bucket can have at most 20 allowed origins and invalid request (malformed JSON).
401The API key is missing, invalid, expired or revoked.
403You cannot access the workspace, your role does not allow this action, or the account is suspended.
404The bucket does not exist in this workspace.
409The bucket is not ready yet.

Errors use the standard error format.