curl --silent --show-error --fail-with-body --request POST \
--url 'https://api.computer.stateset.app/api/v1/jobs/cleanup' \
--header "X-API-Key: $STATESET_COMPUTER_USE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"older_than_days": 7,
"statuses": [
"string"
],
"dry_run": true,
"max_delete": 1000
}'
{
"dry_run": false,
"matched": 1,
"deleted": 1,
"cutoff_at": "2026-08-31T14:22:05Z"
}
Cleanup Jobs V1
Tenant-managed retention. Permanently removes terminal-status jobs older than older_than_days (with their associated UsageRecord and ToolExecution rows via…
POST
/
api
/
v1
/
jobs
/
cleanup
curl --silent --show-error --fail-with-body --request POST \
--url 'https://api.computer.stateset.app/api/v1/jobs/cleanup' \
--header "X-API-Key: $STATESET_COMPUTER_USE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"older_than_days": 7,
"statuses": [
"string"
],
"dry_run": true,
"max_delete": 1000
}'
{
"dry_run": false,
"matched": 1,
"deleted": 1,
"cutoff_at": "2026-08-31T14:22:05Z"
}
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.
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
| Code | Meaning |
|---|---|
200 | Successful Response |
422 | Validation Error |
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.curl --silent --show-error --fail-with-body --request POST \
--url 'https://api.computer.stateset.app/api/v1/jobs/cleanup' \
--header "X-API-Key: $STATESET_COMPUTER_USE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"older_than_days": 7,
"statuses": [
"string"
],
"dry_run": true,
"max_delete": 1000
}'
{
"dry_run": false,
"matched": 1,
"deleted": 1,
"cutoff_at": "2026-08-31T14:22:05Z"
}
Last modified on September 21, 2026