Docs
Live demo
POST/api/v2/policies/{id}/detach-template
access:manageAPI token

Detach a template-managed rule from its templates. The rule becomes a custom rule with the same grants, typed scope and materialization layout. Only the template link (components, template name/version, variables) is removed. The next apply moves the rule from the shared template RBAC objects to its own objects with the same access. Rules still on the legacy shared RBAC profile layout are rejected until the layout migration moves them.

Pass current version from GET /policies/{id}.

Parameters

Path1 required of 1
idstringpathrequired

Policy ID (UUID)

Request body application/json · DetachPolicyTemplateRequest

Detach request with the policy version the caller saw

Required1 of 1 fields
versionintegerrequired

Policy version the caller saw (optimistic locking)

min 1

Responses

200

OK

PolicyResponse · 46 fields
expires_atstring · date-time

When Principal removes this rule with a TTL (I17). Absent for a rule without one.

expiry_apply_not_startedboolean

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.

last_apply_failureOperationFailureResponse

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
codestring (JobFailureCode)required

Closed registry of asynchronous operation failure causes, independent of HTTP problem codes.

ACCESS_PROFILE_STALEAMBIGUOUS_TARGET_OUTCOMEAPPLY_INTERRUPTEDAUTHENTICATION_FAILEDCLICKHOUSE_REPLICAS_OUT_OF_SYNCCLICKHOUSE_USER_NAME_RESERVEDCONNECTION_FAILEDCONNECTION_REFUSEDCONNECTION_TIMEOUTCONNECTOR_CREDENTIALS_MISSINGCONNECTOR_PAUSEDCONNECTOR_SOURCE_CHANGEDCONNECTOR_TYPE_UNAVAILABLECONSTRAINT_VIOLATIONCREDENTIAL_EXPIREDCREDENTIAL_NOT_FOUNDDATABASE_NOT_FOUNDDRIFT_BINDING_NOT_FOUNDDRIFT_DEFAULT_INHERITED_SKIPPEDDRIFT_NO_EXECUTABLE_DIFFDRIFT_PARTIAL_APPLYDRIFT_PLAN_GENERATION_FAILEDDRIFT_RESOURCE_MISMATCHDRIFT_RULE_DELETINGDRIFT_RUN_OUTDATEDDRIFT_SCOPE_MISMATCHGROUP_EXPANSION_LIMIT_EXCEEDEDHANDLER_NOT_FOUNDK8S_CHANGE_REJECTEDK8S_CLUSTER_UNREACHABLEK8S_NAMESPACE_FORBIDDENK8S_NAMESPACE_NOT_FOUNDK8S_RBAC_FORBIDDENKUBERNETES_MEMBER_CREDENTIALS_PENDINGKUBERNETES_SERVICE_ACCOUNT_KUBECONFIG_NOT_ISSUEDMARIADB_TRUNCATE_UNSUPPORTEDMARIADB_USAGE_UNSUPPORTEDMARIADB_GRANTS_AMBIGUOUSMUTATION_LOCKEDMYSQL_MANAGEMENT_PRIVILEGES_MISSING
34 more values
NOT_FOUNDOPERATION_BACKOFFOPERATION_CANCELLEDOPERATION_TIMEOUTOWNED_OBJECTS_DECISION_REQUIREDPERMISSION_DENIEDPLAN_APPLY_ARTIFACT_INVALIDPLAN_APPLY_ORPHANED_LOCKPLAN_APPLY_ROLLBACK_BASELINE_INVALIDPLAN_APPLY_RULE_CHANGEDPLAN_APPLY_TARGET_STATE_CHANGEDPLAN_APPLY_ACCESS_IMPACT_CHANGEDPOSTGRES_FUTURE_OBJECT_CREATORS_MISSINGPOSTGRES_GRANT_AUTHORITY_MISSINGPOSTGRES_MANAGEMENT_PRIVILEGES_MISSINGPOSTGRES_ROLE_ATTRIBUTE_UNSUPPORTEDPOSTGRES_ROLE_NAME_RESERVEDPOSTGRES_TLS_FILE_NOT_ALLOWEDPROVIDER_REQUEST_FAILEDRATE_LIMITEDROLE_EXISTSROLE_NOT_FOUNDROTATION_CHECK_REQUIREDSECRET_STORE_UNAVAILABLESERIALIZATION_ERRORTARGET_ACCOUNT_IDENTITY_MISMATCHTARGET_ACCOUNT_IDENTITY_UNVERIFIEDTARGET_ACCOUNT_IMPORT_PENDINGTARGET_ACCOUNT_PRINCIPAL_LOGINTARGET_ACCOUNT_TAKENTARGET_CONNECTION_MISSINGTARGET_REPAIR_REQUIREDUNKNOWN_ERRORVALIDATION_FAILED
titlestring

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.

