# DeleteObjectTagging

DeleteObjectTagging removes the tag set from an object. Objects 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 object exactly as it was. That keeps tools which clear object
tags as part of their normal flow working without any changes, and it matches
[GetObjectTagging](https://docs.strg.com/s3-api/GetObjectTagging), which always answers with an empty tag set.

**Info: Good to know on STRG**

- Objects have no tags, so DeleteObjectTagging always succeeds and changes nothing.
- The object itself is not looked up: the answer is `204` whether or not the key or version
  exists.
- `versionId` is welcome and has nothing to act on, and the response carries no
  `x-amz-version-id`.
- PutObjectTagging is answered with `501 NotImplemented`, so a client knows straight away, and
  so is `x-amz-tagging` on an upload or a copy.
- `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

- **Scripts written for Amazon S3.** A clean-up or publishing script that clears an object's
  tags before moving on keeps running unchanged against STRG.
- **Tools that manage objects as a whole.** Backup, sync and infrastructure-as-code tools that
  bring an object in line with a description of it - content, metadata and tags - may clear its
  tags along the way. On STRG that request succeeds, so the run carries on.

## Request

```http
DELETE /photos/2024/cat.jpg?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/photos/2024/cat.jpg?tagging` on
`s3.eu-central-1.strg.com` - [Addressing](https://docs.strg.com/s3-api/overview#addressing) explains both.

### Permissions

The access key needs **Write objects** (`objects:write`). For a key limited to certain buckets
or to an object prefix, the bucket and the object key need to fall within them.
[Access keys](https://docs.strg.com/access-keys#objects) has the details.

### URI parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Bucket` | String | Yes | The bucket containing the object. |
| `Key` | String | Yes | The object key. |
| `tagging` | Flag | Yes | Selects this operation. Sent with no value. |
| `versionId` | String | No | Welcome, with nothing to act on: no version has tags to remove. |

Any other query parameter is answered with `501 NotImplemented`.

### 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-version-id` | Not returned, as no version's tags change. |
| `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 **Write objects**, the bucket or key is outside the key's buckets or object prefix, or a presigned URL has expired. |
| `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. |
| `NotImplemented` | 501 | The request carries a query parameter this operation does not use. |
| `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 |
| --- | --- | --- |
| Object tags | Stored, and removed by this operation | Objects have no tags; this operation succeeds and changes nothing |
| A key or version that does not exist | An error | `204 No Content` - the object is not looked up |
| `versionId` | Removes that version's tags | Welcome, with nothing to act on |
| `x-amz-version-id` in the response | The version whose tags were removed | Not returned |
| 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 |

## Examples

**AWS CLI**

```bash
aws s3api delete-object-tagging \
  --bucket my-bucket \
  --key photos/2024/cat.jpg \
  --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_object_tagging(Bucket="my-bucket", Key="photos/2024/cat.jpg")
```

**JavaScript (AWS SDK v3)**

```javascript
import { DeleteObjectTaggingCommand, 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 DeleteObjectTaggingCommand({ Bucket: "my-bucket", Key: "photos/2024/cat.jpg" }),
);
```

## Related

- [GetObjectTagging](https://docs.strg.com/s3-api/GetObjectTagging)
- [DeleteBucketTagging](https://docs.strg.com/s3-api/DeleteBucketTagging)
- [PutObject](https://docs.strg.com/s3-api/PutObject)
- [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)
