- [HTTP request](https://docs.cloud.google.com/organization-policy/reference/rest/v2/organizations.customConstraints/create#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/organization-policy/reference/rest/v2/organizations.customConstraints/create#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/organization-policy/reference/rest/v2/organizations.customConstraints/create#body.request_body)
- [Response body](https://docs.cloud.google.com/organization-policy/reference/rest/v2/organizations.customConstraints/create#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/organization-policy/reference/rest/v2/organizations.customConstraints/create#body.aspect)
- [Try it!](https://docs.cloud.google.com/organization-policy/reference/rest/v2/organizations.customConstraints/create#try-it)

Creates a custom constraint.

Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the organization does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the constraint already exists on the given organization.

### HTTP request

`POST https://orgpolicy.googleapis.com/v2/{parent=organizations/*}/customConstraints`

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. Must be in the following form: - `organizations/{organization_id}` Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `parent`: - `orgpolicy.customConstraints.create` |

### Request body

The request body contains an instance of `https://docs.cloud.google.com/organization-policy/reference/rest/v2/organizations.customConstraints#CustomConstraint`.

### Response body

If successful, the response body contains a newly created instance of `https://docs.cloud.google.com/organization-policy/reference/rest/v2/organizations.customConstraints#CustomConstraint`.

### Authorization scopes

Requires one of the following OAuth scopes:

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

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