max length 32
explanationstringrequired
recommended_actionstringrequired
retryablebooleanrequired

Whether the failed attempt was eligible for an automatic retry under the actual queue policy.

phasestring

Known operation phase at failure, when available.

resolution_codestring

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.

max length 128 · pattern ^[a-z][a-z0-9_-]*(\.[a-z0-9_-]+)*$
cluster_answerstring

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.

max length 500

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
codestring (JobFailureCode)required

Closed registry of asynchronous operation failure causes, independent of HTTP problem codes.

ACCESS_PROFILE_STALEAMBIGUOUS_TARGET_OUTCOMEAPPLY_INTERRUPTEDAUTHENTICATION_FAILEDCLICKHOUSE_REPLICAS_OUT_OF_SYNCCLICKHOUSE_USER_NAME_RESERVEDCONNECTION_FAILEDCONNECTION_REFUSEDCONNECTION_TIMEOUTCONNECTOR_CREDENTIALS_MISSINGCONNECTOR_PAUSEDCONNECTOR_SOURCE_CHANGEDCONNECTOR_TYPE_UNAVAILABLECONSTRAINT_VIOLATIONCREDENTIAL_EXPIREDCREDENTIAL_NOT_FOUNDDATABASE_NOT_FOUNDDRIFT_BINDING_NOT_FOUNDDRIFT_DEFAULT_INHERITED_SKIPPEDDRIFT_NO_EXECUTABLE_DIFFDRIFT_PARTIAL_APPLYDRIFT_PLAN_GENERATION_FAILEDDRIFT_RESOURCE_MISMATCHDRIFT_RULE_DELETINGDRIFT_RUN_OUTDATEDDRIFT_SCOPE_MISMATCHGROUP_EXPANSION_LIMIT_EXCEEDEDHANDLER_NOT_FOUNDK8S_CHANGE_REJECTEDK8S_CLUSTER_UNREACHABLEK8S_NAMESPACE_FORBIDDENK8S_NAMESPACE_NOT_FOUNDK8S_RBAC_FORBIDDENKUBERNETES_MEMBER_CREDENTIALS_PENDINGKUBERNETES_SERVICE_ACCOUNT_KUBECONFIG_NOT_ISSUEDMARIADB_TRUNCATE_UNSUPPORTEDMARIADB_USAGE_UNSUPPORTEDMARIADB_GRANTS_AMBIGUOUSMUTATION_LOCKEDMYSQL_MANAGEMENT_PRIVILEGES_MISSING
34 more values
NOT_FOUNDOPERATION_BACKOFFOPERATION_CANCELLEDOPERATION_TIMEOUTOWNED_OBJECTS_DECISION_REQUIREDPERMISSION_DENIEDPLAN_APPLY_ARTIFACT_INVALIDPLAN_APPLY_ORPHANED_LOCKPLAN_APPLY_ROLLBACK_BASELINE_INVALIDPLAN_APPLY_RULE_CHANGEDPLAN_APPLY_TARGET_STATE_CHANGEDPLAN_APPLY_ACCESS_IMPACT_CHANGEDPOSTGRES_FUTURE_OBJECT_CREATORS_MISSINGPOSTGRES_GRANT_AUTHORITY_MISSINGPOSTGRES_MANAGEMENT_PRIVILEGES_MISSINGPOSTGRES_ROLE_ATTRIBUTE_UNSUPPORTEDPOSTGRES_ROLE_NAME_RESERVEDPOSTGRES_TLS_FILE_NOT_ALLOWEDPROVIDER_REQUEST_FAILEDRATE_LIMITEDROLE_EXISTSROLE_NOT_FOUNDROTATION_CHECK_REQUIREDSECRET_STORE_UNAVAILABLESERIALIZATION_ERRORTARGET_ACCOUNT_IDENTITY_MISMATCHTARGET_ACCOUNT_IDENTITY_UNVERIFIEDTARGET_ACCOUNT_IMPORT_PENDINGTARGET_ACCOUNT_PRINCIPAL_LOGINTARGET_ACCOUNT_TAKENTARGET_CONNECTION_MISSINGTARGET_REPAIR_REQUIREDUNKNOWN_ERRORVALIDATION_FAILED
titlestring

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.

