GoodMemGoodMem
ReferenceAPIREST APIAdmin

Purge completed background jobs

POST /v1/admin/background-jobs:purge: Deletes terminal background jobs older than a retention cutoff.

POST
/v1/admin/background-jobs:purge

Deletes terminal background jobs older than a retention cutoff.

Authorization

ApiKeyAuth
headerx-api-key<token>

Header Parameters

GoodMem-Timeout-Ms?integer

Optional waiting budget in milliseconds, measured from REST servlet ingress and shared across all internal gRPC calls. Supply one decimal integer from 1 to 86400000. Omission adds no deadline. Existing shorter deadlines still apply. Expiry returns HTTP 504 before streaming starts; after streaming starts, no successful completion event is sent. Use SSE or opt into GoodMem-Stream-Terminal for an explicit terminal outcome. Retrieval work is cooperatively cancelled. An accepted mutation may still commit after timeout or disconnect; a failed response does not imply rollback.

Formatint64
Range1 <= value <= 86400000

Request Body

application/json
  1. body
olderThan?string

ISO-8601 timestamp cutoff; only terminal jobs older than this instant are eligible.

Formatdate-time
statuses?array<>

Optional terminal background job statuses to target for purging. If omitted, all terminal statuses are eligible. Canonical values are BACKGROUND_JOB_SUCCEEDED, BACKGROUND_JOB_FAILED, and BACKGROUND_JOB_CANCELED. Short aliases SUCCEEDED, FAILED, and CANCELED are also accepted for compatibility.

dryRun?boolean

If true, report purge counts without deleting any rows.

limit?integer

Maximum number of jobs to purge in this request. Must be >= 0; 0 means no limit.

Formatint32
Range0 <= value

Response Body

Purge completed

application/json
  1. response
jobsPurged*integer

Number of background job rows removed, or that would be removed during dry-run.

Formatint64
Range0 <= value
attemptsPurged*integer

Number of background job attempt rows removed.

Formatint64
Range0 <= value
referencesPurged*integer

Number of background job reference rows removed.

Formatint64
Range0 <= value
dryRun*boolean

Whether the purge executed in dry-run mode.

Example Request
curl -X POST 'https://your-goodmem-server.example.com/v1/admin/background-jobs:purge' \  -H 'GoodMem-Timeout-Ms: 30000' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "jobsPurged": 0,  "attemptsPurged": 0,  "referencesPurged": 0,  "dryRun": true}