# Grant agent secrets

`POST /v1/projects/{project}/agents/{agent}/secretGrants`, operation `agents.GrantAgentSecrets`

Lets an agent use secrets of its project. A secret it already has keeps its grant.

Each takes the caller's own access to the secret (secrets.versions.access). The agent gets no role on it, and keeps its grant if the caller later loses that access. A grant lasts until an owner of the agent removes it with RemoveAgentSecretGrant, or the agent or the secret is deleted. Whoever writes to the agent can then use the secret and read its value.

## 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 |
| --- | --- | --- | --- |
| `secrets` | `string[]` | Yes | The secrets of the agent's project, as projects/{project_id}/secrets/{secret_id}. |

## Responses

### 200

OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `secretGrants` | `AgentSecretGrant[]` | Yes | The agent's grants, the 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.