# Annotations

> The annotation API and its policy actions.

---

LLMS index: [llms.txt](/llms.txt)

---

> [!NOTE]
> The object annotation protocol is a **Preview** extension in the MVP release. Policy evaluation for the four `s3:*ObjectAnnotation` actions depends on the unpublished `silo-pkg` revision (`27697e8`) compiled into the `pgsilo` branch.

An object annotation is a named UTF-8 text payload attached to a specific parent object version—such as OCR text, classification labels, or review notes. Introduced in schema 13 and retained in schema 14, annotations are stored separately from S3 user metadata (`x-amz-meta-*`) and object tags. Updating an annotation neither rewrites the parent object body nor creates a new parent version.

## HTTP requests and permissions {#requests-and-permissions}

Target the parent object key and sign the full path, query string, and headers with AWS SigV4:

| Operation | HTTP request | Required IAM action | Additional bucket privilege (`iam_and_pg`) |
| --- | --- | --- | --- |
| Write or replace | `PUT /{bucket}/{key}?annotation=&annotationName=labels.json` | `s3:PutObjectAnnotation` | `INSERT` |
| Read payload | `GET /{bucket}/{key}?annotation=&annotationName=labels.json` | `s3:GetObjectAnnotation` | `SELECT` |
| List names | `GET /{bucket}/{key}?annotation=` | `s3:ListObjectAnnotations` | `SELECT` |
| Delete | `DELETE /{bucket}/{key}?annotation=&annotationName=labels.json` | `s3:DeleteObjectAnnotation` | `DELETE` |
{.wide}

- Standard `s3:GetObject` and `s3:PutObject` permissions do **not** grant annotation access. IAM policy resources reference the parent object ARN (`arn:aws:s3:::bucket/key` or prefix).
- The `annotation` query parameter must appear once with an empty value. `PUT` and `DELETE` require a non-empty `annotationName`. `GET` without `annotationName` lists all annotations on the selected parent version; `GET` with `annotationName` returns that annotation's body. There is no annotation `HEAD` endpoint.
- Successful `PUT` returns HTTP `200`, `DELETE` returns HTTP `204`, and `GET` returns `Content-Type: text/plain; charset=utf-8` along with the annotation's own `ETag`, `Last-Modified`, and parent `x-amz-version-id`.

## Size and naming bounds {#bounds}

| Property | Limit |
| --- | --- |
| Annotations per parent object version | `1000` |
| Plaintext payload size | `1` byte – `1 MiB` |
| Annotation name (`annotationName`) | `1` – `512` UTF-8 bytes (no XML-invalid control characters) |
| Payload encoding | Valid UTF-8 |
{.wide}

Annotation names are treated as flat identifiers rather than filesystem paths. Annotation bytes count toward the bucket's hard logical quota.

A list request (`GET /{bucket}/{key}?annotation=`) returns up to 1000 entries in a single response without pagination parameters:

```xml
<ListObjectAnnotationsOutput>
  <Annotation>
    <AnnotationName>labels.json</AnnotationName>
    <Size>18</Size>
    <ETag>"ANNOTATION_ETAG"</ETag>
    <LastModified>2026-10-08T00:00:00Z</LastModified>
  </Annotation>
</ListObjectAnnotationsOutput>
```

## Parent version selection and conditional writes {#parent-selection}

Pass `versionId` to target a specific historical parent version; omitting `versionId` targets the current visible object (excluding delete markers).

`PUT` and `DELETE` accept `x-amz-object-if-match: "<PARENT_ETAG>"` to verify the parent object's ETag atomically (requires `SELECT` under `iam_and_pg` mode). Note that `x-amz-object-if-match` checks the **parent object body's** ETag, not the previous annotation's ETag.

```http
PUT /attachments/invoices/1001.txt?annotation=&annotationName=labels.json HTTP/1.1
Host: s3.example.net
x-amz-object-if-match: "PARENT_OBJECT_ETAG"
Content-Type: text/plain; charset=utf-8
Authorization: AWS4-HMAC-SHA256 ...

{"reviewed":true}
```

For runnable Python signing examples, see [Annotations & ZIP Extraction](/docs/s3/tutorial/annotations-zip/).

## Lifecycle, copying, and encryption {#lifecycle-copy-encryption}

- **Independent mutability**: annotations have no version history of their own. Updating an annotation leaves the parent object's body, ETag, modification time, tags, Object Lock retention, and legal hold untouched. Parent Object Lock does **not** make annotations immutable.
- **Unlinking and cleanup**: overwriting an unversioned object discards its previous annotation set; deleting a specific parent version unlinks only that version's annotations. Unlinking releases logical bucket quota immediately, while a writable gateway's background maintenance worker deletes the unlinked physical rows in batches.
- **Copy directives**: S3 `CopyObject` accepts `x-amz-annotation-directive: COPY` (default) or `EXCLUDE`. Copying a non-empty annotation set requires `s3:GetObjectAnnotation` on the source and `s3:PutObjectAnnotation` on the destination. SQL `silo_api.copy_object` always copies plaintext annotations atomically and has no `EXCLUDE` option.
- **Encryption**: annotations inherit the parent version's SSE-C or static SSE-S3 protection and require the matching key on `PUT` and `GET`. Public SQL functions have no annotation CRUD endpoints and reject copying objects with encrypted annotations.

## Error responses {#errors}

| Error or status | Meaning |
| --- | --- |
| `InvalidArgument` (HTTP 400) | Malformed query parameters, invalid UTF-8 name/body, or unsupported headers |
| `TooManyAnnotations` (HTTP 400) | Parent version already has 1000 annotations |
| `NoSuchAnnotation` (HTTP 404) | Requested `annotationName` does not exist on the selected parent version |
| `AccessDenied` (HTTP 403) | Missing `s3:*ObjectAnnotation` action, parent policy denial, or missing native bucket privilege |
| `PreconditionFailed` (HTTP 412) | `x-amz-object-if-match` does not match the parent version's ETag |
{.wide}

---

Backlinks:

- [Reference](/docs/s3/reference/)
- [Annotations and ZIP](/docs/s3/tutorial/annotations-zip/)
