Docs
Live demo
POST/api/v2/policies/{id}/apply

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/jobs/{id}.

Parameters

Path1 required of 1
idstringpathrequired

Policy ID (UUID)

Request body application/json

Fresh apply request. plan_id is not accepted on this route.

Optional1 field
expected_versioninteger

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.

min 1

Responses

202

Accepted

ApplyPolicyResponse · 10 fields
terminalbooleanrequired

Whether this operation has finished.

outcomestring (entity.OperationOutcome)required

Final operation result, or null while the operation is active.

successfailurecancelledpartial
can be null
substatestring (entity.OperationSubstate)required

Qualifies the status and outcome of an operation where they alone would hide what the operator must know. Null when none applies.

rollback_in_progressrolled_backneeds_repairoutcome_unknowninterruptedrequires_approvalholds_lockawaiting_confirmationexpiredtimed_outrescheduled
can be null
created_atstring
execution_modestring
job_idstring
messagestring

Human-readable message about job status

plan_idstring

May be empty if plan creation failed

policy_idstring

Where a background operation is in the shared lifecycle (decision S1). outcome says how a finished operation ended and substate qualifies the state.

queuedrunningfinished
409

Conflict - 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

422

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.

↑ ↓ to moveEnter to openEsc to close