# Skills

> Skills: a person's own SKILL.md files (the open format), in versions that never change. A skill belongs to the person, whichever organization they are signed in to; someone else's skill is a 404. Every write makes the next version; a write built on an old version is refused (409 `skill_version_conflict`). A file is at most 1 MiB. A person keeps at most 200 skills (409 `skill_limit`) and a skill at most 500 versions (400 `skill_version_limit`). The file starts with YAML front matter that has a `name` (1 to 64 characters of `a-z`, `0-9` and single hyphens) and a `description` (1 to 1024 characters). A file that does not is refused with a code that says why: `invalid_frontmatter`, `missing_name`, `invalid_name`, `missing_description`, `invalid_description` or `skill_too_large` (413). Export returns the file byte for byte. Load records (`/v1/skill-loads`) say which skill and version a session loaded in web chat or was delivered by a launcher; a record holds no skill text and stays when the skill is deleted. Promotions (`/v1/skill-promotions`): a person asks to share one version of their skill with the organization or a team, and an approver who is not that person approves or refuses it. The request is a copy; the skill stays the person's own.

## List skills

`GET /v1/skills`

Your skills, most recently written first. A person keeps at most 200.

Permission: `chat.use` (Every member).

### Responses

- `200` OK (application/json, SkillList)
  - `skills` (array of SkillSummary, required)
    - `id` (string, required): `skl_…`
    - `name` (string, required): The latest version's name [max length 64; pattern ^[a-z0-9]+(-[a-z0-9]+)*$]
    - `description` (string, required): The latest version's description [min length 1; max length 1024]
    - `latestVersion` (integer, required)
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required): When the latest version was written. For a library skill: when its latest approved version was approved
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/skills" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fskills)

## Create skill

`POST /v1/skills`

Create a skill from a SKILL.md: version 1. Refused with 409 `duplicate_name` when you already have a skill of that name; `error.nexus.skillId` names it. Audited as skill.created.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json, required)

- `content` (string, required): The SKILL.md: YAML front matter between `---` lines with a `name` and a `description`, then the instructions. At most 1 MiB of UTF-8. Stored exactly as written.

### Responses

- `201` Created (application/json, SkillWritten)
  - `skill` (SkillSummary, required)
    - `id` (string, required): `skl_…`
    - `name` (string, required): The latest version's name [max length 64; pattern ^[a-z0-9]+(-[a-z0-9]+)*$]
    - `description` (string, required): The latest version's description [min length 1; max length 1024]
    - `latestVersion` (integer, required)
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required): When the latest version was written. For a library skill: when its latest approved version was approved
  - `version` (SkillVersion, required)
    - `skillId` (string, required)
    - `version` (integer, required)
    - `name` (string, required): This version's name
    - `description` (string, required): This version's description
    - `contentSha256` (string, required): The SKILL.md's SHA-256, lowercase hex
    - `bytes` (integer, required): The SKILL.md's size in bytes (UTF-8)
    - `createdVia` ("web" | "cli" | "api", required): How the version was written. For a library version: how its author wrote the version that was approved
    - `createdAt` (string (date-time), required): When the version was written. For a library version: when it was approved
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 409 | `duplicate_name` | Refused with 409 `duplicate_name` when you already have a skill of that name; `error.nexus.skillId` names it |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/skills" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "<content>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fskills)

## Get skill

`GET /v1/skills/{id}`

One of your skills and its versions, newest first. Or a library skill you may load (`listSkillLibrary`), where only the versions an approver approved and did not withdraw exist.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The skill's id (`skl_…`) |

### Responses

- `200` OK (application/json, SkillDetail)
  - `id` (string, required): `skl_…`
  - `name` (string, required): The latest version's name [max length 64; pattern ^[a-z0-9]+(-[a-z0-9]+)*$]
  - `description` (string, required): The latest version's description [min length 1; max length 1024]
  - `latestVersion` (integer, required)
  - `createdAt` (string (date-time), required)
  - `updatedAt` (string (date-time), required): When the latest version was written. For a library skill: when its latest approved version was approved
  - `versions` (array of SkillVersion, required): Newest first
    - `skillId` (string, required)
    - `version` (integer, required)
    - `name` (string, required): This version's name
    - `description` (string, required): This version's description
    - `contentSha256` (string, required): The SKILL.md's SHA-256, lowercase hex
    - `bytes` (integer, required): The SKILL.md's size in bytes (UTF-8)
    - `createdVia` ("web" | "cli" | "api", required): How the version was written. For a library version: how its author wrote the version that was approved
    - `createdAt` (string (date-time), required): When the version was written. For a library version: when it was approved
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/skills/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fskills%2F%7Bid%7D)

