Apply the latest desired state for a policy. Exact saved-plan execution must use /plans/{id}/apply.
Returns 202 with job_id. Track via GET /apply-runs or GET /admin.
Parameters
Policy ID (UUID)
Request body application/json
Fresh apply request. plan_id is not accepted on this route.
The rule version the person reviewed, policy_version of the rule preview. A rule changed since then answers 409 instead of applying changes nobody reviewed.
Responses
Accepted
ApplyPolicyResponse · 10 fields
Whether this operation has finished.
Final operation result, or null while the operation is active.
successfailurecancelledpartialQualifies the status and outcome of an operation where they alone would hide what the operator must know. Null when none applies.
rollback_in_progress rolled_back needs_repair outcome_unknown interruptedrequires_approval holds_lock awaiting_confirmation expiredtimed_out rescheduledHuman-readable message about job status
May be empty if plan creation failed
Where a background operation is in the shared lifecycle (decision S1). outcome says how a finished operation ended and substate qualifies the state.
queuedrunningfinishedConflict - an apply, another mutation or cleanup of this policy is in progress. Details.existing_job_id names a running apply job, details.cleanup_task_id a cleanup task. Code policy.apply_in_progress means another apply of this rule runs or waits for its next attempt. Resources name that job (running_apply), resolution.code policy.view_apply opens it, details.started_at is when it took the rule, details.attempt and details.max_attempts its attempt, details.expires_at when its running attempt stops counting as alive unless its worker renews it (Principal then releases the rule within minutes), details.next_attempt_at when an apply that waits between attempts tries again. Code policy.member_credentials_pending means members of a group bound directly still have kubeconfigs for the target's previous sign-in source (resources names them). Nothing was applied, and the apply succeeds after the credential refresh replaces them. Code policy.target_service_account_incomplete means the last check of the MariaDB target's service account found privileges missing (resources names the target, details.missing_privileges the privileges, details.recommended_sql the command a database administrator runs). Nothing was queued
Unprocessable: Principal doesn't manage the target, so it doesn't change access on it (code request.unprocessable). Switch the target to managed, then try again. Before v7.3 this answer was 403 authorization.denied.
Common errors: 400 401 403 404 413 429 503 504. They mean the same for every operation, see Errors.