Skip to main content
POST
Tenant-managed retention. Permanently removes terminal-status jobs older than older_than_days (with their associated UsageRecord and ToolExecution rows via cascade). Default mode is dry_run=true so callers can confirm the count before flipping to a destructive call. Live jobs (queued / running / awaiting_approval) are never deleted, even if their status appears in the request — this is a deliberate guardrail against trigger-and-forget tooling.

Request body

CleanupJobsRequest
integer
required
Delete jobs whose created_at is older than this many days. Minimum 7 days to prevent accidents — deletion is permanent and cascades to UsageRecord and ToolExecution rows.
string[]
Only delete jobs in one of these terminal statuses. Live jobs (queued, running, awaiting_approval) are never touched, even if you list them here.
boolean
When true (default), counts what would be deleted without deleting anything. Always start here, then re-call with dry_run=false once the count looks right.
integer
Hard cap on rows touched in this call. Lets ops chunk large purges. Default 1000.

Response

CleanupJobsResponse
boolean
required
integer
required
Jobs that match the criteria.
integer
required
Rows actually removed (0 when dry_run=true).
string
required
Computed created_at cutoff, ISO 8601.

Status codes