## Delete skill

`DELETE /v1/skills/{id}`

Delete one of your skills, every version and its content, for good. Audited as skill.deleted.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The skill's id (`skl_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Responses

- `200` Deleted (application/json, SkillDeleted)
  - `deleted` (boolean, required)
  - `id` (string, required)
  - `versions` (integer, required): How many versions went with it
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X DELETE "$NEXUS_URL/v1/skills/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#delete%3A%2Fv1%2Fskills%2F%7Bid%7D)

## Write skill version

`POST /v1/skills/{id}/versions`

Write the next version of one of your skills. With `baseVersion`, refused with 409 `skill_version_conflict` when that is no longer the latest. A new `name` in the front matter renames the skill (409 `duplicate_name` when you have another of that name). Audited as skill.version_written.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The skill's id (`skl_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json, required)

- `content` (string, required): The SKILL.md: YAML front matter between `---` lines with a `name` and a `description`, then the instructions. At most 1 MiB of UTF-8. Stored exactly as written.
- `baseVersion` (integer): The version this was built on: refused with 409 `skill_version_conflict` when it is no longer the latest [min 1]

### Responses

- `201` Written (application/json, SkillWritten)
  - `skill` (SkillSummary, required)
    - `id` (string, required): `skl_…`
    - `name` (string, required): The latest version's name [max length 64; pattern ^[a-z0-9]+(-[a-z0-9]+)*$]
    - `description` (string, required): The latest version's description [min length 1; max length 1024]
    - `latestVersion` (integer, required)
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required): When the latest version was written. For a library skill: when its latest approved version was approved
  - `version` (SkillVersion, required)
    - `skillId` (string, required)
    - `version` (integer, required)
    - `name` (string, required): This version's name
    - `description` (string, required): This version's description
    - `contentSha256` (string, required): The SKILL.md's SHA-256, lowercase hex
    - `bytes` (integer, required): The SKILL.md's size in bytes (UTF-8)
    - `createdVia` ("web" | "cli" | "api", required): How the version was written. For a library version: how its author wrote the version that was approved
    - `createdAt` (string (date-time), required): When the version was written. For a library version: when it was approved
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 409 | `skill_version_conflict` | With `baseVersion`, refused with 409 `skill_version_conflict` when that is no longer the latest |
| 409 | `duplicate_name` | A new `name` in the front matter renames the skill (409 `duplicate_name` when you have another of that name) |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/skills/<id>/versions" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "<content>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fskills%2F%7Bid%7D%2Fversions)

## Get skill version

`GET /v1/skills/{id}/versions/{version}`

One version of one of your skills, with its SKILL.md. Or a library skill you may load (`listSkillLibrary`), where only the versions an approver approved and did not withdraw exist; `latest` is the newest approved one. A held, refused or withdrawn version is 404 `skill_version_not_found`, and a library skill you may not load is 404 `skill_not_found`.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The skill's id (`skl_…`) |
| `version` | path | string | yes | A version number, or `latest` |

### Responses

- `200` OK (application/json, SkillVersionDetail)
  - `skillId` (string, required)
  - `version` (integer, required)
  - `name` (string, required): This version's name
  - `description` (string, required): This version's description
  - `contentSha256` (string, required): The SKILL.md's SHA-256, lowercase hex
  - `bytes` (integer, required): The SKILL.md's size in bytes (UTF-8)
  - `createdVia` ("web" | "cli" | "api", required): How the version was written. For a library version: how its author wrote the version that was approved
  - `createdAt` (string (date-time), required): When the version was written. For a library version: when it was approved
  - `content` (string, required): The SKILL.md, exactly as it was written
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 | `skill_version_not_found` | A held, refused or withdrawn version is 404 `skill_version_not_found`, and a library skill you may not load is 404 `skill_not_found` |
| 404 | `skill_not_found` | A held, refused or withdrawn version is 404 `skill_version_not_found`, and a library skill you may not load is 404 `skill_not_found` |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/skills/<id>/versions/<version>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fskills%2F%7Bid%7D%2Fversions%2F%7Bversion%7D)

