s3.bucket-objects.delete-prefixDelete everything under a folder; with prefix "" and allVersions, empty the bucket
allVersions: true needs s3:DeleteObjectVersion and deletes every version and delete marker for good. Each call works ~20 seconds and answers { deleted, failed, errors, done, cursor }; while done is false, call again with cursor. A key your policies keep is reported in errors and stays.
Request syntax
POST /s3/api/buckets/{name}/objects/delete-prefix
{
"prefix": "string",
"allVersions": "boolean",
"cursor": "object"
}Path parameters
nameRequiredstring
Constraints: 3-63 chars, /^[a-z0-9][a-z0-9-]*[a-z0-9]$/
Request body
prefixRequiredstring
A folder ending in /; "" is the whole bucket
Constraints: max 1024 chars
allVersionsRequiredboolean
true: every version and delete marker, for good (Empty bucket). false: the current objects, as Delete does (a versioned bucket keeps them as old versions)
cursorOptionalobject
From the previous answer, when it said done: false
Constraints: JSON
Response
200; data is { deleted, failed, errors: [{ key, versionId?, message }], done, cursor }: what this call deleted and refused; while done is false, pass cursor back.
A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.
Errors
- 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
- 401No credentials, or an access key that is unknown, revoked or expired.
- 403The caller's policies do not allow s3:DeleteObject on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
- 404The resource does not exist in your organization.
Examples
The required parameters only, with example values. Replace id and the other placeholders with your own.
dcloud s3 bucket-objects delete-prefix name --prefix example --all-versionscurl -X POST "https://console.platform-development.deutschecloud.app/s3/api/buckets/name/objects/delete-prefix" \
-H "Authorization: EWS-ACCESS-KEY $ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{"prefix":"example","allVersions":true}'Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_s3_bucket-objects_delete-prefix.