# API reference: skills

Robot skills: what a robot can be asked to do. Each skill runs one reflex policy, and a person installs each version. The range of every input is the range the robot's sim tests passed.

## GET /v1/robots/{owner}/{repo}/skills

`listRobotSkills` · scope `none` · List what a robot can be asked to do

Returns the robot's skills: `stand`, `walk`, `turn` and `recover`, each with its inputs, its pre- and post-conditions, its fallback skill and the version a person installed. An input's allowed range is the range the robot's sim tests passed. The hub derives it from the stored results, and nobody types it in. A skill with no installed version is listed when a version waits for a person. A robot the caller cannot see is 404. Answers 409 if the repo kind is not `robot`.

Parameters:

- `owner` (path, required): Repo owner handle (username or org slug).
- `repo` (path, required): Repo slug. A renamed repo's former slug also finds it, and the answer names its current address.

Responses:

- `200`: The robot's skills.
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).

## GET /v1/robots/{owner}/{repo}/skills/{skill}

`getRobotSkill` · scope `none` · Get one skill with its version history

Returns one skill and every version proposed for it, newest first. Each version names the policy file it runs, the range each input may take, and the sim tests that range rests on. The answer is 404 when the robot is invisible to the caller or no version of this skill was proposed.

Parameters:

- `owner` (path, required): Repo owner handle (username or org slug).
- `repo` (path, required): Repo slug. A renamed repo's former slug also finds it, and the answer names its current address.
- `skill` (path, required): The skill's name.

Responses:

- `200`: The skill and its versions.
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).

## POST /v1/robots/{owner}/{repo}/skills/{skill}/versions

`proposeRobotSkillVersion` · scope `key:write` · Propose a policy as the next version of a skill

Proposes one policy file as the next version of this skill on this robot. The caller must be able to write the robot. The hub reads the file's stamp and its sim tests on this robot, then derives the version's envelope. The envelope holds the range of each input and the fallen starts a recovery passed. Each of these is a 422:

- the policy is not a `reflex` policy
- its stamp fills another skill's slot (`STAND` is `stand`, `LOCO` is `walk` or `turn`, `RECOVERY` is `recover`)
- no finished sim test of these bytes on this robot passed a test this skill reads

A sim test counts when the hub ran it, or when a writer of the robot started it. A test the policy's writers ran on their own machine does not count on another owner's robot. The version waits as `proposed` until a person installs it with `installRobotSkillVersion`. Proposing the same bytes again refreshes the waiting version's envelope and answers 200. Audited as `skill.propose`.

Parameters:

- `owner` (path, required): Repo owner handle (username or org slug).
- `repo` (path, required): Repo slug. A renamed repo's former slug also finds it, and the answer names its current address.
- `skill` (path, required): The skill's name.

Request body: `application/json`, required.

Responses:

- `200`: The waiting version for these bytes, with its envelope refreshed.
- `201`: The new version, waiting for a person.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).
- `422`: Request failed validation.

## POST /v1/robots/{owner}/{repo}/skills/{skill}/versions/{version}/install

`installRobotSkillVersion` · scope `session` · Install a skill version (web session only)

**`session` scope: a person signed in to the web app. No API key of any scope can call this.** The person must be able to write the robot. `envelope_digest` names the envelope the person read. A version whose envelope changed since is `409`. The version becomes the skill's installed one, and the one it replaces becomes `superseded`. A computer running the bridge picks it up the next time a person adds the robot there. `409` when the version is not `proposed`. Audited as `skill.install`.

Parameters:

- `owner` (path, required): Repo owner handle (username or org slug).
- `repo` (path, required): Repo slug. A renamed repo's former slug also finds it, and the answer names its current address.
- `skill` (path, required): The skill's name.
- `version` (path, required): The version number, from 1.

Request body: `application/json`, required.

Responses:

- `200`: The skill, with this version installed.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).
- `422`: Request failed validation.

## POST /v1/robots/{owner}/{repo}/skills/{skill}/versions/{version}/decline

`declineRobotSkillVersion` · scope `session` · Decline a proposed skill version (web session only)

**`session` scope.** A person who can write the robot declines a waiting version, with a reason the proposer reads. The installed version stays as it was. `409` when the version is not `proposed`. Audited as `skill.decline`.

Parameters:

- `owner` (path, required): Repo owner handle (username or org slug).
- `repo` (path, required): Repo slug. A renamed repo's former slug also finds it, and the answer names its current address.
- `skill` (path, required): The skill's name.
- `version` (path, required): The version number, from 1.

Request body: `application/json`, required.

Responses:

- `200`: The skill, with this version declined.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).
