# DeleteBucketTagging

DeleteBucketTagging removes the tag set from a bucket. Buckets on STRG carry no tags, so
there is never a tag set to remove: the operation checks that the bucket exists and answers
`204 No Content`, leaving the bucket exactly as it was. That keeps tools which clear bucket
tags as part of managing a bucket - Terraform's `aws_s3_bucket` resource, for example -
working without any changes.

**Info: Good to know on STRG**

- Buckets have no tags, so DeleteBucketTagging always succeeds and changes nothing.
- PutBucketTagging is answered with `501 NotImplemented`, so a client knows straight away, and
  [GetBucketTagging](https://docs.strg.com/s3-api/GetBucketTagging) always answers `404 NoSuchTagSet` - the same
  answer Amazon S3 gives for a bucket without tags.
- `x-amz-expected-bucket-owner` is welcome and has nothing to check: a key only ever reaches
  buckets of its own account.

## When you'd use it

- **Infrastructure as code.** Terraform's `aws_s3_bucket` resource, and similar tools that
  bring a bucket in line with a configuration, clear the bucket's tags along the way. On
  STRG that request succeeds, so a plan applies cleanly.
- **Scripts written for Amazon S3.** A provisioning or clean-up script that removes a bucket's
  tags before moving on keeps running unchanged against STRG.

## Request

```http
DELETE /?tagging HTTP/1.1
Host: my-bucket.s3.eu-central-1.strg.com
Authorization: AWS4-HMAC-SHA256 Credential=...
x-amz-date: 20260926T120000Z
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
```

The path-style form is `DELETE /my-bucket?tagging` on `s3.eu-central-1.strg.com` -
[Addressing](https://docs.strg.com/s3-api/overview#addressing) explains both.

### Permissions

The access key needs **Manage buckets** (`buckets:write`), a permission held by keys for all
buckets. [Access keys](https://docs.strg.com/access-keys#buckets) has the details.

### URI parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Bucket` | String | Yes | The bucket whose tag set to remove. |
| `tagging` | Flag | Yes | Selects this operation. Sent with no value. |

### Request headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-amz-expected-bucket-owner` | String | No | Welcome, with nothing to check: an access key only ever reaches its own account's buckets. |

### Request body

None.

## Response

A successful request answers `204 No Content` with no body.

### Response headers

| Name | Description |
| --- | --- |
| `x-amz-request-id` | The request ID, handy for a support request. |

### Response body

None.

## Errors

These are the errors this request can return, and the situation behind each one.

| Code | HTTP status | When |
| --- | --- | --- |
| `NoSuchBucket` | 404 | The bucket does not exist, it is in a region other than the endpoint's, or the account has no storage in this endpoint's region. |
| `AccessDenied` | 403 | The access key lacks **Manage buckets**. |
| `InvalidAccessKeyId` | 403 | The access key does not exist, has expired or been revoked - or it was created moments ago and is not usable in this endpoint's region yet, in which case the same request works shortly afterwards. |
| `SignatureDoesNotMatch` | 403 | The request signature does not match. |
| `RequestTimeTooSkewed` | 403 | The request time is more than 15 minutes from the server's. |
| `AuthorizationHeaderMalformed` | 400 | The signature's credential scope names a region other than the endpoint's. |
| `SlowDown` | 503 | Too many requests. The `Retry-After` header says when a retry is welcome; the AWS SDKs retry on their own. |
| `ServiceUnavailable` | 503 | A temporary failure; the same request can be retried. |
| `InternalError` | 500 | An unexpected failure while checking the bucket; the same request can be retried. |

## Differences from Amazon S3

The table lists each place where STRG behaves differently, and what that means for a client.

| Aspect | Amazon S3 | STRG |
| --- | --- | --- |
| Bucket tags | Stored, and removed by this operation | Buckets have no tags; this operation succeeds and changes nothing |
| Bucket in another region | `301` redirect with `x-amz-bucket-region` | `404 NoSuchBucket`. A bucket is reached through its own regional endpoint. |
| `x-amz-expected-bucket-owner` | Checked against the bucket owner | Welcome, with nothing to check |
| Attribute-based access control (ABAC) | Blocks this operation on a bucket that has it enabled | Not part of STRG, so it never stands in the way of this operation |

## Examples

Clearing the tags of `my-bucket` in `eu-central-1`:

**AWS CLI**

```bash
aws s3api delete-bucket-tagging \
  --bucket my-bucket \
  --endpoint-url https://s3.eu-central-1.strg.com \
  --region eu-central-1
```

**Python (boto3)**

```python
import boto3

s3 = boto3.client(
    "s3",
    endpoint_url="https://s3.eu-central-1.strg.com",
    region_name="eu-central-1",
)

s3.delete_bucket_tagging(Bucket="my-bucket")
```

**JavaScript (AWS SDK v3)**

```javascript
import { DeleteBucketTaggingCommand, S3Client } from "@aws-sdk/client-s3";

const client = new S3Client({
  endpoint: "https://s3.eu-central-1.strg.com",
  region: "eu-central-1",
});

await client.send(new DeleteBucketTaggingCommand({ Bucket: "my-bucket" }));
```

## Related

- [GetBucketTagging](https://docs.strg.com/s3-api/GetBucketTagging)
- [DeleteObjectTagging](https://docs.strg.com/s3-api/DeleteObjectTagging)
- [GetObjectTagging](https://docs.strg.com/s3-api/GetObjectTagging)
- [Access keys](https://docs.strg.com/access-keys)
- [S3 API overview](https://docs.strg.com/s3-api/overview) - including the [other S3 operations](https://docs.strg.com/s3-api/overview#other-s3-operations)
