Purge the deleted rows past their grace
const url = 'https://example.com/v1/retention/sweep';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"domain":"org","maxPerDomain":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/retention/sweep \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "domain": "org", "maxPerDomain": 1 }'Purges, for good, every tombstoned row past its grace (or only domain’s): the grace of the retention policy that covers its domain, or this server’s limit for the domain when no policy covers it or the policy keeps rows longer (limitApplied), up to maxPerDomain per domain; remaining counts what is left for the next call. Nothing sweeps on its own: call this (or POST /v1/retention/sweep/{domain}) from a schedule. A hold (graceSeconds: -1) keeps its domain’s rows, unless the domain has a limit. Idempotent: a second call purges nothing new. Requires admin on the tenant.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
Sweep only this domain. Absent: every domain.
The most rows one call purges per domain (default 500); the rest are remaining.
Responses
Section titled “Responses”What was purged, per domain.
object
object
The kind of record a retention policy covers. * covers every domain without a policy of its own, except memory and conversation: they hold people’s words, so only a policy naming them purges them.
Rows past grace this call left (the maxPerDomain cap); sweep again.
The retention policy that applied.
Present when this server’s retention limit set the grace (see RetentionScheduledItem.limitApplied).
Present when this deployment can’t purge the domain (no adapter).
Domains more than one retention policy covers. Absent or empty: none.
object
The kind of record a retention policy covers. * covers every domain without a policy of its own, except memory and conversation: they hold people’s words, so only a policy naming them purges them.
Every policy id that covers the domain, sorted.
The one that applies: the policy whose latest version is highest, and on equal versions the lower policy id. Unregister the others.
Example
{ "perDomain": [ { "domain": "org", "limitApplied": true, "missingAdapter": true } ], "conflicts": [ { "domain": "org" } ]}Unknown domain, or maxPerDomain outside 1..10000.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Not a tenant admin.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Idempotency-Key was reused with a different body, or resource-state conflict.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Server error (unmapped domain code or framework crash).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}