Skip to content

Delete a bucket

DELETE/v1/asset-buckets/{uid}

Queues deletion of the bucket and returns 202 Accepted with the operation_id of the delete operation. The bucket moves to deleting straight away. Poll Get an operation to follow it.

When the operation succeeds, every object in the bucket is deleted and all of the bucket's access keys are revoked. This cannot be undone. If deletion fails, the bucket's status becomes failed and last_failure explains why.

Send X-Idempotency to make retries safe. The key is checked before the bucket's state, so repeating a delete with the same key returns the original operation with 200 OK and is_replay: true instead of 409 or 404. Reusing it for a different action or bucket returns 409 with action: idempotency_key_reused.

The returned bucket omits free_storage_bytes and max_image_size_bytes.

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.

X-Idempotencystring

Optional 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.

Response

202

The delete operation was queued.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

ID of the queued operation. Pass it to Get an operation.

bucketobjectRequired
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.

statusstringRequired

Status of the operation. queued for a new request; the original operation's current status on a replay.

One ofqueuedrunningsucceededfailed

events_urlstringRequired

Path of the operation's progress event stream.

is_replaybooleanRequired

true when an X-Idempotency key was reused and the original operation is returned instead of a new one.

is_completedboolean

true when a replayed operation has already finished. Omitted unless true.

Response

200

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.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

ID of the queued operation. Pass it to Get an operation.

bucketobjectRequired
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.

statusstringRequired

Status of the operation. queued for a new request; the original operation's current status on a replay.

One ofqueuedrunningsucceededfailed

events_urlstringRequired

Path of the operation's progress event stream.

is_replaybooleanRequired

true when an X-Idempotency key was reused and the original operation is returned instead of a new one.

is_completedboolean

true when a replayed operation has already finished. Omitted unless true.

Errors

StatusMeaning
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 or was already deleted.
409The bucket is already being deleted, or the X-Idempotency key was already used for a different action or bucket (action: idempotency_key_reused).

Errors use the standard error format.