---
title: Set object retention
description: Protects one version until retainUntil.
doc_version: 0.1.0-preview
last_updated: 2026-09-14
---

# Set object retention

`PUT /v1/workspaces/{workspaceId}/buckets/{bucketId}/objects/{keyToken}/retention`

Protects one version until retainUntil. Nobody can delete the version or shorten the date before then. A date that is not in the future, or that is before the current retention, fails. Role: editor or higher.

## Authentication

Send `Authorization: Bearer <GRAPHON_API_KEY>`. Read the key from the
GRAPHON_API_KEY environment variable. Never print it.

## Path parameters

- `workspaceId` (string) — The workspace id.
- `bucketId` (string) — The bucket id.
- `keyToken` (string) — The object key, base64url-encoded without padding.

## Request body

- `versionId` (string) — The version to protect.
- `retainUntil` (string) — When the protection ends, in UTC, such as 2027-01-01T00:00:00Z. It is in the future, and not before the current retention.

## Example request

```bash
curl --request PUT \
  --url "https://storage.graphon.sh/v1/workspaces/wspq7ws2np5l8z4/buckets/bktA1b2C3d4E5/objects/aW5jaWRlbnRzL2NoZWNrb3V0LXRpbWVvdXQuanNvbg/retention" \
  --header "Authorization: Bearer $GRAPHON_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"versionId":"ver_3f9c2a7d1e4b4c8a9f0d6b2e5a1c7d3f","retainUntil":"2027-01-01T00:00:00Z"}'
```

## CLI

```bash
graphon objects retain support-tickets incidents/checkout-timeout.json --version-id <versionId> --retain-until 2027-01-01T00:00:00Z
```

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
