Update an existing policy's rules, template, or metadata with optimistic locking. A rule managed by a template (a template component or a legacy template link) is edited through its template: a rules update that changes its effective permissions is rejected with 409 policy.template_managed, and the rule stays linked and unchanged. Saving the same effective permissions (for example delete restated as delete_exact plus deletecollection), a template update (template_name/template_version) and a metadata or namespaces update stay allowed. A save that changes nothing after normalization writes nothing: the version stays and no audit event is recorded. POST /policies/{id}/detach-template turns the rule into a custom rule first.
- Passing both
rulesandtemplate_namereturns400. Detach template-backed rules with POST/policiesto edit directly./{id} /detach-template - Changing expiry sends
expires_atandversiononly. On PostgreSQL and ClickHouse this runs Apply (needsaccess:apply,409if apply/delete is active). If Apply does not start,expiry_apply_not_started: trueis returned and the database keeps the old expiry until Apply.
Parameters
Policy ID (UUID)
Request body application/json · UpdatePolicyRequest
Policy update request
New expiry of a rule with a TTL, at least a minute and at most 30 days from now. Send it alone with version. A rule without a TTL refuses it with policy.ttl_not_allowed, an expired rule with resource.conflict. Principal moves the expiry. On PostgreSQL it also runs Apply in the caller's name to move VALID UNTIL, so there the change needs access:apply (403 otherwise) and waits for an Apply or a removal of the rule that already runs (409). If that Apply does not start, the answer names it in warnings.
Typed placement of a Kubernetes rule. For an update from a shared_by_template_v1 Kubernetes template a non-empty array replaces the placement and an explicit empty array is rejected. An absent field keeps the namespaces the rule stored for that template. Rejected for other template modes until unified materialization (accessTemplateSplit stage 3). For direct rules the field is presence-aware: an absent field keeps the stored placement, an explicit empty array clears it, a non-empty array replaces it.
Common field
The rule's own name, saved as metadata.name in every update mode (alone, with metadata, with rules or with a template update), as on create. A name sent here wins over metadata.name.
The rule's description, saved as metadata.description in every update mode.
Direct rules mode - mutually exclusive with template_name
2 fields
Template mode - mutually exclusive with rules
Presence-aware memberships of the rule's account (PostgreSQL rules only): an absent field keeps the stored memberships, an array replaces them. A membership identical to a stored one keeps its origin. Sent with an explicit empty rules array, a non-empty memberships array clears the grants of the rule, imported rows included.
4 fields
Parent role the account is a member of.
Responses
OK
PolicyResponse · 46 fields
When Principal removes this rule with a TTL (I17). Absent for a rule without one.
Set only in the response to PUT /policies/{id} that changes the expiry: Principal saved the new expiry but could not start the Apply that brings it to the account on the database.
Safe operation failure. Explanation and recommended_action come from the static failure-code registry. The only text not written by Principal is cluster_answer.
8 fields
Closed registry of asynchronous operation failure causes, independent of HTTP problem codes.
ACCESS_PROFILE_STALE AMBIGUOUS_TARGET_OUTCOME APPLY_INTERRUPTED AUTHENTICATION_FAILED CLICKHOUSE_REPLICAS_OUT_OF_SYNC CLICKHOUSE_USER_NAME_RESERVED CONNECTION_FAILED CONNECTION_REFUSED CONNECTION_TIMEOUT CONNECTOR_CREDENTIALS_MISSING CONNECTOR_PAUSED CONNECTOR_SOURCE_CHANGED CONNECTOR_TYPE_UNAVAILABLE CONSTRAINT_VIOLATION CREDENTIAL_EXPIRED CREDENTIAL_NOT_FOUND DATABASE_NOT_FOUND DRIFT_BINDING_NOT_FOUND DRIFT_DEFAULT_INHERITED_SKIPPED DRIFT_NO_EXECUTABLE_DIFF DRIFT_PARTIAL_APPLY DRIFT_PLAN_GENERATION_FAILED DRIFT_RESOURCE_MISMATCH DRIFT_RULE_DELETING DRIFT_RUN_OUTDATED DRIFT_SCOPE_MISMATCH GROUP_EXPANSION_LIMIT_EXCEEDED HANDLER_NOT_FOUND K8S_CHANGE_REJECTED K8S_CLUSTER_UNREACHABLE K8S_NAMESPACE_FORBIDDEN K8S_NAMESPACE_NOT_FOUND K8S_RBAC_FORBIDDEN KUBERNETES_MEMBER_CREDENTIALS_PENDING KUBERNETES_SERVICE_ACCOUNT_KUBECONFIG_NOT_ISSUED MARIADB_TRUNCATE_UNSUPPORTED MARIADB_USAGE_UNSUPPORTED MARIADB_GRANTS_AMBIGUOUS MUTATION_LOCKED MYSQL_MANAGEMENT_PRIVILEGES_MISSING 34 more values
NOT_FOUND OPERATION_BACKOFF OPERATION_CANCELLED OPERATION_TIMEOUT OWNED_OBJECTS_DECISION_REQUIRED PERMISSION_DENIED PLAN_APPLY_ARTIFACT_INVALID PLAN_APPLY_ORPHANED_LOCK PLAN_APPLY_ROLLBACK_BASELINE_INVALID PLAN_APPLY_RULE_CHANGED PLAN_APPLY_TARGET_STATE_CHANGED PLAN_APPLY_ACCESS_IMPACT_CHANGED POSTGRES_FUTURE_OBJECT_CREATORS_MISSING POSTGRES_GRANT_AUTHORITY_MISSING POSTGRES_MANAGEMENT_PRIVILEGES_MISSING POSTGRES_ROLE_ATTRIBUTE_UNSUPPORTED POSTGRES_ROLE_NAME_RESERVED POSTGRES_TLS_FILE_NOT_ALLOWED PROVIDER_REQUEST_FAILED RATE_LIMITED ROLE_EXISTS ROLE_NOT_FOUND ROTATION_CHECK_REQUIRED SECRET_STORE_UNAVAILABLE SERIALIZATION_ERROR TARGET_ACCOUNT_IDENTITY_MISMATCH TARGET_ACCOUNT_IDENTITY_UNVERIFIED TARGET_ACCOUNT_IMPORT_PENDING TARGET_ACCOUNT_PRINCIPAL_LOGIN TARGET_ACCOUNT_TAKEN TARGET_CONNECTION_MISSING TARGET_REPAIR_REQUIRED UNKNOWN_ERROR VALIDATION_FAILED Short name of the failure from the same registry, for lists and queues where the explanation is too long. Absent on failures saved before the field existed.
Whether the failed attempt was eligible for an automatic retry under the actual queue policy.
Known operation phase at failure, when available.
Stable code of the action that can resolve this failure, the same vocabulary as a problem's resolution.code, for example upstream.check_connection. Absent when no single action does. A screen that offers the action shows it next to the failure, otherwise it shows recommended_action.
The Kubernetes cluster's own answer to a change its admission policy or webhook refused: the policy or webhook name and its message. Only a step failure with code K8S_CHANGE_REJECTED carries it, as plain text without control characters, cut to 500 characters. The cluster administrator writes it, not Principal. Given only to callers with access:read in the rule's organization. Absent for runs saved before the field existed.
Safe operation failure. Explanation and recommended_action come from the static failure-code registry. The only text not written by Principal is cluster_answer.
8 fields
Closed registry of asynchronous operation failure causes, independent of HTTP problem codes.
ACCESS_PROFILE_STALE AMBIGUOUS_TARGET_OUTCOME APPLY_INTERRUPTED AUTHENTICATION_FAILED CLICKHOUSE_REPLICAS_OUT_OF_SYNC CLICKHOUSE_USER_NAME_RESERVED CONNECTION_FAILED CONNECTION_REFUSED CONNECTION_TIMEOUT CONNECTOR_CREDENTIALS_MISSING CONNECTOR_PAUSED CONNECTOR_SOURCE_CHANGED CONNECTOR_TYPE_UNAVAILABLE CONSTRAINT_VIOLATION CREDENTIAL_EXPIRED CREDENTIAL_NOT_FOUND DATABASE_NOT_FOUND DRIFT_BINDING_NOT_FOUND DRIFT_DEFAULT_INHERITED_SKIPPED DRIFT_NO_EXECUTABLE_DIFF DRIFT_PARTIAL_APPLY DRIFT_PLAN_GENERATION_FAILED DRIFT_RESOURCE_MISMATCH DRIFT_RULE_DELETING DRIFT_RUN_OUTDATED DRIFT_SCOPE_MISMATCH GROUP_EXPANSION_LIMIT_EXCEEDED HANDLER_NOT_FOUND K8S_CHANGE_REJECTED K8S_CLUSTER_UNREACHABLE K8S_NAMESPACE_FORBIDDEN K8S_NAMESPACE_NOT_FOUND K8S_RBAC_FORBIDDEN KUBERNETES_MEMBER_CREDENTIALS_PENDING KUBERNETES_SERVICE_ACCOUNT_KUBECONFIG_NOT_ISSUED MARIADB_TRUNCATE_UNSUPPORTED MARIADB_USAGE_UNSUPPORTED MARIADB_GRANTS_AMBIGUOUS MUTATION_LOCKED MYSQL_MANAGEMENT_PRIVILEGES_MISSING 34 more values
NOT_FOUND OPERATION_BACKOFF OPERATION_CANCELLED OPERATION_TIMEOUT OWNED_OBJECTS_DECISION_REQUIRED PERMISSION_DENIED PLAN_APPLY_ARTIFACT_INVALID PLAN_APPLY_ORPHANED_LOCK PLAN_APPLY_ROLLBACK_BASELINE_INVALID PLAN_APPLY_RULE_CHANGED PLAN_APPLY_TARGET_STATE_CHANGED PLAN_APPLY_ACCESS_IMPACT_CHANGED POSTGRES_FUTURE_OBJECT_CREATORS_MISSING POSTGRES_GRANT_AUTHORITY_MISSING POSTGRES_MANAGEMENT_PRIVILEGES_MISSING POSTGRES_ROLE_ATTRIBUTE_UNSUPPORTED POSTGRES_ROLE_NAME_RESERVED POSTGRES_TLS_FILE_NOT_ALLOWED PROVIDER_REQUEST_FAILED RATE_LIMITED ROLE_EXISTS ROLE_NOT_FOUND ROTATION_CHECK_REQUIRED SECRET_STORE_UNAVAILABLE SERIALIZATION_ERROR TARGET_ACCOUNT_IDENTITY_MISMATCH TARGET_ACCOUNT_IDENTITY_UNVERIFIED TARGET_ACCOUNT_IMPORT_PENDING TARGET_ACCOUNT_PRINCIPAL_LOGIN TARGET_ACCOUNT_TAKEN TARGET_CONNECTION_MISSING TARGET_REPAIR_REQUIRED UNKNOWN_ERROR VALIDATION_FAILED Short name of the failure from the same registry, for lists and queues where the explanation is too long. Absent on failures saved before the field existed.
Whether the failed attempt was eligible for an automatic retry under the actual queue policy.
Known operation phase at failure, when available.
Stable code of the action that can resolve this failure, the same vocabulary as a problem's resolution.code, for example upstream.check_connection. Absent when no single action does. A screen that offers the action shows it next to the failure, otherwise it shows recommended_action.
The Kubernetes cluster's own answer to a change its admission policy or webhook refused: the policy or webhook name and its message. Only a step failure with code K8S_CHANGE_REJECTED carries it, as plain text without control characters, cut to 500 characters. The cluster administrator writes it, not Principal. Given only to callers with access:read in the rule's organization. Absent for runs saved before the field existed.
Saved changes that the last successful apply did not materialize. True when the rule state recorded by that apply (effective permissions, placement, template versions, layout and materialization switches of the snapshot it applied) differs from the current rule. Rules applied before the state was recorded fall back to updated_at later than applied_at plus 5 seconds after a success or partial success. Always false for per-member copies of a group rule. Renames, apply status writes and other bookkeeping never set it.
delete_requested cleanup_running cleanup_failed cleanup_completed Canonical human name of the rule, the one every screen and message uses: the rule's own name. Else "{Template} for {Subject}" for a template rule. Else "Access for {Subject} on {Target}". A rule inherited from a group gets the group rule's name. Missing subject or target names are left out. Machine-generated names and IDs are never used.
What the access is for, from metadata.description of the rule. Absent when the rule has none.
Identifier of the group the access came through in its source, as the connector group mapping sets it. With the default mapping it is the full path for GitLab and GitHub groups (acme/platform/backend) and the address for Google groups. Empty for groups not linked to a connector and for callers without identities:read.
Group inheritance fields
Whether this group rule includes members of nested groups.
Set on the rule of an adopted target account. Assigning a template to the identity adds it to the identity's rule without a target account link, never to this rule.
successpartial_success failedRisk level of the latest plan (low, medium, high, critical)
When the latest plan was created
ID of the most recent plan for this policy
kubernetes_user_rbac kubernetes_group_rbac kubernetes_service_account_rbac group_role application_group Access mode of a group rule on a PostgreSQL, MariaDB or ClickHouse target, and of the member rows it keeps. member_grants copies the rule to every member's account, group_role keeps it in a role of the group that members are granted. Absent on other rules.
member_grants group_role The role a group rule in the group_role mode keeps on the target. Absent otherwise.
Namespaces contributed by this policy to shared Kubernetes RBAC profiles.
Effective server-owned Kubernetes RBAC object layout. Every new rule is materialized as unified_v1. The other values only appear on policies created before that layout and disappear as those are rematerialized. A policy still on the pre-stage-3 Role-per-namespace layout carries no value at all.
unified_v1 shared_clusterrole_v1 shared_profile_v1 3 fields
Where a row of a rule came from: written in the rule, materialized from its template, or imported from the live account at adoption or by the one-off import after an upgrade. An imported row is part of the desired state like any other row.
ruletemplateimportedMemberships of the rule's account in other roles (PostgreSQL). The rule asks for them like for its grants: an apply grants a missing one back.
5 fields
Where a row of a rule came from: written in the rule, materialized from its template, or imported from the live account at adoption or by the one-off import after an upgrade. An imported row is part of the desired state like any other row.
ruletemplateimportedKinds of access the engine of the target does not read, such as column privileges on PostgreSQL. An empty drift says nothing about them.
The first row of a PostgreSQL rule or template that names its objects by name or by a name mask while Future objects are on. Future objects reach only a row on every object of its kind in a schema, so the switch reaches none of these objects. Only a rule or template saved before Principal refused such a save carries it, and its next save is refused until Future objects are off or the row covers every object of its kind. A rule carries it in every read. A template only in GET /access-templates/{name} and the version read.
4 fields
The kind of objects of the row, in the plural.
tablessequencesfunctionstypesobjectsThe database the row names. Absent when the row names none, and always for a template.
The schema the row names. Absent when the row names none.
The object name or name mask of the row.
Subject info fields (enriched from Identity)
Identifier of a group subject in its source, as the connector group mapping sets it. With the default mapping it is the full path for GitLab and GitHub groups (acme/platform/backend) and the address for Google groups. Empty for groups not linked to a connector, for people and service accounts, and for callers without identities:read.
"user", "group", "service"
Name of the target. Absent when the target could not be read.
Kind of the target, such as postgres or kubernetes. Absent when the target could not be read.
Version mismatch (resource.conflict), or a rules change of a template-managed rule (policy.template_managed)
Validation failed. Also when Future objects stay on while a PostgreSQL row names its objects by name or by a name mask, field_errors then names the switch Also when Principal doesn't manage the target of the rule or template (before v7.3 that answer was 403 authorization.denied).
Common errors: 400 401 403 404 413 429 503 504. They mean the same for every operation, see Errors.