Docs
Live demo

Async operations

Long work returns 202 with a job ID. Poll until terminal and retry safely with Idempotency-Key.

On this page

Starting work#

bash
curl -s -X POST -H "Authorization: Bearer $PRINCIPAL_TOKEN" \
  "$PRINCIPAL_URL/api/v2/policies/$RULE/apply"
json
{"job_id":"8d1c2b9e-…","policy_id":"3f6c2a7e-…","status":"queued","terminal":false}

job_id is always returned (discovery omits status, POST /policies/apply-plan returns policy_id and job_id, sync returns job_id).

Following a job#

bash
curl -s -H "Authorization: Bearer $PRINCIPAL_TOKEN" \
  "$PRINCIPAL_URL/api/v2/admin/jobs/$JOB"
Field Values
status
queued, running, finished (terminal: true when final)
outcome
success, partial, failure, cancelled
substate
rescheduled, requires_approval, awaiting_confirmation, holds_lock, timed_out, interrupted, needs_repair, outcome_unknown, rollback_in_progress, rolled_back, expired

Safe retries with Idempotency-Key#

bash
curl -X POST "$PRINCIPAL_URL/api/v2/policies" \
  -H "Authorization: Bearer $PRINCIPAL_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" -H "Content-Type: application/json" \
  -d '{"subject_id":"…","target_id":"…","template_name":"warehouse-read-only"}'
Rule Behavior
Methods
POST, PUT, PATCH (DELETE ignores it).
Replay
Success cached 24h. Errors rerun.
Conflict
409 on different request or concurrent run.
Secrets
400 request.invalid on one-time secret routes.
Backoff
429 request.rate_limited, 503 installation.maintenance (maintenance_mode pauses writes, start_blocked blocks all): wait Retry-After.
↑ ↓ to moveEnter to openEsc to close