# Set IAM policy

`PUT /v1/projects/{project}/agents/{agent}/iam-policy`, operation `agents.SetIamPolicy`

Replaces the IAM policy of an agent, as its owner shares it with members of the organization, such as with roles/agents.agentViewer or roles/agents.agentWriter.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `project` | path | Yes | `string` | The project's ID. |
| `agent` | path | Yes | `string` | The agent's ID. |

## Request body

Content-Type: `application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bindings` | `Binding[]` | Yes | Role bindings. Each role appears at most once. |
| `etag` | `string` | No | The etag of the policy this one replaces, as getting it returned. Without one, the policy is replaced whatever it is. |

## Responses

### 200

OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `bindings` | `Binding[]` | Yes | Role bindings. Each role appears at most once. |
| `etag` | `string` | Yes | Opaque version of the policy. Send it back when setting the policy; the update fails with aborted if the policy changed in between. |

### default

Error

Base URL: `https://api.kosem.ai`. See [API conventions](https://docs.kosem.ai/reference/api-conventions.md) for authentication, pagination and errors, and [https://docs.kosem.ai/openapi.yaml](https://docs.kosem.ai/openapi.yaml) for the full OpenAPI document.