# Grant agent access

`POST /v1/projects/{project}/agents/{agent}/grants`, operation `agents.GrantAgentAccess`

Grants or updates access profiles (with optional narrowing scope and expiry) and secrets on an agent.

Takes agents.secretGrants.create on the agent plus the caller's own issue/access permission on each target, and enforces agents.maxGrantTtl. Returns the agent's current grants.

## 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 |
| --- | --- | --- | --- |
| `grants` | `NewAgentGrant[]` | Yes | Access profiles or secrets to grant or update on the agent. |

## Responses

### 200

OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `grants` | `AgentGrant[]` | Yes | Grants held by the agent, oldest first. |

### 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.