- [HTTP request](https://docs.cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies/create#body.HTTP_TEMPLATE)
- [Request body](https://docs.cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies/create#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies/create#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies/create#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies/create#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies/create#body.aspect_1)
- [Try it!](https://docs.cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies/create#try-it)

Creates an access policy. This method fails if the organization already has an access policy. The long-running operation has a successful status after the access policy propagates to long-lasting storage. Syntactic and basic semantic errors are returned in `metadata` as a BadRequest proto.

### HTTP request

`POST https://accesscontextmanager.googleapis.com/v1/accessPolicies`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "name": string, "parent": string, "title": string, "scopes": [ string ], "etag": string } ``` |

| Fields ||
|---|---|
| `name` | `string` Output only. Identifier. Resource name of the `AccessPolicy`. Format: `accessPolicies/{access_policy}` |
| `parent` | `string` Required. The parent of this `AccessPolicy` in the Cloud Resource Hierarchy. Currently immutable once created. Format: `organizations/{organizationId}` |
| `title` | `string` Required. Human-readable title. Does not affect behavior. |
| `scopes[]` | `string` The scopes of the `https://docs.cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies#AccessPolicy`. Scopes define which resources a policy can restrict and where its resources can be referenced. For example, policy A with `scopes=["folders/123"]` has the following behavior: - `https://docs.cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies.servicePerimeters#ServicePerimeter` can only restrict projects within `folders/123`. - `https://docs.cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies.servicePerimeters#ServicePerimeter` within policy A can only reference access levels defined within policy A. - Only one policy can include a given scope; thus, attempting to create a second policy that includes `folders/123` will result in an error. If no scopes are provided, then any resource within the organization can be restricted. Scopes cannot be modified after a policy is created. Policies can only have a single scope. Format: list of `folders/{folder_number}` or `projects/{projectNumber}` |
| `etag` | `string` Output only. An opaque identifier for the current version of the `AccessPolicy`. This will always be a strongly validated etag, meaning that two access policies will be identical if and only if their etags are identical. Clients should not expect this to be in any specific format. |

### Response body

If successful, the response body contains a newly created instance of `https://docs.cloud.google.com/access-context-manager/docs/reference/rest/Shared.Types/Operation`.

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `parent` resource:

- `accesscontextmanager.policies.create`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).