## Export skill

`GET /v1/skills/{id}/versions/{version}/export`

A version's SKILL.md exactly as it was written, byte for byte, as `text/markdown` (never rendered on the API's origin). The `ETag` is its SHA-256. A library skill you may load (`listSkillLibrary`) exports at an approved version, and `latest` is the newest approved one.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The skill's id (`skl_…`) |
| `version` | path | string | yes | A version number, or `latest` |

### Responses

- `200` The SKILL.md, `text/markdown`; the `x-nexus-skill-version` header names the version (text/markdown, string)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/skills/<id>/versions/<version>/export" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fskills%2F%7Bid%7D%2Fversions%2F%7Bversion%7D%2Fexport)

## Request skill promotion

`POST /v1/skills/{id}/versions/{version}/promotions`

Ask to promote one version of one of your skills to the organization or to a team you are in. A copy of the version is held until an approver who is not you approves or refuses it. Your skill stays yours. A repeat with the same `Idempotency-Key` within 24 hours gets the first answer and writes no second event. Audited as skill.promotion_requested, and the approvers are told.

Permission: `skills.promote` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The skill's id (`skl_…`) |
| `version` | path | string | yes | A version number, or `latest` |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json, required)

- `scope` ("org" | "team", required): The organization's library, or a team's (and the teams under it)
- `team` (string): The target team, a slug or an id. With `scope` `team` only; you must be in it
- `note` (string): Why, for the approvers [max length 500]

### Responses

- `201` Held (application/json, SkillPromotion)
  - `id` (string, required): `spr_…`
  - `state` ("held" | "approved" | "refused" | "withdrawn", required)
  - `scope` ("org" | "team", required)
  - `teamId` (string): The target team's id, for scope `team`
  - `name` (string, required): The snapshot's name: what the version said when it was requested
  - `description` (string, required): The snapshot's description
  - `contentSha256` (string, required): The snapshot's SHA-256, lowercase hex
  - `bytes` (integer, required): The snapshot's size in bytes (UTF-8)
  - `sourceSkillId` (string, required): The author's skill (`skl_…`) the snapshot was taken from
  - `sourceVersion` (integer, required) [min 1]
  - `sourceWrittenVia` ("web" | "cli" | "api", required): How that version was written
  - `sourceWrittenAt` (string (date-time), required)
  - `requestedBy` (string, required): The requester's user id
  - `requestedVia` ("web" | "cli" | "api", required)
  - `requestedAt` (string (date-time), required)
  - `note` (string) [max length 500]
  - `decidedBy` (string): The approver's user id, once it is approved or refused
  - `decidedAt` (string (date-time))
  - `decisionReason` (string) [max length 500]
  - `selfApproved` (boolean, required): Whether the approver was the requester. Always false: nobody approves their own request
  - `reviewed` (SkillPromotionReviewed): What the approver's client says they opened before they decided. Reported, not proved.
    - `content` (boolean): Opened the SKILL.md
    - `diff` (boolean): Opened the diff from the last approved version
  - `librarySkillId` (string): Once approved: the library skill (`skl_…`) this is a version of
  - `libraryVersion` (integer): Once approved: the library version [min 1]
  - `withdrawnBy` (string)
  - `withdrawnAt` (string (date-time))
  - `withdrawnReason` (string) [max length 500]
