Skip to Content
kosemdocs
ReferenceAPIAgents

Grant agent secrets

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.

POST
/v1/projects/{project}/agents/{agent}/secretGrants

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.

Authorization

bearer
headerAuthorizationBearer <token>

An access token, or an API key.

Path Parameters

project*string

The project's ID.

Match^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$
agent*string

The agent's ID.

Match^ags_[0-7][0-9a-hjkmnp-tv-z]{25}$

Request Body

application/json
  1. body
secrets*array<string>

The secrets of the agent's project, as projects/{project_id}/secrets/{secret_id}.

Items1 <= items <= 100

Response Body

OK

application/json
  1. response
secretGrants*array<>

The agent's grants, the oldest first.

Example Request
curl -X POST 'https://api.kosem.ai/v1/projects/string/agents/string/secretGrants' \
  -H 'Content-Type: application/json' \
  -d '{
  "secrets": [
    "string"
  ]
}'
Example Response
{
  "secretGrants": [
    {
      "createTime": "2019-08-24T14:15:22Z",
      "grantor": "string",
      "secret": "string"
    }
  ]
}