---
title: "Sets a skill's env-var/key associations and target tools."
method: POST
path: "/agents/skill_association"
tags: ["Agents"]
---

# Sets a skill's env-var/key associations and target tools.

`POST /agents/skill_association`

## Request

- Base URL: `https://h2ogpte.genai.h2o.ai/api/v1`
- URL: `https://h2ogpte.genai.h2o.ai/api/v1/agents/skill_association`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/h2o/apis/h2ogpte-rest-api/docs/agents/skill_association/post.ts> (a function with typed inputs; its response is checked against the schema)

Associates the skill's declared env vars (from envs.json) with agent keys and selects which executors receive those env vars when the skill is selected. Only python and shell are supported; both are selected when none are given.

## Request body

- SetSkillAssociationsRequest
  - `skill_id` string, required
  - `keys` SkillKeyInput[]
    - `name` string, required: Env var name (must be declared in the skill's envs.json).
    - `key_id` string, nullable: Agent key id to bind, or null/empty to clear.
  - `tools` string[]: Executors that receive the skill's env vars; only python and shell are accepted, empty defaults to both.

## Response `200`

Successful operation

- SetSkillAssociationsResponse
  - `count` integer: Number of env-var associations upserted.
  - `tools` string[]: The resulting target-tool set.

## Other responses

- `400`: Bad request
- `401`: Unauthorized - Invalid or missing API key
- `403`: Forbidden
- `500`: Internal server error
- `default`: Unexpected error

---

[API](https://skmtc.dev/h2o/apis/h2ogpte-rest-api.md) - [All operations](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/revisions/a82a117320f4?raw)
