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 workspace.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
Responses
Section titled “Responses”What was purged, per domain.
object
Example
{ "perDomain": [ { "domain": "org", "limitApplied": true, "missingAdapter": true } ], "conflicts": [ { "domain": "org" } ]}Unknown domain, or maxPerDomain outside 1..10000.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Not a tenant admin. Without an authorization store, key-project-mismatch (details.keyProjectId): the API key or session is limited to a project, and this writes above it, to the workspace, an org or a team (with a store, that is permission-denied).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Idempotency-Key was reused with a different body, or resource-state conflict.
object
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
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}rate-limit-exceeded with details.limit: "api-requests", on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; Retry-After says when to send it again.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Server error (unmapped domain code or framework crash).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The authorization store couldn’t be reached (authz-backend-unavailable), or the database was too busy for the authorization check (database-busy), so the request wasn’t run; Retry-After (whole seconds) says when to try again.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”See also
POST /v1/retention/sweep/{domain}: Purge one domain's deleted rows past their grace- Keep and purge deleted data
- Error code
authz-backend-unavailable - Error code
database-busy - Error code
key-project-mismatch - Error code
permission-denied - Error code
rate-limit-exceeded - Error code
request-too-large - Every error code