# Method: projects.updatePolicy

- [HTTP request](https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1alpha2/projects/updatePolicy#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1alpha2/projects/updatePolicy#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1alpha2/projects/updatePolicy#body.request_body)
- [Response body](https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1alpha2/projects/updatePolicy#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/binary-authorization/docs/reference/rest/v1alpha2/projects/updatePolicy#body.aspect)

Creates or updates a project's `https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/Policy`, and returns a copy of the new `https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/Policy`. A policy is always updated as a whole, to avoid race conditions with concurrent policy enforcement (or management!) requests. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed.

### HTTP request

`PUT https://binaryauthorization.googleapis.com/v1alpha2/{policy.name=projects/*/policy}`

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

### Path parameters

| Parameters ||
|---|---|
| `policy.name` | `string` Output only. The resource name, in the format `projects/*/policy`. There is at most one policy per project. |

### Request body

The request body contains an instance of `https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/Policy`.

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/binary-authorization/docs/reference/rest/Shared.Types/Policy`.

### Authorization scopes

Requires the following OAuth scope:

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

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