# Skills API

## GET /api/v1/admin/skills

`GET /api/v1/admin/skills` · operation `skillInventory`

Requires skill_registry and skills:read. Admin/viewer global read; scoped console roles see only the currently published revision with explicit active team grants and active owner. Owner does not imply a grant. Scope is applied before count/page. Draft content, revision counts and unrelated grants are not exposed to scoped readers; historical requests may read only the current published revision. YAML base divergence fails closed for scoped reads. No code execution or external fetch; When skill_entitlements is enabled, a scoped reader additionally needs the skill_registry plan right on the same active membership team that supplies the published grant. Eligible teams are resolved in the same REPEATABLE READ transaction before count/page and YAML merge; only eligible grants are projected. Missing or disabled plan/binding yields an empty list or 404 for an individual read; database or serialization failure yields 503. Global readers and mutation permissions remain independent. No response grants identity, membership or execution. All responses no-store.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `search` | query | string, max length 128 |  |
| `team` | query | string, pattern `^[a-z][a-z0-9_-]{1,63}$` | Additional narrowing owner filter; never a grant |
| `limit` | query | integer, default `25`, min 1, max 100 | Most skills on this page. |
| `offset` | query | integer, default `0`, min 0, max 10000 | Skills to skip before this page. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Authorized skill metadata or explicit revision result | `application/json`: [SkillPage](/docs/api/schemas/s/#skillpage) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled or no skill/revision visible within authorized scope | — |
| `409` | Optimistic version, YAML fingerprint, immutable owner, inactive references, publication constraint or retained-history capacity conflict | — |
| `422` | Invalid bounded UTF-8 skill definition or implicit publication request | — |
| `503` | Storage or live identity authority unavailable | — |


## GET /api/v1/admin/skills/{id}

`GET /api/v1/admin/skills/{id}` · operation `skillDetail`

Requires skill_registry and skills:read. Admin/viewer global read; scoped console roles see only the currently published revision with explicit active team grants and active owner. Owner does not imply a grant. Scope is applied before count/page. Draft content, revision counts and unrelated grants are not exposed to scoped readers; historical requests may read only the current published revision. YAML base divergence fails closed for scoped reads. No code execution or external fetch; When skill_entitlements is enabled, a scoped reader additionally needs the skill_registry plan right on the same active membership team that supplies the published grant. Eligible teams are resolved in the same REPEATABLE READ transaction before count/page and YAML merge; only eligible grants are projected. Missing or disabled plan/binding yields an empty list or 404 for an individual read; database or serialization failure yields 503. Global readers and mutation permissions remain independent. No response grants identity, membership or execution. All responses no-store.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Authorized skill metadata or explicit revision result | `application/json`: [SkillDetail](/docs/api/schemas/s/#skilldetail) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled or no skill/revision visible within authorized scope | — |
| `409` | Optimistic version, YAML fingerprint, immutable owner, inactive references, publication constraint or retained-history capacity conflict | — |
| `422` | Invalid bounded UTF-8 skill definition or implicit publication request | — |
| `503` | Storage or live identity authority unavailable | — |


## PUT /api/v1/admin/skills/{id}

`PUT /api/v1/admin/skills/{id}` · operation `skillDraftSave`

Requires skill_registry, skill_management and skills:manage from a global admin. Exact canonical JSON names are required; case aliases are rejected before optimistic/lifecycle fields are decoded. Same-origin CSRF, current actor, owner/grant teams, optimistic version and exact YAML fingerprint are rechecked transactionally. JSON field names at every skill, file, provenance and mutation object must be canonical and case-sensitive; case aliases are rejected before Go decoding. Owner is immutable. Revisions and audit are retained. New drafts never publish implicitly; published grants change only with explicit publication. No network fetch, file extraction or arbitrary execution. Complete JSON request body is bounded to 524288 bytes. Unsigned drafts are accepted; with skill_signing on, a signature that is present must verify (422 invalid_skill_signature).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$` |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: [SkillWrite](/docs/api/schemas/s/#skillwrite)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Authorized skill metadata or explicit revision result | `application/json`: [SkillState](/docs/api/schemas/s/#skillstate) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled or no skill/revision visible within authorized scope | — |
| `409` | Optimistic version, YAML fingerprint, immutable owner, inactive references, publication constraint or retained-history capacity conflict | — |
| `413` | Complete JSON body exceeds 524288 bytes | — |
| `422` | Invalid bounded UTF-8 skill definition or implicit publication request | — |
| `503` | Storage or live identity authority unavailable | — |


## DELETE /api/v1/admin/skills/{id}

`DELETE /api/v1/admin/skills/{id}` · operation `skillDisableOrRevert`

Requires skill_registry, skill_management and skills:manage from a global admin. Exact canonical JSON names are required; case aliases are rejected before optimistic/lifecycle fields are decoded. Same-origin CSRF, current actor, owner/grant teams, optimistic version and exact YAML fingerprint are rechecked transactionally. JSON field names at every skill, file, provenance and mutation object must be canonical and case-sensitive; case aliases are rejected before Go decoding. Owner is immutable. Revisions and audit are retained. New drafts never publish implicitly; published grants change only with explicit publication. No network fetch, file extraction or arbitrary execution. Complete JSON request body is bounded to 16384 bytes.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$` |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: [SkillRemove](/docs/api/schemas/s/#skillremove)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Authorized skill metadata or explicit revision result | `application/json`: [SkillState](/docs/api/schemas/s/#skillstate) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled or no skill/revision visible within authorized scope | — |
| `409` | Optimistic version, YAML fingerprint, immutable owner, inactive references, publication constraint or retained-history capacity conflict | — |
| `413` | Complete JSON body exceeds 16384 bytes | — |
| `422` | Invalid bounded UTF-8 skill definition or implicit publication request | — |
| `503` | Storage or live identity authority unavailable | — |


## POST /api/v1/admin/skills/{id}/publish

`POST /api/v1/admin/skills/{id}/publish` · operation `skillPublish`

Requires skill_registry, skill_management and skills:manage from a global admin. Exact canonical JSON names are required; case aliases are rejected before optimistic/lifecycle fields are decoded. Same-origin CSRF, current actor, owner/grant teams, optimistic version and exact YAML fingerprint are rechecked transactionally. JSON field names at every skill, file, provenance and mutation object must be canonical and case-sensitive; case aliases are rejected before Go decoding. Owner is immutable. Revisions and audit are retained. New drafts never publish implicitly; published grants change only with explicit publication. No network fetch, file extraction or arbitrary execution. Complete JSON request body is bounded to 16384 bytes. With skill_signing on, the exact revision being published must carry a signature verified by a trusted key, checked inside the publish transaction (409 signature_required).

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$` |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: [SkillPublish](/docs/api/schemas/s/#skillpublish)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Authorized skill metadata or explicit revision result | `application/json`: [SkillState](/docs/api/schemas/s/#skillstate) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled or no skill/revision visible within authorized scope | — |
| `409` | Optimistic version, YAML fingerprint, immutable owner, inactive references, publication constraint or retained-history capacity conflict | — |
| `413` | Complete JSON body exceeds 16384 bytes | — |
| `422` | Invalid bounded UTF-8 skill definition or implicit publication request | — |
| `503` | Storage or live identity authority unavailable | — |


## GET /api/v1/admin/skill-submissions

`GET /api/v1/admin/skill-submissions` · operation `skillSubmissionList`

T152. Requires skill_registry, skill_management, skill_submissions and skills:read. Global admin and viewer see every submission; user, team_admin and team_viewer see only their own. Optional status (pending, scan_failed, approved, rejected), limit 1-100 (default 25) and offset 0-10000, each at most once; other parameters answer 400. Metadata, scan verdict and review outcome only, never file contents. reviewer is true for a global admin. no-store.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `status` | query | string, one of `"pending"`, `"scan_failed"`, `"approved"`, `"rejected"` |  |
| `limit` | query | integer, default `25`, min 1, max 100 |  |
| `offset` | query | integer, default `0`, min 0, max 10000 |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Submission page | `application/json`: object |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | — |
| `503` | Storage or live identity unavailable | — |

Response `200` fields:

- `application/json`: object
  - `items` (array of [SkillSubmission](/docs/api/schemas/s/#skillsubmission), required, max items 100)
  - `total` (integer, required)
  - `limit` (integer, required)
  - `offset` (integer, required)
  - `truncated` (boolean, required)
  - `reviewer` (boolean, required)


## POST /api/v1/admin/skill-submissions

`POST /api/v1/admin/skill-submissions` · operation `skillSubmissionCreate`

T152. Requires skill_submissions and skills:submit (user or team_admin of the owning team, or a global admin), same-origin CSRF. Body is exactly {skill} with published=false and disabled=false. A member may submit only for, and propose grants only to, its own active teams; an existing skill ID keeps its owner team (409). The built-in deterministic content scan (scanner builtin-v1) runs before the row is stored - passed gives status pending, otherwise scan_failed with findings (rule, file, line; never the matched text). With skill_signing on, a present signature must verify (422 invalid_skill_signature). At most 20 open submissions per submitter and 10000 in total (409 skill_capacity). Audited.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `skill` ([SkillDefinition](/docs/api/schemas/s/#skilldefinition), required)

**Responses**

| Status | Description | Body |
|---|---|---|
| `201` | Stored submission with its scan | `application/json`: [SkillSubmission](/docs/api/schemas/s/#skillsubmission) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Role, CSRF or team membership does not allow this submission | — |
| `404` | Feature disabled | — |
| `409` | Existing skill of another owner team, inactive team or capacity reached | — |
| `422` | Invalid skill, published or disabled draft, or unverifiable signature | — |
| `503` | Storage unavailable | — |


## GET /api/v1/admin/skill-submissions/{id}

`GET /api/v1/admin/skill-submissions/{id}` · operation `skillSubmissionDetail`

T152. The submission with its content, re-verified against its recorded hashes (409 skill_integrity_failed otherwise). A member sees only its own (others answer 404); global admin and viewer see all. no-store.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^sub_[a-f0-9]{24}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Submission | `application/json`: [SkillSubmission](/docs/api/schemas/s/#skillsubmission) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled or submission not visible | — |
| `409` | Stored content failed its integrity check | — |


## POST /api/v1/admin/skill-submissions/{id}/approve

`POST /api/v1/admin/skill-submissions/{id}/approve` · operation `skillSubmissionApprove`

T152. Requires skills:review (global admin), CSRF, body {version}. Only a pending submission whose scan passed, at that version, reviewed by an administrator other than its submitter (403 self_review_forbidden). In one registry transaction the scan is re-run on the exact content (409 scan_failed), skill_signing is enforced (409 signature_required), the definition is appended as a new revision and published to its grants, and the submission becomes approved with published_revision. A disabled existing skill is not re-enabled (409 skill_unavailable). Audited.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^sub_[a-f0-9]{24}$` |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 1)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Approved submission with the registry entry | `application/json`: [SkillSubmission](/docs/api/schemas/s/#skillsubmission) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Not a global admin, CSRF, or the reviewer is the submitter | — |
| `404` | Feature disabled or submission not found | — |
| `409` | Version changed, not pending, scan failed, signature required, owner conflict or capacity | — |


## POST /api/v1/admin/skill-submissions/{id}/reject

`POST /api/v1/admin/skill-submissions/{id}/reject` · operation `skillSubmissionReject`

T152. Requires skills:review (global admin), CSRF, body {version, reason} with a 1-500 character reason. Closes a pending or scan_failed submission reviewed by an administrator other than its submitter; the registry is not changed. Audited.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^sub_[a-f0-9]{24}$` |  |
| `X-CSRF-Token` | header | string, required | Token returned by admin login/session; required with the same-origin session cookie for writes. |

**Request body** (required)

- `application/json`: object
  - `version` (integer, required, min 1)
  - `reason` (string, required, min length 1, max length 500)

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Rejected submission | `application/json`: [SkillSubmission](/docs/api/schemas/s/#skillsubmission) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Not a global admin, CSRF, or the reviewer is the submitter | — |
| `404` | Feature disabled or submission not found | — |
| `409` | Version changed or submission closed | — |


## GET /api/v1/admin/skill-marketplace

`GET /api/v1/admin/skill-marketplace` · operation `skillMarketplaceSettings`

T151. Requires skill_registry and skills:read. Read-only effective feed settings - enabled (skill_marketplace), skill_marketplace.public_base_url and marketplace_url from YAML (source yaml, restart required), the marketplace name, the key scope and whether signing is required. Lists no skills. no-store.

**Authentication:** `adminSession`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Feed settings | `application/json`: object |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | — |

Response `200` fields:

- `application/json`: object
  - `enabled` (boolean, required)
  - `skill_marketplace` ([SkillMarketplaceSettings](/docs/api/schemas/s/#skillmarketplacesettings), required)
  - `marketplace_url` (string, required)
  - `marketplace_name` (string, required)
  - `source` (string, required, one of `"yaml"`)
  - `restart_required` (boolean, required)
  - `key_scope` (string, required, one of `"skills:install"`)
  - `plugin_name_rule` (string, required)
  - `signing_required` (boolean, required)


## GET /api/v1/admin/skills/{id}/versions

`GET /api/v1/admin/skills/{id}/versions` · operation `skillHistory`

Requires skill_registry and skills:read. Admin/viewer global read; scoped console roles see only the currently published revision with explicit active team grants and active owner. Owner does not imply a grant. Scope is applied before count/page. Draft content, revision counts and unrelated grants are not exposed to scoped readers; historical requests may read only the current published revision. YAML base divergence fails closed for scoped reads. No code execution or external fetch; When skill_entitlements is enabled, a scoped reader additionally needs the skill_registry plan right on the same active membership team that supplies the published grant. Eligible teams are resolved in the same REPEATABLE READ transaction before count/page and YAML merge; only eligible grants are projected. Missing or disabled plan/binding yields an empty list or 404 for an individual read; database or serialization failure yields 503. Global readers and mutation permissions remain independent. No response grants identity, membership or execution. All responses no-store.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Authorized skill metadata or explicit revision result | `application/json`: [SkillHistory](/docs/api/schemas/s/#skillhistory) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled or no skill/revision visible within authorized scope | — |
| `409` | Optimistic version, YAML fingerprint, immutable owner, inactive references, publication constraint or retained-history capacity conflict | — |
| `422` | Invalid bounded UTF-8 skill definition or implicit publication request | — |
| `503` | Storage or live identity authority unavailable | — |


## GET /api/v1/admin/skills/{id}/versions/{revision}

`GET /api/v1/admin/skills/{id}/versions/{revision}` · operation `skillRevision`

Requires skill_registry and skills:read. Admin/viewer global read; scoped console roles see only the currently published revision with explicit active team grants and active owner. Owner does not imply a grant. Scope is applied before count/page. Draft content, revision counts and unrelated grants are not exposed to scoped readers; historical requests may read only the current published revision. YAML base divergence fails closed for scoped reads. No code execution or external fetch; When skill_entitlements is enabled, a scoped reader additionally needs the skill_registry plan right on the same active membership team that supplies the published grant. Eligible teams are resolved in the same REPEATABLE READ transaction before count/page and YAML merge; only eligible grants are projected. Missing or disabled plan/binding yields an empty list or 404 for an individual read; database or serialization failure yields 503. Global readers and mutation permissions remain independent. No response grants identity, membership or execution. All responses no-store.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$` |  |
| `revision` | path | integer, required, min 0, max 100 |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Authorized skill metadata or explicit revision result | `application/json`: [SkillVersion](/docs/api/schemas/s/#skillversion) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled or no skill/revision visible within authorized scope | — |
| `409` | Optimistic version, YAML fingerprint, immutable owner, inactive references, publication constraint or retained-history capacity conflict | — |
| `422` | Invalid bounded UTF-8 skill definition or implicit publication request | — |
| `503` | Storage or live identity authority unavailable | — |


## GET /api/v1/admin/skills/{id}/bundle

`GET /api/v1/admin/skills/{id}/bundle` · operation `skillBundleDownload`

Requires skill_registry and skills:read. Admin/viewer global read; scoped console roles see only the currently published revision with explicit active team grants and active owner. Owner does not imply a grant. Scope is applied before count/page. Draft content, revision counts and unrelated grants are not exposed to scoped readers; historical requests may read only the current published revision. YAML base divergence fails closed for scoped reads. No code execution or external fetch; When skill_entitlements is enabled, a scoped reader additionally needs the skill_registry plan right on the same active membership team that supplies the published grant. Eligible teams are resolved in the same REPEATABLE READ transaction before count/page and YAML merge; only eligible grants are projected. Missing or disabled plan/binding yields an empty list or 404 for an individual read; database or serialization failure yields 503. Global readers and mutation permissions remain independent. No response grants identity, membership or execution. All responses no-store. Downloads an application/json attachment, never a ZIP or executable. nosniff and no-store apply. File hash covers sorted path/content pairs even when the grant metadata is redacted for scoped readers. T032.003 synchronization - ETag is the quoted revision content hash; If-None-Match with that tag answers 304 with no body. With skill_signing on, a revision without a verified signature answers 409 signature_required; a stored revision whose hashes no longer match answers 409 skill_integrity_failed on every read. With skill_submissions on, a revision that fails the built-in content scan answers 409 scan_failed.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$` |  |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Authorized skill metadata or explicit revision result | `application/json`: [SkillDetail](/docs/api/schemas/s/#skilldetail) |
| `304` | If-None-Match equals the current ETag (revision content hash) | — |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled or no skill/revision visible within authorized scope | — |
| `409` | Optimistic version, YAML fingerprint, immutable owner, inactive references, publication constraint or retained-history capacity conflict | — |
| `422` | Invalid bounded UTF-8 skill definition or implicit publication request | — |
| `503` | Storage or live identity authority unavailable | — |


## Installable skills feed of the key team

`GET /v1/skill-marketplace/marketplace.json` · operation `getSkillMarketplace`

T151. Requires skill_registry, skill_marketplace, skill_marketplace.public_base_url and bearer scope skills:install on a key of an active team; never anonymous. Lists the current publications granted to that team (with skill_entitlements or feature plans, the team plan must include skill_registry and skill_marketplace; with skill_signing, only verified revisions; with skill_submissions, only revisions passing the content scan) whose ID is a client plugin name (lowercase letters, digits and hyphens). Format is the coding-agent client's URL marketplace - name, owner and plugins with source archive (absolute URL under public_base_url and the archive SHA-256), version (revision.0.0+first 12 hex of the content hash) and description. Takes no query parameters. Never returns file contents, grants, owner team or authors. private, no-store.

**Authentication:** `bearerAuth`

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Marketplace catalog | `application/json`: object |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Missing skills:install scope, key without a team, or plan without the feature | — |
| `404` | Feature disabled | — |
| `503` | Storage unavailable | — |

Response `200` fields:

- `application/json`: object
  - `name` (string, required, one of `"ai-gateway"`)
  - `owner` (object, required)
    - `name` (string, required)
  - `plugins` (array of object, required, max items 1000)
    - `name` (string, required, pattern `^[a-z0-9][a-z0-9-]{0,63}$`)
    - `version` (string, required)
    - `description` (string, required)
    - `source` (object, required)
      - `source` (string, required, one of `"archive"`)
      - `url` (string (uri), required)
      - `sha256` (string, required, pattern `^[a-f0-9]{64}$`)


## Current archive of a granted skill

`GET /v1/skill-marketplace/plugins/{id}/{archive}` · operation `getSkillMarketplaceArchive`

T151. Same admission as the feed. Serves a deterministic ZIP (.claude-plugin/plugin.json with name, version and description, then the skill files byte for byte under skills/{id}/) only while {archive} is the current {sha256}.zip for the key team; a superseded, unpublished, revoked or ungranted archive answers 404. application/zip attachment, private, no-store, nosniff.

**Authentication:** `bearerAuth`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `id` | path | string, required, pattern `^[a-z0-9][a-z0-9-]{0,63}$` |  |
| `archive` | path | string, required, pattern `^[a-f0-9]{64}\\.zip$` | {sha256}.zip |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Archive whose SHA-256 equals the one in the feed | `application/zip`: string (binary) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Missing skills:install scope, key without a team, or plan without the feature | — |
| `404` | Feature disabled, or no current archive with this name and digest for the key team | — |
| `503` | Storage unavailable | — |

