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

# Google Organization Policy API

The Organization Policy API configures governance constraints across the Google Cloud resource hierarchy - organisations, folders, and projects. It exposes built-in constraints (boolean, list, custom) and lets administrators author and apply policies that allow or deny specific resource configurations, such as restricting which regions VMs can run in or which service accounts can be created. The API also supports custom constraints for resource fields not covered by built-ins. The spec exposes 9 endpoints.

## For AI agents

Apply and inspect Google Cloud organisation policies - boolean, list, and custom constraints - that govern what resource configurations are allowed across the hierarchy.

## Scope

Does not grant IAM permissions, evaluate runtime requests, or manage hierarchy nodes - use for declaring and inspecting organisation policy resources only.

## Capabilities

- List the built-in constraints available on a folder, project, or organisation
- Apply policies that enforce or restrict specific resource configurations
- Author custom constraints for resource fields not covered by built-ins
- Read the effective policy for a resource after hierarchy inheritance
- Audit which policies override or inherit from a parent in the hierarchy
- Remove or update a policy when governance requirements change

## Use cases

### Region restriction for data residency

Apply the gcp.resourceLocations boolean/list constraint to a folder or organisation so that all VMs, GKE clusters, and storage buckets in scope can only be created in approved regions. The Organization Policy API lets compliance teams roll this constraint out hierarchy-wide and read back the effective policy from any project to verify enforcement. Suitable for organisations with data residency obligations.

Example prompt: Apply a policy to folder folders/123456 that sets the gcp.resourceLocations constraint to allow only europe-west1 and europe-west4, then read the effective policy on a child project to confirm.

### Custom constraints for label compliance

Author a custom constraint that requires every Compute Engine instance to carry a specific label such as cost-center or owner. Custom constraints declare a CEL condition over the resource and apply it at create or update time. This catches misconfigurations at admission instead of relying on after-the-fact remediation.

Example prompt: Create a custom constraint that requires every compute.googleapis.com/Instance to carry a labels.cost-center value, attach it to organisation 7777777, and verify creation by listing custom constraints.

### Audit drift across the hierarchy

Walk the resource hierarchy and read the effective policy on each project to detect drift between intended governance and what is actually enforced. The API's getEffectivePolicy endpoint returns the inherited result, so an audit script can flag projects where a child policy overrides a tighter parent. Helpful before security reviews or audits.

Example prompt: For every project under organisation 7777777, GET /v2/{+name}:getEffectivePolicy for constraint constraints/iam.allowedPolicyMemberDomains and write any project whose effective policy disagrees with the org policy to a drift report.

### Agent-driven governance changes via Jentic

A governance agent reacting to a security incident - for example, a sudden deployment in an unapproved region - can use Jentic to find and apply the right Organization Policy operation. Credentials stay in your Jentic One instance, so the agent acts under scoped Org Admin tokens with full audit trail. Useful for guardrail bots that close governance gaps automatically.

Example prompt: Use Jentic to find the create-policy operation, load its schema, and apply a constraint that denies compute.googleapis.com/Instance creation outside europe-west1 to folder folders/123456.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v2/{+parent}/policies | Create an organisation policy |
| GET | /v2/{+parent}/policies | List policies on a node |
| PATCH | /v2/{+name} | Update a policy |
| DELETE | /v2/{+name} | Delete a policy |
| GET | /v2/{+name}:getEffectivePolicy | Get the effective policy after inheritance |
| GET | /v2/{+parent}/constraints | List built-in constraints |
| POST | /v2/{+parent}/customConstraints | Create a custom constraint |

## Key resources

- **policies** — Policy resources that bind a constraint to a node in the hierarchy
- **constraints** — Built-in constraints available across the platform
- **customConstraints** — Custom constraints with CEL conditions over resource fields

## Why Jentic

- **Setup:** Wiring the Organization Policy API by hand means configuring Google OAuth 2.0 from a service account, minting scoped tokens, and managing policy resource paths and retries against orgpolicy.googleapis.com yourself. Through Jentic you install once, import the Organization Policy API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** The Organization Policy API puts the resource in the URL path (/v1/{+parent}/policies, /v1/{+name}), so a rule can pin your agent to one parent node: it can create and inspect policies there and nothing else. You choose the operations it may call, so destructive ones like policy deletion or custom-constraint creation are not included unless you add them.
- **Credential handling:** Your Google OAuth credential for the Organization Policy API is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'apply a region restriction policy' or 'read an effective policy', and Jentic returns the matching Organization Policy operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Cloud Resource Manager API** — Cloud Resource Manager owns the hierarchy nodes that org policies attach to
- **Identity and Access Management API** — IAM controls who can do what; Organization Policy controls what configurations are allowed
- **Security Command Center API** — Security Command Center surfaces findings that often drive new org policies

## FAQ

### What authentication does the Organization Policy API use?

The API uses Google OAuth 2.0 with the cloud-platform scope and requires the orgpolicy.policyAdmin role on the target node. Through Jentic, tokens are minted from a service account stored in your Jentic One instance.

### Can I write custom constraints with this API?

Yes. POST to /v2/{+parent}/customConstraints with a CEL condition over the target resource type. The constraint then becomes available to bind via a policy on any node beneath the parent organisation.

### What are the rate limits for the Organization Policy API?

Google Cloud applies a per-project quota for policy mutations. Effective-policy reads are cheap; bulk audits should still batch and back off if 429s appear, rather than fan out.

### How do I apply a region restriction policy through Jentic?

Search Jentic for create organisation policy, load the schema for POST /v2/{+parent}/policies, and execute it with the gcp.resourceLocations constraint and your allowed list. Jentic returns the policy resource so you can confirm the apply.

### Does this API enforce policies at runtime?

No - the API stores policy definitions. Enforcement happens inside the underlying services (Compute, GKE, Cloud Storage) when they evaluate the constraint at create or update time.

### How do I read the effective policy on a project?

Call GET /v2/{+name}:getEffectivePolicy with the constraint name appended to the project resource path; the response returns the inherited policy after walking the hierarchy.

### Can I limit what my agent is allowed to do with the Organization Policy API?

Yes. Because you run Jentic One yourself, your own rules decide which Organization Policy operations and credentials the agent may use. Since this API puts the target node in the URL path, you can pin the agent to a single parent organisation, folder, or project so it only creates, lists, and reads effective policies there. You choose the operations it may call, so destructive ones like deleting a policy or creating a custom constraint stay excluded unless you explicitly add them.
