---
title: "Set the retention policy (org admins; a partial body patches)"
method: PATCH
path: "/preview/retention"
tags: ["retention"]
---

# Set the retention policy (org admins; a partial body patches)

`PATCH /preview/retention`

## Request

- Base URL: `https://autoresearch.sfcompute.com`
- URL: `https://autoresearch.sfcompute.com/preview/retention`
- Auth: HTTP bearer

Set what Autoresearch retains about this organization's workloads (org admins only, audited). A PARTIAL call PATCHES: a field you omit keeps its current value, so turning one capture off never silently re-enables another. Pass `zero: true` for zero data retention - every optional capture off in one call. The switches are `command_output`, `command_history`, `declared_results`, `logs`, `traces` and `job_objects_at_end`; `command_content_days` (1-365) is how long output and command lines survive; `snapshot_default_days` (1-365, 0 clears) stamps an expiry on NEW snapshots. Turning a capture off stops it immediately AND PURGES what it already holds (an hourly sweep drains history), and turning one back ON RECOVERS NOTHING - new content was never written and old content is gone. Each switch costs a product surface (get_command's output, mission receipts, query_logs, the Commands tab); call get_retention first and tell the human what they lose before you call this.

## Query parameters

- `workspace` string

## Request body

- object
  - `command_content_days` integer, nullable: How many days command output and command lines survive before the sweep nulls them, 1-365. Applies to every org; the default is 90.
  - `command_history` boolean, nullable: Keep the command line itself. Off empties the mission Commands tab and leaves support unable to see what an agent ran.
  - `command_output` boolean, nullable: Keep the last 8 KiB of a command's output after it exits. Off means get_command returns no output once the command ends.
  - `declared_results` boolean, nullable: Keep the result an agent declares with finish_mission or a command's declared result. Off means mission receipts carry no answer - the largest product loss of the six.
  - `job_objects_at_end` boolean, nullable: Delete a job's own log, artifact, preview and sample objects when the job reaches a terminal state, instead of keeping them 30 days. Uploaded contexts are never purged this way - they are shared across jobs and have their own delete_context door.
  - `logs` boolean, nullable: Ship command logs to the log store. Off means query_logs and the mission Logs tab return nothing, and log ingest stops billing. Logs still stream to the node's own encrypted volume.
  - `logs_retention_days` integer, nullable: How many days the logs plane keeps this org's logs, 1-365 (0 returns it to the platform window of 31 days). Bounded by the org's `logs_retention_days` limit. Unlike the capture switches this is not immediate: the plane applies it on its next compaction, and shortening it deletes logs already stored.
  - `org` string, nullable: Organization: an org uuid or an org name from list_team's memberships; omitted = your active org.
  - `snapshot_default_days` integer, nullable: An expiry stamped on NEW node and sandbox snapshots, 1-365 days. 0 clears it. An expiry named per snapshot always wins, and existing snapshots keep the expiry they were created with.
  - `traces` boolean, nullable: Accept OTLP spans from your workloads. Off means search_traces and get_trace return nothing for your own spans; platform lifecycle spans are unaffected.
  - `traces_retention_days` integer, nullable: The same for traces, whose platform window is 14 days.
  - `zero` boolean, nullable: Turn every optional capture off in one call - zero data retention. Applied first, so a field you also pass still wins.

## Response `200`

The capability's JSON result.

- Result: The capability's result: the same object the MCP tool returns as structuredContent. Resources carry an `object` type discriminator and an immutable id; money is integer micro-dollars in `*_usd_micros` fields.
  - `object` string: The resource type, when the result is one resource.

## Other responses

- `400`: Malformed request: bad JSON, a parameter that does not parse, or a value outside its range. Code `invalid`.
- `401`: No bearer token, or one this API cannot verify. Code `unauthenticated`.
- `403`: Authenticated, but the token's scopes or the account's role do not reach this operation. The message names the scope word to request. Code `forbidden`.
- `404`: No such route. Code `not_found`; the body names the OpenAPI document.
- `422`: A well-formed request the platform declined: no such node, a cap reached, a state that forbids the move. The message says which, and what to do instead. Code `refused`.
- `429`: Over this door's per-customer budget. Wait `Retry-After` seconds. Code `rate_limited`.
- `500`: Our fault. Retry; if it persists, quote the request-id. Code `internal`.

---

[API](https://skmtc.dev/givemeanode/apis/autoresearch-customer-api.md) · [All operations](https://skmtc.dev/givemeanode/apis/autoresearch-customer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/givemeanode/apis/autoresearch-customer-api/revisions/f88dcb70ac6c?raw)
