Create access grants for subjects on targets. Supports both synchronous and asynchronous modes. Name the subject exactly one way: subject_id, or connector_id, provider, external_id and subject_kind together. A request with subject_id and any external identity field is refused with 400. The access check, the rule, the command record and the response all name that one subject, also for a template grant by subject_id. Either template_name or rules must be provided.
- TTL: ISO 8601 duration (15 minutes to 30 days, e.g.
PT1H) for a person only (creates a temporary account on databases and Kubernetes). Groups returnpolicy.ttl_not_allowed.
mode |
Status | Behavior |
|---|---|---|
plan_only |
— |
Creates rule and plan |
apply_sync |
201 |
Creates rule, queues apply |
apply_async |
202 |
Creates rule, queues apply |
Both apply modes return before the apply runs: status, terminal and outcome describe the grant request, not the apply. Poll job_id.
Parameters
Idempotency key for request deduplication. The key belongs to the organization and the console session that sent it: a retry from the same session gets the stored answer, another session runs its own request.
Request body application/json · GrantAccessRequest
Grant access request
Execution mode
plan_only apply_async apply_sync Target identification
For EnsureSubject
Optional metadata
For EnsureSubject
OperationID for idempotency (optional, generated if not provided)
For EnsureSubject
2 fields
The subject to grant to. Send either subject_id or connector_id, provider, external_id and subject_kind, not both.
Policy definition (one of these must be provided)
Rule with a TTL (I17): an ISO 8601 duration of 15 minutes to 30 days, for example PT1H. The grant creates a personal rule that Principal removes at that moment. On a database or Kubernetes target the rule gets its own temporary account. A group subject refuses it with policy.ttl_not_allowed.
Responses
Access granted (sync mode)
GrantAccessResponse · 14 fields
Final operation result, or null while the operation is active.
successfailurecancelledpartialSafe 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.
Qualifies 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 rescheduled3 fields
The saved plan the grant generated. In an apply mode the job executes this plan exactly when POST /policies/{id}/plan would report exact_apply_supported true. Otherwise, for example for a group policy applied per member, the job applies the policy's current state and records the plan it builds on its own apply run (see job_id), while plan_id keeps naming the generated plan for tracing.
3 fields
Where a background operation is in the shared lifecycle (decision S1). outcome says how a finished operation ended and substate qualifies the state.
queuedrunningfinishedAccess grant initiated (async mode)
GrantAccessResponse · 14 fields
Final operation result, or null while the operation is active.
successfailurecancelledpartialSafe 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.
Qualifies 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 rescheduled3 fields
The saved plan the grant generated. In an apply mode the job executes this plan exactly when POST /policies/{id}/plan would report exact_apply_supported true. Otherwise, for example for a group policy applied per member, the job applies the policy's current state and records the plan it builds on its own apply run (see job_id), while plan_id keeps naming the generated plan for tracing.
3 fields
Where a background operation is in the shared lifecycle (decision S1). outcome says how a finished operation ended and substate qualifies the state.
queuedrunningfinishedInvalid request
Subject or target not found
Conflict
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
Internal Server Error
Common errors: 401 403 413 429 503 504. They mean the same for every operation, see Errors.