max length 32
explanationstringrequired
recommended_actionstringrequired
retryablebooleanrequired

Whether the failed attempt was eligible for an automatic retry under the actual queue policy.

phasestring

Known operation phase at failure, when available.

resolution_codestring

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.

max length 128 · pattern ^[a-z][a-z0-9_-]*(\.[a-z0-9_-]+)*$
cluster_answerstring

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.

max length 500
applied_atstring
changes_not_appliedbooleanrequired

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.

cleanup_last_errorstring
cleanup_statusstring
delete_requestedcleanup_runningcleanup_failedcleanup_completed
cleanup_task_idstring
created_atstring
created_bystring
display_namestringrequired

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.

descriptionstring

What the access is for, from metadata.description of the rule. Absent when the rule has none.

idstring
inherited_from_group_display_namestring
inherited_from_group_external_idstring

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.

inherited_from_group_idstring

Group inheritance fields

include_nested_groupsboolean

Whether this group rule includes members of nested groups.

is_inherited_bindingboolean
target_account_link_idstring

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.

last_apply_statusstring
successpartial_successfailed
latest_plan_riskstring

Risk level of the latest plan (low, medium, high, critical)

latest_plan_atstring

When the latest plan was created

latest_plan_idstring

ID of the most recent plan for this policy

materialization_modestring
kubernetes_user_rbackubernetes_group_rbackubernetes_service_account_rbacgroup_roleapplication_group
group_access_modestring

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_grantsgroup_role
group_role_namestring

The role a group rule in the group_role mode keeps on the target. Absent otherwise.

kubernetes_namespacesarray of string

Namespaces contributed by this policy to shared Kubernetes RBAC profiles.

kubernetes_rbac_layoutstring

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_v1shared_clusterrole_v1shared_profile_v1
metadatamap of string → any
organization_idstring
organization_namestring
rulesarray of PolicyRuleResponse
3 fields
permissionsarray of string
resourcesarray of string
originstring (AccessOrigin)

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.

ruletemplateimported
membershipsarray of PolicyMembershipResponse

Memberships 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
rolestringrequired
admin_optionbooleanrequired
inheritboolean
setboolean
originstring (AccessOrigin)required

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.

ruletemplateimported
unobserved_accessarray of string

Kinds of access the engine of the target does not read, such as column privileges on PostgreSQL. An empty drift says nothing about them.

future_objects_named_rowFutureObjectsNamedRowResponse

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
objectsstringrequired

The kind of objects of the row, in the plural.

tablessequencesfunctionstypesobjects
databasestring

The database the row names. Absent when the row names none, and always for a template.

schemastring

The schema the row names. Absent when the row names none.

namestringrequired

The object name or name mask of the row.

subject_display_namestring

Subject info fields (enriched from Identity)

subject_external_idstring

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.

subject_idstring
subject_kindstring

"user", "group", "service"

target_idstring
target_namestring

Name of the target. Absent when the target could not be read.

target_kindstring

Kind of the target, such as postgres or kubernetes. Absent when the target could not be read.

updated_atstring
versioninteger
warningsarray of string
409

Version mismatch or a legacy shared RBAC profile rule (resource.conflict), or the rule is not managed by a template (policy.not_template_managed)

422

Unprocessable Entity - Future objects stay on for a PostgreSQL rule while one of its rows names its objects by name or by a name mask. Field_errors names the switch

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