canonical: https://jentic.com/apis/googleapis.com/iam

# Google Identity and Access Management (IAM) API

The Identity and Access Management (IAM) API v2 manages deny policies that supplement Google Cloud's allow-based IAM bindings. A deny policy is attached to an organisation, folder, or project resource and lists permissions that must not be granted regardless of any allow rule. The v2 API provides CRUD over these deny policies and supports long-running operation tracking for asynchronous policy updates. It is the modern surface for fine-grained, exception-based access control on Google Cloud and is paired with the broader IAM v1 surface for service accounts, allow policies, and roles.

## For AI agents

Manage Google Cloud IAM deny policies on organisations, folders, and projects to enforce hard boundaries that no allow rule can override.

## Scope

Does not manage allow bindings, service-account keys, or workload identity federation - use for IAM v2 deny-policy lifecycle on organisations, folders, and projects only.

## Capabilities

- Create deny policies attached to a Google Cloud organisation, folder, or project resource
- List deny policies currently attached to a given Cloud resource
- Read a specific deny policy to inspect denied permissions and exception principals
- Update a deny policy to refine principals, denied permissions, or exception conditions
- Delete a deny policy when its denial scope is no longer needed
- Track long-running policy operations to confirm propagation across IAM

## Use cases

### Hard Guardrails on Production Resources

Platform security teams attach IAM deny policies to production folders to guarantee that no allow rule, however accidental, can grant destructive permissions like storage.buckets.delete or compute.instances.delete to the wrong principals. Deny policies are evaluated before allow policies, so a misconfigured project owner role can still be over-ridden by an organisation-level deny policy. Teams manage these policies as code and roll them out via the v2 API.

Example prompt: Attach a new deny policy to folders/prod-folder that denies storage.buckets.delete for all principals except group:platform-admins@example.com, and return the resulting policy name and etag.

### Exception-Based Privileged Access

Engineering teams use deny policies with exception principals to express "nobody can do X except this one break-glass group." The deny rule denies impersonation or token creation across the organisation, with an exception list of approved emergency-access principals. This is more auditable than relying on absence of an allow binding because the intent is explicit in the policy document.

Example prompt: Update deny policy operations/p/policies/no-impersonation on organisations/12345 to add user:oncall-admin@example.com to the exceptionPrincipals for the iam.serviceAccounts.implicitDelegation permission.

### Compliance Reporting on Deny Policies

GRC teams pull the list of all deny policies attached to a top-level folder or organisation each quarter to evidence that compensating controls remain in place. The list operation returns the policy name, etag, denied permissions, and principal lists for each policy attached to the parent resource.

Example prompt: List all deny policies attached to folders/audit-scope, then for each one read the full policy and emit a CSV with policy name, denied permissions, and principal counts.

### AI Agent Policy Drift Detection

An AI agent compares declared deny policies in source control against the live policies on each Google Cloud resource via Jentic. Drift is reported back to the platform team with a suggested update payload. Jentic isolates the IAM admin credential so the agent never holds raw service-account JSON.

Example prompt: For each entry in declared-policies.yaml, call GET /v2/{+name} to fetch the live deny policy and produce a diff highlighting any added or removed principals or denied permissions.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /v2/{+parent} | List deny policies attached to a parent resource |
| POST | /v2/{+parent} | Create a deny policy on a parent resource |
| GET | /v2/{+name} | Get a specific deny policy by name |
| PUT | /v2/{+name} | Update a deny policy |
| DELETE | /v2/{+name} | Delete a deny policy |

## Key resources

- **Deny policies** — Create, read, update, and delete IAM deny policies attached to organisations, folders, and projects
- **Operations** — Track long-running IAM policy update operations

## Why Jentic

- **Setup:** Wiring the IAM API by hand means configuring admin OAuth2, narrowing to the cloud-platform scope, refreshing tokens, and URL-encoding its deny-policy resource paths yourself. Through Jentic you install once, import the Identity and Access Management API from the API Directory, store the credential once, and your agent calls it.
- **Permission scoping:** The policy parent and name travel in the URL path (/v2/{parent}, /v2/{name}), so a rule can pin your agent to one organisation, folder, or project's deny policies: it manages policies under that resource and nothing else. You choose the operations it may call, so destructive ones like deny-policy deletion are not included unless you add them.
- **Credential handling:** Your IAM admin credential is stored once, encrypted, by your own Jentic One instance and injected at execution time as a short-lived cloud-platform access token. The service-account key never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'create iam deny policy' or 'list deny policies on a folder', and Jentic returns the matching v2 operation with its input schema so the agent constructs the right parent without browsing the reference docs.

## Related APIs

- **IAM Service Account Credentials API** — Mints short-lived credentials for service accounts that the IAM API governs.
- **Cloud Resource Manager API** — Manages projects, folders, and organisations that IAM deny policies attach to.
- **Access Context Manager API** — Defines context-based access policies (VPC SC perimeters, access levels) that complement IAM allow/deny.

## FAQ

### What authentication does the IAM API use?

Google OAuth 2.0 with the cloud-platform scope and an IAM principal that holds iam.denypolicies.* permissions on the parent resource. Through Jentic the credential is stored encrypted and exchanged for a short-lived access token at call time.

### Can I attach an IAM deny policy to a project?

Yes. Call POST /v2/{+parent} where parent is policies/cloudresourcemanager.googleapis.com%2Fprojects%2F{projectNumber}/denypolicies and supply a deny policy body listing denied permissions, principals, and any exception principals.

### What are the rate limits for the IAM API?

Google enforces per-project quotas on IAM admin operations (default in the low hundreds of QPS). Deny-policy writes are eventually consistent and are completed via long-running operations, so callers should poll the returned operation until done.

### How do I create a deny policy through Jentic?

Search Jentic with 'create iam deny policy', load the POST /v2/{+parent} operation, and execute with the parent set to the policy attachment point and a request body listing deniedPermissions and principals. Jentic handles OAuth and returns the operation name.

### How are deny policies different from allow bindings?

Allow bindings (managed in IAM v1 / setIamPolicy) grant permissions; deny policies (this v2 API) explicitly remove permissions even if an allow binding grants them. Deny rules win against allow rules, which makes them suitable for hard guardrails.

### Can I limit what my agent is allowed to do with the Google Cloud IAM API?

Yes. Jentic One is self-hosted by you, so your own rules decide which IAM v2 operations and which admin credential the agent may use. Because the policy parent and name travel in the URL path, you can pin the agent to the deny policies under a single organisation, folder, or project and nothing else. You also choose the operations it can call, so you can allow it to list, read, create, and update deny policies while excluding destructive ones like deny-policy deletion unless you explicitly add them.
