Skip to main content
POST
Confirm your deployment before running this request. This page describes an API contract; a published reference does not establish hosted availability. Check the dated host report and obtain your deployment URL and credentials. Replace the example host if your provisioned service uses a different URL.
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. Minimum: 7. Maximum: 3650.
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. Default: true.
integer
Hard cap on rows touched in this call. Lets ops chunk large purges. Default 1000. Default: 1000. Minimum: 1. Maximum: 50000.

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

Using this contract

Read the source OpenAPI document for declared schemas and alternatives. This page also includes documented corrections from the spec overlays. Example IDs and values are illustrative; replace them with records from your workspace.
Last modified on September 21, 2026