- `400` `invalid_promotion`: a field is missing, unknown or out of bounds, `team` goes with `scope` `team` only, or the note is over 500 characters (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `403` `not_in_team`: a team-scope request from someone who is not in the team; the matrix refuses a module key (`module_key`), a service account or an agent link (`role_required`) and an operator (`operator_scope`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `404` `skill_not_found`, `skill_version_not_found` or `unknown_team`: no such skill of yours, version, or team (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `409` `personal_org`: a personal organization has no one to approve; `promotion_exists`: this version already has a held or approved promotion to this target (`details` names it and its state); `promotion_limit`: you hold 20 undecided requests, or the organization 200 (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | `invalid_promotion`: a field is missing, unknown or out of bounds, `team` goes with `scope` `team` only, or the note is over 500 characters |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | `skill_not_found`, `skill_version_not_found` or `unknown_team`: no such skill of yours, version, or team |
| 409 |  | `personal_org`: a personal organization has no one to approve; `promotion_exists`: this version already has a held or approved promotion to this target (`details` names it and its state); `promotion_limit`: you hold 20 undecided requests, or the organization 200 |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/skills/<id>/versions/<version>/promotions" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "org"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fskills%2F%7Bid%7D%2Fversions%2F%7Bversion%7D%2Fpromotions)

## List skill loads

`GET /v1/skill-loads`

The load records of one of your sessions, in the order they were written: which skill and version it loaded in web chat, or was delivered by a launcher. A session that is not yours, and a session with none, answer an empty list.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `sessionId` | query | string | yes | The chat session (`chs_…`) or the agent session |
| `limit` | query | integer | no | The most records to answer |

### Responses

- `200` OK (application/json, SkillLoadList)
  - `loads` (array of SkillLoad, required)
    - `id` (string, required): `sld_…`
    - `skillId` (string, required)
    - `skillName` (string, required): The name of the version that was served
    - `version` (integer, required)
    - `contentSha256` (string, required): The SHA-256 of the SKILL.md that was served, lowercase hex. With the skill and the version it names the bytes.
    - `surface` ("web_chat" | "nexus_claude" | "nexus_codex", required)
    - `kind` ("loaded" | "delivered", required): `loaded` in web chat, `delivered` by a launcher. Never that the skill ran.
    - `sessionId` (string, required)
    - `createdAt` (string (date-time), required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/skill-loads?sessionId=%3CsessionId%3E" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fskill-loads)

## Record skill loads

`POST /v1/skill-loads`

Record that a coding agent's session was delivered some of your skills, for a launcher (`nexus claude`, `nexus codex`). Each skill must be yours, or a library skill you may load (`listSkillLibrary`), and each version must exist and, for a library skill, be approved and not withdrawn (404 `skill_not_found`, `skill_version_not_found`); the record takes the version's name and SHA-256 from what Gateway stores, not from the request, and for a library skill also its scope (`team` or `org`) and the approved promotion that allowed it. The session must be one you opened, of the agent the surface names (404 `session_not_found`). All the records are written, or none (400 `invalid_load` for a request that is not well formed). It says what was delivered, never that the skill ran.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json, required)

- `surface` ("nexus_claude" | "nexus_codex", required): The launcher: web chat's loads are written by Gateway itself
- `sessionId` (string, required): The agent session the launcher opened [min length 1; max length 128]
- `skills` (array of object, required): The skills delivered, each once: your own and the library skills you may load. A larger delivery goes in several calls, each all or none [at most 900 items]
  - `skillId` (string, required): `skl_…`
  - `version` (integer, required) [min 1]

### Responses

- `201` Recorded (application/json, SkillLoadList)
  - `loads` (array of SkillLoad, required)
    - `id` (string, required): `sld_…`
    - `skillId` (string, required)
    - `skillName` (string, required): The name of the version that was served
    - `version` (integer, required)
    - `contentSha256` (string, required): The SHA-256 of the SKILL.md that was served, lowercase hex. With the skill and the version it names the bytes.
    - `surface` ("web_chat" | "nexus_claude" | "nexus_codex", required)
    - `kind` ("loaded" | "delivered", required): `loaded` in web chat, `delivered` by a launcher. Never that the skill ran.
    - `sessionId` (string, required)
    - `createdAt` (string (date-time), required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 | `invalid_load` | All the records are written, or none (400 `invalid_load` for a request that is not well formed) |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `skill_not_found` | Each skill must be yours, or a library skill you may load (`listSkillLibrary`), and each version must exist and, for a library skill, be approved and not withdrawn (404 `skill_not_found`, `skill_version_not_found`); the record takes the version's name and SHA-256 from what Gateway stores, not from the request, and for a library skill also its scope (`team` or `org`) and the approved promotion that allowed it |
| 404 | `session_not_found` | The session must be one you opened, of the agent the surface names (404 `session_not_found`) |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/skill-loads" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "surface": "nexus_claude",
    "sessionId": "<sessionId>",
    "skills": [
      {
        "skillId": "<skillId>",
        "version": 1
      }
    ]
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fskill-loads)

## List skill library

`GET /v1/skill-library`

The library skills you may load, at the version a session loads: the highest approved version that nobody withdrew. An organization's library reaches every member, and a team's reaches that team's members and the members of the teams under it. Membership is read at each call, so a person who left a team stops seeing its library at once. The organization's skills come first, then the teams' skills, all by name (not grouped by team). Each skill says whether its name collides with another's (`duplicateName`), so a client that holds your own list too can apply the name rules without the SHA-256 of your skills. It holds no skill text: read a version with `getSkillVersion` or `exportSkill` and the library skill's `id`. A personal organization has no library, and an organization with nothing approved answers an empty list.

Permission: `chat.use` (Every member).

### Responses

- `200` OK (application/json, SkillLibraryList)
  - `skills` (array of SkillLibraryEntry, required)
    - `id` (string, required): The library skill, `skl_…`. `getSkill`, `getSkillVersion` and `exportSkill` take it
    - `name` (string, required) [max length 64; pattern ^[a-z0-9]+(-[a-z0-9]+)*$]
    - `description` (string, required) [min length 1; max length 1024]
    - `scope` ("org" | "team", required): The organization's library, or a team's (and the teams under it)
    - `teamId` (string): The team (`team_…`), for scope `team`
    - `version` (integer, required): The highest approved version that nobody withdrew: the one a session loads [min 1]
    - `approvedAt` (string (date-time), required): When that version was approved
    - `duplicateName` (boolean): Another skill of this name keeps it from loading, so neither is delivered or loaded. Left out when false. A skill of yours with this name collides too when any library skill of the name has this flag, and the library copy serves it, with the same bytes, when none has
- `403` The matrix refuses a module key (`module_key`), a service account or an agent link (`role_required`) and an operator (`operator_scope`). The domain answers any other caller that is no person with `person_required`; the matrix stops each kind first (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/skill-library" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fskill-library)

## List skill promotions

`GET /v1/skill-promotions`

The skill promotion requests you reach, newest request first: your own, those to the teams you lead and the teams under them, and for owners and admins every one. It holds no skill text.

Permission: `skills.promote` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `state` | query | "held" \| "approved" \| "refused" \| "withdrawn" | no | Only promotions in this state |
| `scope` | query | "org" \| "team" | no | Only promotions to the organization or to a team |
| `team` | query | string | no | A team slug or id: only promotions to that team |
| `mine` | query | boolean | no | `true` for the requests you made, whatever else you reach |
| `limit` | query | integer | no | Promotions per page, 1 to 200 (default 50). An empty value is no limit |
| `cursor` | query | string | no | `nextCursor` from the previous page. A cursor this API did not return answers 400 `invalid_cursor`. An empty value is no cursor |

### Responses

- `200` OK (application/json, SkillPromotionList)
  - `promotions` (array of SkillPromotion, required)
    - `id` (string, required): `spr_…`
    - `state` ("held" | "approved" | "refused" | "withdrawn", required)
    - `scope` ("org" | "team", required)
    - `teamId` (string): The target team's id, for scope `team`
    - `name` (string, required): The snapshot's name: what the version said when it was requested
    - `description` (string, required): The snapshot's description
    - `contentSha256` (string, required): The snapshot's SHA-256, lowercase hex
    - `bytes` (integer, required): The snapshot's size in bytes (UTF-8)
    - `sourceSkillId` (string, required): The author's skill (`skl_…`) the snapshot was taken from
    - `sourceVersion` (integer, required) [min 1]
    - `sourceWrittenVia` ("web" | "cli" | "api", required): How that version was written
    - `sourceWrittenAt` (string (date-time), required)
    - `requestedBy` (string, required): The requester's user id
    - `requestedVia` ("web" | "cli" | "api", required)
    - `requestedAt` (string (date-time), required)
    - `note` (string) [max length 500]
    - `decidedBy` (string): The approver's user id, once it is approved or refused
    - `decidedAt` (string (date-time))
    - `decisionReason` (string) [max length 500]
    - `selfApproved` (boolean, required): Whether the approver was the requester. Always false: nobody approves their own request
    - `reviewed` (SkillPromotionReviewed): What the approver's client says they opened before they decided. Reported, not proved.
      - `content` (boolean): Opened the SKILL.md
      - `diff` (boolean): Opened the diff from the last approved version
    - `librarySkillId` (string): Once approved: the library skill (`skl_…`) this is a version of
    - `libraryVersion` (integer): Once approved: the library version [min 1]
    - `withdrawnBy` (string)
    - `withdrawnAt` (string (date-time))
    - `withdrawnReason` (string) [max length 500]
  - `nextCursor` (string): Set while more follow: send it as `cursor` for the next page
- `400` `invalid_promotion`: a filter, `limit` or `mine` is not valid, or the query holds a name this list does not read (it reads `state`, `scope`, `team`, `mine`, `limit` and `cursor`); `invalid_cursor`: `cursor` is not one this API returned (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `403` The matrix refuses a module key (`module_key`), a service account or an agent link (`role_required`) and an operator (`operator_scope`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `404` `unknown_team`: no such team in this organization (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | `invalid_promotion`: a filter, `limit` or `mine` is not valid, or the query holds a name this list does not read (it reads `state`, `scope`, `team`, `mine`, `limit` and `cursor`); `invalid_cursor`: `cursor` is not one this API returned |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 |  | `unknown_team`: no such team in this organization |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/skill-promotions" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fskill-promotions)

## Get skill promotion

`GET /v1/skill-promotions/{id}`

One promotion request and its snapshot (`content`, the SKILL.md as the version held it), for its requester and the approvers who reach it. `previous` is the last approved version of the same library skill, with its content, for a diff; it is null when there is none or you do not load that library. Someone who only loads the library reads that version and its text; who asked for it and who approved it (`previous.promotion`) go to the approvers of it only. Anyone else, in any state, gets 404 `promotion_not_found`.

Permission: `skills.promote` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The promotion's id (`spr_…`) |

### Responses

- `200` OK (application/json, SkillPromotionDetail)
  - `id` (string, required): `spr_…`
  - `state` ("held" | "approved" | "refused" | "withdrawn", required)
  - `scope` ("org" | "team", required)
  - `teamId` (string): The target team's id, for scope `team`
  - `name` (string, required): The snapshot's name: what the version said when it was requested
  - `description` (string, required): The snapshot's description
  - `contentSha256` (string, required): The snapshot's SHA-256, lowercase hex
  - `bytes` (integer, required): The snapshot's size in bytes (UTF-8)
  - `sourceSkillId` (string, required): The author's skill (`skl_…`) the snapshot was taken from
  - `sourceVersion` (integer, required) [min 1]
  - `sourceWrittenVia` ("web" | "cli" | "api", required): How that version was written
  - `sourceWrittenAt` (string (date-time), required)
  - `requestedBy` (string, required): The requester's user id
  - `requestedVia` ("web" | "cli" | "api", required)
  - `requestedAt` (string (date-time), required)
  - `note` (string) [max length 500]
  - `decidedBy` (string): The approver's user id, once it is approved or refused
  - `decidedAt` (string (date-time))
  - `decisionReason` (string) [max length 500]
  - `selfApproved` (boolean, required): Whether the approver was the requester. Always false: nobody approves their own request
  - `reviewed` (SkillPromotionReviewed): What the approver's client says they opened before they decided. Reported, not proved.
    - `content` (boolean): Opened the SKILL.md
    - `diff` (boolean): Opened the diff from the last approved version
  - `librarySkillId` (string): Once approved: the library skill (`skl_…`) this is a version of
  - `libraryVersion` (integer): Once approved: the library version [min 1]
  - `withdrawnBy` (string)
  - `withdrawnAt` (string (date-time))
  - `withdrawnReason` (string) [max length 500]
- `403` The matrix refuses a module key (`module_key`), a service account or an agent link (`role_required`) and an operator (`operator_scope`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `404` `promotion_not_found`: no such promotion in your reach (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | `promotion_not_found`: no such promotion in your reach |
| 404 | `promotion_not_found` | Anyone else, in any state, gets 404 `promotion_not_found` |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/skill-promotions/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fskill-promotions%2F%7Bid%7D)

## Decide skill promotion

`POST /v1/skill-promotions/{id}/decision`

Approve or refuse a held promotion. An owner or admin decides for the organization; a lead of the team or of a team above it, an owner or an admin decides for a team. Never the requester, and only from a Nexus UI session or a CLI sign-in, not an API key. An approval adds the version to the library of its scope and tells the requester; a refusal needs a `reason`. Audited as skill.promotion_approved or skill.promotion_refused. A repeat with the same `Idempotency-Key` within 24 hours gets the first answer; a repeat without one gets 409 `promotion_decided`.

Permission: `skills.approve_team` (Owner, Admin, Team lead).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The promotion's id (`spr_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json, required)

- `decision` ("approved" | "refused", required)
- `reason` (string): Required to refuse, so the author knows what to change [max length 500]
- `reviewed` (SkillPromotionReviewed): What the approver's client says they opened before they decided. Reported, not proved.
  - `content` (boolean): Opened the SKILL.md
  - `diff` (boolean): Opened the diff from the last approved version

### Responses

- `200` Decided (application/json, SkillPromotion)
  - `id` (string, required): `spr_…`
  - `state` ("held" | "approved" | "refused" | "withdrawn", required)
  - `scope` ("org" | "team", required)
  - `teamId` (string): The target team's id, for scope `team`
  - `name` (string, required): The snapshot's name: what the version said when it was requested
  - `description` (string, required): The snapshot's description
  - `contentSha256` (string, required): The snapshot's SHA-256, lowercase hex
  - `bytes` (integer, required): The snapshot's size in bytes (UTF-8)
  - `sourceSkillId` (string, required): The author's skill (`skl_…`) the snapshot was taken from
  - `sourceVersion` (integer, required) [min 1]
  - `sourceWrittenVia` ("web" | "cli" | "api", required): How that version was written
  - `sourceWrittenAt` (string (date-time), required)
  - `requestedBy` (string, required): The requester's user id
  - `requestedVia` ("web" | "cli" | "api", required)
  - `requestedAt` (string (date-time), required)
  - `note` (string) [max length 500]
  - `decidedBy` (string): The approver's user id, once it is approved or refused
  - `decidedAt` (string (date-time))
  - `decisionReason` (string) [max length 500]
  - `selfApproved` (boolean, required): Whether the approver was the requester. Always false: nobody approves their own request
  - `reviewed` (SkillPromotionReviewed): What the approver's client says they opened before they decided. Reported, not proved.
    - `content` (boolean): Opened the SKILL.md
    - `diff` (boolean): Opened the diff from the last approved version
  - `librarySkillId` (string): Once approved: the library skill (`skl_…`) this is a version of
  - `libraryVersion` (integer): Once approved: the library version [min 1]
  - `withdrawnBy` (string)
  - `withdrawnAt` (string (date-time))
  - `withdrawnReason` (string) [max length 500]
- `400` `invalid_promotion`: a field is missing, unknown or out of bounds, or a refusal has no `reason` (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `403` `role_required`: only an owner, an admin or a team lead decides; `person_session_required`: an API key cannot decide, run `nexus auth login`; `self_approval`: nobody approves their own request; the matrix refuses a module key (`module_key`), a service account or an agent link (`role_required`) and an operator (`operator_scope`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `404` `promotion_not_found`: no such promotion in your reach (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `409` `promotion_decided`: the promotion is no longer held (`details` names its state); `requester_left`: the requester is no longer a member; `team_deleted`: the target team no longer exists; `name_taken`: an approval would give people two library skills of one name (`details` names the scope and team); `library_limit`: the library holds its most skills, or the skill its most versions (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | `invalid_promotion`: a field is missing, unknown or out of bounds, or a refusal has no `reason` |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | `promotion_not_found`: no such promotion in your reach |
| 409 |  | `promotion_decided`: the promotion is no longer held (`details` names its state); `requester_left`: the requester is no longer a member; `team_deleted`: the target team no longer exists; `name_taken`: an approval would give people two library skills of one name (`details` names the scope and team); `library_limit`: the library holds its most skills, or the skill its most versions |
| 409 | `promotion_decided` | A repeat with the same `Idempotency-Key` within 24 hours gets the first answer; a repeat without one gets 409 `promotion_decided` |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/skill-promotions/<id>/decision" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "decision": "approved"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fskill-promotions%2F%7Bid%7D%2Fdecision)

## Withdraw skill promotion

`POST /v1/skill-promotions/{id}/withdraw`

Withdraw a promotion. The requester withdraws their own held request; an approver who reaches it withdraws a held one, or an approved version (from a Nexus UI session or a CLI sign-in). The version leaves its library; text a model already read stays read. With `allVersions`, every approved version of that library skill is withdrawn in one transaction, each with its own event. The answer names the promotion and, in `withdrawnIds`, every promotion withdrawn. Audited as skill.promotion_withdrawn. The requester is told, unless they withdrew it themselves.

Permission: `skills.promote` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The promotion's id (`spr_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json)

- `reason` (string) [max length 500]
- `allVersions` (boolean): Withdraw every approved version of the promotion's library skill. Name an approved version [default false]

### Responses

- `200` Withdrawn (application/json, SkillPromotionWithdrawn)
  - `id` (string, required): `spr_…`
  - `state` ("held" | "approved" | "refused" | "withdrawn", required)
  - `scope` ("org" | "team", required)
  - `teamId` (string): The target team's id, for scope `team`
  - `name` (string, required): The snapshot's name: what the version said when it was requested
  - `description` (string, required): The snapshot's description
  - `contentSha256` (string, required): The snapshot's SHA-256, lowercase hex
  - `bytes` (integer, required): The snapshot's size in bytes (UTF-8)
  - `sourceSkillId` (string, required): The author's skill (`skl_…`) the snapshot was taken from
  - `sourceVersion` (integer, required) [min 1]
  - `sourceWrittenVia` ("web" | "cli" | "api", required): How that version was written
  - `sourceWrittenAt` (string (date-time), required)
  - `requestedBy` (string, required): The requester's user id
  - `requestedVia` ("web" | "cli" | "api", required)
  - `requestedAt` (string (date-time), required)
  - `note` (string) [max length 500]
  - `decidedBy` (string): The approver's user id, once it is approved or refused
  - `decidedAt` (string (date-time))
  - `decisionReason` (string) [max length 500]
  - `selfApproved` (boolean, required): Whether the approver was the requester. Always false: nobody approves their own request
  - `reviewed` (SkillPromotionReviewed): What the approver's client says they opened before they decided. Reported, not proved.
    - `content` (boolean): Opened the SKILL.md
    - `diff` (boolean): Opened the diff from the last approved version
  - `librarySkillId` (string): Once approved: the library skill (`skl_…`) this is a version of
  - `libraryVersion` (integer): Once approved: the library version [min 1]
  - `withdrawnBy` (string)
  - `withdrawnAt` (string (date-time))
  - `withdrawnReason` (string) [max length 500]
- `400` `invalid_promotion`: a field is unknown or out of bounds, or `allVersions` names a held request (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `403` `person_session_required`: withdrawing an approved version needs a Nexus UI session or a CLI sign-in; `role_required`: the caller asks to withdraw an approved version and is not an approver of it (its requester gets this); the matrix refuses a module key (`module_key`), a service account or an agent link (`role_required`) and an operator (`operator_scope`) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `404` `promotion_not_found`: no such promotion in your reach (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `409` `promotion_decided`: the promotion was refused or is already withdrawn (`details` names its state) (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | `invalid_promotion`: a field is unknown or out of bounds, or `allVersions` names a held request |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | `promotion_not_found`: no such promotion in your reach |
| 409 |  | `promotion_decided`: the promotion was refused or is already withdrawn (`details` names its state) |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/skill-promotions/<id>/withdraw" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "<reason>",
    "allVersions": false
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fskill-promotions%2F%7Bid%7D%2Fwithdraw)
