/v1/asset-bucketsQueues a new bucket and returns 202 Accepted with the operation_id of the create
operation. The bucket starts in provisioning and moves to ready (or failed) when the
operation finishes. Poll Get an operation or
List buckets to see when it is ready. Uploads, access keys
and CORS changes are only accepted once the bucket is ready.
Things to know:
- Bucket names must be unique in the workspace. Uniqueness is checked on the slug of the
name, so
Marketing Assetsandmarketing-assetsclash. visibilitydefaults topublic. It cannot be changed after creation.- The underlying S3 bucket name (
s3_bucket_name) is generated for you from the workspace slug and the bucket's ID. - Send
X-Idempotencyto make retries safe. Repeating a create with the same key returns the original operation with200 OKandis_replay: true, and no second bucket is created. The key is checked first, before the past-due check and validation. Reusing it for a different action returns409withaction: idempotency_key_reused. - Past-due or suspended accounts cannot create buckets (
402,action: past_due).
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.
Headers
X-Workspace-SlugstringRequiredSlug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.
X-IdempotencystringOptional key that makes retries safe. Repeating a request with a key already used for
the same action returns the original operation with 200 OK and is_replay: true
instead of queuing it again. Reusing it for a different action or bucket returns 409
with action: idempotency_key_reused.
Request body
namestringRequiredDisplay name of the bucket. Leading and trailing spaces are trimmed. Its slug must be unique among the workspace's buckets.
visibilitystringpublic serves objects from a public URL. private requires a signed URL to read objects. Case-insensitive.
Default publicOne ofpublicprivate
Response
The create operation was queued.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredID of the queued operation. Pass it to Get an operation.
bucketobjectRequiredShow attributesHide attributes
uidstringRequiredUnique identifier of the bucket.
namestringRequiredDisplay name of the bucket.
slugstringRequiredURL-safe version of the name. Unique within the workspace.
statusstringRequiredLifecycle state. Uploads, access keys and CORS changes need ready.
One ofprovisioningreadyfaileddeletingdeleted
visibilitystringRequiredpublic objects are served from their public URL. private objects need a signed read URL.
One ofpublicprivate
public_base_urlstringRequiredBase 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_namestringRequiredName of the underlying S3 bucket. Use it as the bucket name with S3 clients.
key_prefixstringKey prefix under which uploads made through the API are stored. Omitted when it cannot be derived.
storage_used_bytesintegerTotal size of the bucket's ready objects, in bytes. Omitted when zero.
free_storage_bytesintegerYour account's free file storage allowance in bytes. Omitted on some responses (for example after updating allowed origins or deleting).
max_image_size_bytesintegerMaximum size of a single upload, in bytes. Despite the name it applies to every file type. Omitted on some responses.
created_atstring (date-time)RequiredWhen the bucket was created.
last_failurestringWhy the last create or delete failed. Omitted when there was no failure.
cors_originsarray of stringsRequiredBrowser 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.
statusstringRequiredStatus of the operation. queued for a new request; the original operation's current status on a replay.
One ofqueuedrunningsucceededfailed
events_urlstringRequiredPath of the operation's progress event stream.
is_replaybooleanRequiredtrue when an X-Idempotency key was reused and the original operation is returned instead of a new one.
is_completedbooleantrue when a replayed operation has already finished. Omitted unless true.
Response
Replay. The X-Idempotency key was already used for this action, so the original
operation is returned and nothing is queued. status is the operation's current status.
bucket is the bucket's current state, or only uid, slug and status: deleted once
it is gone.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredID of the queued operation. Pass it to Get an operation.
bucketobjectRequiredShow attributesHide attributes
uidstringRequiredUnique identifier of the bucket.
namestringRequiredDisplay name of the bucket.
slugstringRequiredURL-safe version of the name. Unique within the workspace.
statusstringRequiredLifecycle state. Uploads, access keys and CORS changes need ready.
One ofprovisioningreadyfaileddeletingdeleted
visibilitystringRequiredpublic objects are served from their public URL. private objects need a signed read URL.
One ofpublicprivate
public_base_urlstringRequiredBase 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_namestringRequiredName of the underlying S3 bucket. Use it as the bucket name with S3 clients.
key_prefixstringKey prefix under which uploads made through the API are stored. Omitted when it cannot be derived.
storage_used_bytesintegerTotal size of the bucket's ready objects, in bytes. Omitted when zero.
free_storage_bytesintegerYour account's free file storage allowance in bytes. Omitted on some responses (for example after updating allowed origins or deleting).
max_image_size_bytesintegerMaximum size of a single upload, in bytes. Despite the name it applies to every file type. Omitted on some responses.
created_atstring (date-time)RequiredWhen the bucket was created.
last_failurestringWhy the last create or delete failed. Omitted when there was no failure.
cors_originsarray of stringsRequiredBrowser 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.
statusstringRequiredStatus of the operation. queued for a new request; the original operation's current status on a replay.
One ofqueuedrunningsucceededfailed
events_urlstringRequiredPath of the operation's progress event stream.
is_replaybooleanRequiredtrue when an X-Idempotency key was reused and the original operation is returned instead of a new one.
is_completedbooleantrue when a replayed operation has already finished. Omitted unless true.
Errors
| Status | Meaning |
|---|---|
400 | Validation failed. Possible messages: invalid request (malformed JSON or missing name), name is required (blank after trimming), visibility must be public or private. |
401 | The API key is missing, invalid, expired or revoked. |
402 | The account is past due, so new paid resources cannot be created. |
403 | You cannot access the workspace, your role does not allow this action, or the account is suspended. |
409 | A bucket with the same name (slug) already exists in this workspace, or the X-Idempotency key was already used for a different action (action: idempotency_key_reused). |
Errors use the standard error format.