# Knowledge and skills

Manage the knowledge catalogue, custom skills and macros, and move skills in and out of a workspace as portable documents.

The **knowledge catalogue** lists the named sources your workspace has recorded for each knowledge layer. An agent that has a layer switched on is told which sources in that layer it may draw on. A catalogue entry is a record with a name, a description and an owner; these endpoints do not upload documents or connect a data provider.

The **skills catalogue** holds the reusable instructions that agents apply: built-in skills that ship with the platform, custom skills that belong to your workspace, and macros that chain skills into one ordered playbook. Skills can be exported as portable documents and imported from a file or from a public GitHub folder through a preview-then-commit flow.

Reading either catalogue and exporting skills needs an API key with the `read` scope. Creating, changing, deleting and importing need the `admin` scope. A signed-in workspace member can call every endpoint on this page. See [authentication](https://centerofagentic.com/docs/authentication) for how to send a key and [errors](https://centerofagentic.com/docs/api/errors) for the shared error format.

## Knowledge catalogue

Named sources grouped by knowledge layer. There are five fixed layers (`domain`, `tenant`, `role`, `user`, `task`) and a workspace can hold up to 300 sources.

### GET /api/knowledge

List knowledge layers and sources

Returns the five layer definitions and every source in the workspace catalogue. The list is not paginated.

**Access:** API key with the `read` scope, or a signed-in workspace member.

**Returns:** An object with `layers` (each with `key`, `label`, `scope` and `blurb`) and `sources` (each with `id`, `layer`, `name`, `description`, `owner` and `updatedAt`). `owner` and `updatedAt` can be empty strings on older entries.

```bash
curl https://centerofagentic.com/api/knowledge \
  -H "Authorization: Bearer $COA_API_KEY"
```

```json
{
  "layers": [
    { "key": "domain", "label": "Domain knowledge", "scope": "Shared", "blurb": "Reference packs, definitions, and best practices for the agent's domain." },
    { "key": "tenant", "label": "Company knowledge", "scope": "Company", "blurb": "Approved sources connected from your organization." },
    { "key": "role", "label": "Role & team", "scope": "Role-scoped", "blurb": "Access scoped to the user's role, team, and permissions." },
    { "key": "user", "label": "User context", "scope": "Private", "blurb": "The individual user's preferences, history, and private notes." },
    { "key": "task", "label": "Task context", "scope": "Task only", "blurb": "Files and instructions for the task at hand." }
  ],
  "sources": [
    {
      "id": "ks_3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11",
      "layer": "tenant",
      "name": "Brand guidelines 2026",
      "description": "Approved tone of voice and visual rules.",
      "owner": "Marketing operations",
      "updatedAt": "2026-11-28T10:15:00.000Z"
    }
  ]
}
```

### POST /api/knowledge

Add a knowledge source

Adds a source to one layer. The server issues the `id` and sets `updatedAt`; neither can be supplied.

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `layer` required | `"domain" \| "tenant" \| "role" \| "user" \| "task"` | The knowledge layer the source belongs to. |
| `name` required | `string` | Display name. Leading and trailing spaces are removed and longer values are cut to 100 characters. |
| `description` | `string` | What the source contains. Cut to 200 characters. |
| `owner` | `string` | Who is accountable for the source, as free text. Cut to 120 characters. Defaults to the identifier of the calling credential. |

**Returns:** The created source: `{ id, layer, name, description, owner, updatedAt }`. The status is 200.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid` | `name` is missing or empty, or `layer` is not one of the five layer keys. |
| 400 | `limit` | The workspace already has 300 knowledge sources. Remove one first. |

```bash
curl -X POST https://centerofagentic.com/api/knowledge \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"layer":"tenant","name":"Brand guidelines 2026","description":"Approved tone of voice and visual rules.","owner":"Marketing operations"}'
```

```json
{
  "id": "ks_3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11",
  "layer": "tenant",
  "name": "Brand guidelines 2026",
  "description": "Approved tone of voice and visual rules.",
  "owner": "Marketing operations",
  "updatedAt": "2026-11-28T10:15:00.000Z"
}
```

### PATCH /api/knowledge/{id}

Update a knowledge source

Send only the fields to change. `updatedAt` is set by the server on every update, and an empty `owner` keeps the current owner.

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `string` | Source id, for example `ks_3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11`. |

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `layer` | `"domain" \| "tenant" \| "role" \| "user" \| "task"` | Move the source to another layer. |
| `name` | `string` | New display name; cannot be empty. Cut to 100 characters. |
| `description` | `string` | New description. Cut to 200 characters. |
| `owner` | `string` | New owner. Cut to 120 characters. |

**Returns:** The updated source: `{ id, layer, name, description, owner, updatedAt }`.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 404 | `not_found` | No source in the workspace has this id, or it was removed while the update was in progress. |
| 400 | `invalid` | The change would leave the source without a name or with an unknown layer. |

### DELETE /api/knowledge/{id}

Remove a knowledge source

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `string` | Source id. |

**Returns:** `{ "ok": true }`.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 404 | `not_found` | No source in the workspace has this id. |

## Skills catalogue

Built-in skills are read-only and have ids that start with `builtin:`. Custom skills have ids that start with `skill_` and carry a `revision` that increases with every saved change; to edit or delete one you send the revision you last read, and a request based on an older revision is refused instead of overwriting the newer change. A workspace can hold up to 200 custom skills.

### GET /api/skills

List skills and macros

Returns the built-in skills first, then the workspace's custom skills, and all macros. The response is not paginated and includes the full instruction text of every skill.

**Access:** API key with the `read` scope, or a signed-in workspace member.

**Returns:** An object with `skills` and `macros`. Every skill has `id`, `name`, `category`, `description`, `instructions` and `builtin`; skills bound to a connector add `integration` (`provider`, `toolMatch`). Custom skills also carry `revision`, `digest` (when known), `provenance` (who created and last changed the skill, and an `origin` of `manual`, `copy` or `import`, or `legacy` for skills saved before origins were recorded) and, for imported skills, `importInfo`. Each macro has `id`, `name`, `description` and `steps`.

```bash
curl https://centerofagentic.com/api/skills \
  -H "Authorization: Bearer $COA_API_KEY"
```

```json
{
  "skills": [
    {
      "id": "builtin:source-freshness-check",
      "name": "Source freshness check",
      "category": "Compliance",
      "description": "Verifies data recency before it is used.",
      "instructions": "Before relying on a source, check its date/version. If it is stale or undated, say so and lower your confidence. Prefer the most recent approved source.",
      "builtin": true
    },
    {
      "id": "skill_3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11",
      "name": "Quarterly report review",
      "category": "Reporting",
      "description": "Checks a quarterly report for unsupported figures.",
      "instructions": "Read every section. List each figure that has no stated source.",
      "builtin": false,
      "revision": 1,
      "digest": "8b20d135815a3e690946e8324c2d7887db56c2669a249848f9ba992efbe82884",
      "provenance": {
        "origin": "manual",
        "createdBy": "api-key:7a1e4c2b-5d3f-4a68-8b90-2c4d6e8f0a12",
        "createdAt": "2026-11-28T10:15:00.123456+00:00",
        "updatedBy": "api-key:7a1e4c2b-5d3f-4a68-8b90-2c4d6e8f0a12",
        "updatedAt": "2026-11-28T10:15:00.123456+00:00"
      }
    }
  ],
  "macros": [
    {
      "id": "mac_5b2d4f6a-8c1e-4d3b-9f70-1a2b3c4d5e6f",
      "name": "Report pack",
      "description": "Review the report, then write the summary.",
      "steps": [
        { "skillId": "skill_3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11" },
        { "skillId": "builtin:executive-writing", "note": "Keep it under 150 words." }
      ]
    }
  ]
}
```

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

Get a skill with its dependencies and change history

Works for built-in and custom skills. Use it to read the current `revision` and `digest` before an update, delete or export, and to see what still refers to a skill before you rename or delete it. Earlier instruction text is not kept, so `history` records that a change happened, not what the text was.

**Access:** API key with the `read` scope, or a signed-in workspace member.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `string` | Skill id: `builtin:…` for a built-in skill or `skill_…` for a custom skill. |

**Returns:** An object with `skill`, `dependencies` and `history`. `dependencies` holds `draftAgents` (agents whose current configuration selects the skill: `id`, `name`), `macros` (`id`, `name`) and `activeVersions` (activated agent versions that captured the skill: `agentId`, `versionId`, `name`), each capped at 50 entries, plus `totals` with the full counts and a `truncated` flag. `history` holds up to 50 of the most recent change events, newest first, each with `action`, `actor`, `createdAt`, `revisionBefore`, `revisionAfter`, `digestBefore` and `digestAfter`. `createdAt` is a date-time string that is not guaranteed to be ISO 8601, so parse it leniently.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 404 | `not_found` | No built-in or workspace skill has this id. |

### POST /api/skills

Create a custom skill

Saves a new custom skill at revision 1. Only the fields below are accepted; any other field is rejected. Nothing is shortened to fit a limit: a request that exceeds one fails and saves nothing.

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `name` required | `string` | Display name, at most 80 characters. It cannot match the name of a built-in skill or another custom skill, ignoring case. |
| `category` | `string` | Free-text category of at most 40 characters. Defaults to `Custom`. |
| `description` | `string` | Short summary of at most 1,024 characters. |
| `instructions` | `string` | The instruction text an agent receives when the skill is selected. All authored text of a skill together is limited to 64 KiB of UTF-8. |
| `integration` | `object` | Optional binding to a connector, used to narrow the connector's tools to what this skill needs. |
| `integration.provider` required | `string` | Required when `integration` is sent. Connector provider key of 1 to 40 characters, for example `jira`. |
| `integration.toolMatch` required | `string[]` | Required when `integration` is sent; it can be an empty array. Up to 12 keywords of at most 128 characters each. Stored trimmed, in lower case and without duplicates. |

**Returns:** The saved skill with a server-issued `id`, `builtin: false`, `revision: 1`, a content `digest` and `provenance`. The status is 200.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_skill` | A field is missing, malformed or not writable. The response lists each problem in `issues` as `{ field, message }`. |
| 409 | `name_conflict` | A built-in or workspace skill already uses the name. |
| 409 | `catalog_limit` | The workspace already has 200 custom skills. |
| 413 | `skill_too_large` | The authored text exceeds 64 KiB of UTF-8. |
| 409 | `catalog_busy` | The catalogue kept changing while the request was being saved. Nothing was saved; send the request again. |

```bash
curl -X POST https://centerofagentic.com/api/skills \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Quarterly report review","category":"Reporting","description":"Checks a quarterly report for unsupported figures.","instructions":"Read every section. List each figure that has no stated source."}'
```

```json
{
  "id": "skill_3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11",
  "name": "Quarterly report review",
  "category": "Reporting",
  "description": "Checks a quarterly report for unsupported figures.",
  "instructions": "Read every section. List each figure that has no stated source.",
  "builtin": false,
  "revision": 1,
  "digest": "8b20d135815a3e690946e8324c2d7887db56c2669a249848f9ba992efbe82884",
  "provenance": {
    "origin": "manual",
    "createdBy": "api-key:7a1e4c2b-5d3f-4a68-8b90-2c4d6e8f0a12",
    "createdAt": "2026-11-28T10:15:00.123456+00:00",
    "updatedBy": "api-key:7a1e4c2b-5d3f-4a68-8b90-2c4d6e8f0a12",
    "updatedAt": "2026-11-28T10:15:00.123456+00:00"
  }
}
```

### PATCH /api/skills/{id}

Update a custom skill

Send `expectedRevision` plus only the fields to change. A successful update raises `revision` by one and issues a new `digest`. A rename is refused while an agent's configuration or a macro still uses the skill. Editing an imported skill creates a new revision, so it has to be reviewed again before agents can use it.

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `string` | Id of a custom skill (`skill_…`). |

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `expectedRevision` required | `integer` | The `revision` from your latest read of the skill. |
| `name` | `string` | New display name, at most 80 characters. |
| `category` | `string` | New category, at most 40 characters. |
| `description` | `string` | New description, at most 1,024 characters. |
| `instructions` | `string` | New instruction text. |
| `integration` | `object \| null` | New connector binding (`provider`, `toolMatch`). Leave it out to keep the current binding, or send `null` to remove it. |

**Returns:** The saved skill, in the same shape as the create response, with the new `revision` and `digest`.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `revision_required` | `expectedRevision` is missing or not a non-negative integer. |
| 400 | `invalid_skill` | A field is malformed or not writable; see `issues`. |
| 404 | `not_found` | No custom skill in the workspace has this id. Built-in skills cannot be changed. |
| 409 | `stale_skill` | `expectedRevision` is no longer the current revision. Read the skill again and reapply your change. |
| 409 | `name_conflict` | Another skill already uses the new name. |
| 409 | `skill_in_use` | The request renames a skill that agents or macros still refer to. The response includes `dependencies`. |
| 413 | `skill_too_large` | The authored text would exceed 64 KiB of UTF-8. |
| 400 | `credential` | The skill was imported and the changed content matches a credential pattern. |

```bash
curl -X PATCH https://centerofagentic.com/api/skills/skill_3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11 \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"expectedRevision":1,"instructions":"Read every section. List each figure that has no stated source, with its page number."}'
```

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

Delete a custom skill

The request needs a JSON body. Macros that use the skill are not rewritten: they keep the step, which no longer resolves to a skill, until you edit the macro. Agent versions that were already activated keep the copy they captured.

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `string` | Id of a custom skill (`skill_…`). |

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `expectedRevision` required | `integer` | The `revision` from your latest read of the skill. No other field is accepted. |

**Returns:** `{ "ok": true }`.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `revision_required` | `expectedRevision` is missing or not a non-negative integer. |
| 404 | `not_found` | No custom skill in the workspace has this id. Built-in skills cannot be deleted. |
| 409 | `stale_skill` | `expectedRevision` is no longer the current revision. |

### POST /api/skills/{id}/copy

Copy a built-in skill into an editable custom skill

Creates a separate custom skill that starts from a built-in definition. The built-in skill stays unchanged, and the copy does not follow later changes to it.

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `string` | Id of a built-in skill, for example `builtin:executive-writing`. |

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `name` required | `string` | Name for the copy. It cannot reuse the built-in name or the name of any other skill. |
| `category` | `string` | Overrides the built-in category. |
| `description` | `string` | Overrides the built-in description. |
| `instructions` | `string` | Overrides the built-in instructions. |
| `integration` | `object \| null` | Overrides the built-in connector binding (`provider`, `toolMatch`). Send `null` to create the copy without a binding. |

**Returns:** The new custom skill at `revision: 1`. Its `provenance.origin` is `copy` and `provenance.copiedFrom` holds the `id`, `name` and `digest` of the built-in skill. The status is 200.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 404 | `not_found` | The id is not a built-in skill. |
| 400 | `invalid_skill` | `name` is missing, or a field is malformed or not writable. |
| 409 | `name_conflict` | A built-in or workspace skill already uses the name. |
| 409 | `catalog_limit` | The workspace already has 200 custom skills. |

### POST /api/skills/draft

Draft skill instructions with the workspace model

**Status: Gated.** Shipped, but closed until a switch described on this page is turned on.

Asks the workspace's default model to write two to four sentences of instructions for a named skill. Nothing is saved: pass the returned text to the create or update endpoint. The call uses the workspace's model provider key and is refused when the workspace is over its monthly budget. Send the `X-CoA-Model-Request` header with every request: once an approved model profile lets the model call through, a request without it is refused with `503 model_usage_request_identity_required`.

**Access:** API key with the `admin` scope, or a signed-in workspace member. Refused with 403 until a workspace admin has approved a model profile that covers skill drafting, has not expired and lists the workspace's default model. Settings has no screen for recording a profile today and an API key cannot record one, so expect this call to answer `403` with `system_model_profile_unavailable` unless your workspace admin confirms that a profile is in place. The workspace also needs a model provider key.

**Request headers**

| Name | Type | Description |
| --- | --- | --- |
| `X-CoA-Model-Request` | `string` | The current Unix time in milliseconds (13 digits), a dot and a UUID that you generate, new for each request; it identifies the request for usage accounting. Send it on every request: once an approved model profile lets the model call through, a request without it is refused with `503 model_usage_request_identity_required` before any model call. See [The usage-request header](https://centerofagentic.com/docs/guides/troubleshooting#usage-request-header). |

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `name` required | `string` | Name of the skill to draft instructions for. |
| `description` | `string` | Optional summary that gives the model more context. |

**Returns:** `{ instructions }`: the drafted text, at most 2,000 characters. It can be an empty string when no draft could be produced.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid` | `name` is missing or empty. |
| 402 | `over_budget` | The workspace is over its monthly spend budget. |
| 400 | `no_model_key` | The workspace has no model provider key. |
| 403 | `system_model_profile_unavailable` | No approved, unexpired model profile covers skill drafting. No model request was sent. |
| 403 | `system_model_not_permitted` | The approved profile does not list the workspace's default model. No model request was sent. |
| 502 | `system_model_failed` | The model request failed after it may have been sent. Do not repeat it automatically. |
| 503 | `model_usage_request_identity_required` | The request has no `X-CoA-Model-Request` header. No model request was sent. |
| 503 | `system_model_decision_unavailable` | The request could not be recorded before the model call, for example because the `X-CoA-Model-Request` value is malformed, more than 24 hours old or more than a minute ahead of the server clock. No model request was sent. |

## Macros

A macro is an ordered list of one to ten existing skills that an agent follows as a single playbook. Macros cannot contain other macros. They are listed by `GET /api/skills`, their ids start with `mac_`, and a workspace can hold up to 100.

### POST /api/skills/macros

Create a macro

Every step must name a skill that exists in the catalogue at the time of the request. Entries in `steps` without a `skillId` are ignored.

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `name` required | `string` | Display name. Longer values are cut to 80 characters. |
| `description` | `string` | What the macro is for. Cut to 280 characters. |
| `steps` required | `object[]` | One to ten steps, in the order the agent should follow them. |
| `steps.skillId` required | `string` | Id of a built-in or custom skill. A macro id is not accepted. |
| `steps.note` | `string` | Optional guidance for this step. Cut to 200 characters. |

**Returns:** The created macro: `{ id, name, description, steps }`. The status is 200.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid` | The name or the steps are missing, there are more than ten steps, or a step names an unknown skill or a macro. `detail` says which. |
| 400 | `limit` | The workspace already has 100 macros. |
| 409 | `skill_not_ready` | A step uses an imported skill that has not been reviewed yet. |

```bash
curl -X POST https://centerofagentic.com/api/skills/macros \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Report pack","description":"Review the report, then write the summary.","steps":[{"skillId":"skill_3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11"},{"skillId":"builtin:executive-writing","note":"Keep it under 150 words."}]}'
```

```json
{
  "id": "mac_5b2d4f6a-8c1e-4d3b-9f70-1a2b3c4d5e6f",
  "name": "Report pack",
  "description": "Review the report, then write the summary.",
  "steps": [
    { "skillId": "skill_3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11" },
    { "skillId": "builtin:executive-writing", "note": "Keep it under 150 words." }
  ]
}
```

### PATCH /api/skills/macros/{id}

Update a macro

Send only the fields to change; `steps` replaces the whole list. The result is checked against the current catalogue, so a step whose skill has been deleted must be removed before the macro can be saved.

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `string` | Macro id (`mac_…`). |

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `name` | `string` | New display name; cannot be empty. Cut to 80 characters. |
| `description` | `string` | New description. Cut to 280 characters. |
| `steps` | `object[]` | The full new list of one to ten steps, each with `skillId` and an optional `note`. |
| `steps.skillId` required | `string` | Id of a built-in or custom skill. A macro id is not accepted. |
| `steps.note` | `string` | Optional guidance for this step. Cut to 200 characters. |

**Returns:** The updated macro: `{ id, name, description, steps }`.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 404 | `not_found` | No macro in the workspace has this id, or it was removed while the update was in progress. |
| 400 | `invalid` | The merged macro has no name, no steps, more than ten steps, or a step that names an unknown skill or a macro. |
| 409 | `skill_not_ready` | A step uses an imported skill that has not been reviewed yet. |

### DELETE /api/skills/macros/{id}

Delete a macro

Removes only the macro. Agents that still list its id stop receiving the playbook; their configuration is not rewritten.

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `string` | Macro id (`mac_…`). |

**Returns:** `{ "ok": true }`.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 404 | `not_found` | No macro in the workspace has this id. |

## Export and source files

Export turns a saved skill into a portable document: a `SKILL.md` file with YAML front matter, or a JSON document. Skills imported from a public GitHub folder also keep the original files of that folder, which can be read back in chunks.

### POST /api/skills/{id}/export

Export a skill as a portable document

Works for built-in and custom skills and does not change the catalogue. `expectedRevision` and `expectedDigest` must match the saved skill; for a built-in skill send `0` and `null`. The document comes back as JSON in `text`, to be written to a file under `filename`. Server ids and the review status of an imported skill are not part of the document.

**Access:** API key with the `read` scope, or a signed-in workspace member.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `string` | Skill id (`builtin:…` or `skill_…`). |

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `format` required | `"json" \| "skill-md"` | `skill-md` produces a `SKILL.md` file; `json` produces a JSON skill document. |
| `expectedRevision` required | `integer` | Current `revision` of the skill; `0` for a built-in skill. |
| `expectedDigest` required | `string \| null` | Current `digest` of the skill, or `null` when the skill has none, as is the case for every built-in skill. |
| `portableName` | `string` | File-level name of 1 to 64 lower-case letters or digits separated by single hyphens. Defaults to a name derived from the skill name. An imported skill keeps the portable name it was imported with. |
| `description` | `string` | Description to use when the saved skill has none, at most 1,024 characters. An export needs a non-empty description; a saved description cannot be overridden here. |
| `bundle` | `boolean` | For a skill imported from a GitHub folder, `true` adds a `bundle` object with the manifest of the stored files. |

**Returns:** An object with `ok` (`true`), `text` (the document), `bytes`, `sha256`, `mimeType` (`application/json` or `text/markdown`), `filename` (`skills.json` or `SKILL.md`), `omittedResources` (supporting files the single document does not contain), `diagnostics`, `revision`, `digest` and `enforcement`. `enforcement` is always `CoA-only`: governance applies inside the platform, not to the exported file. With `bundle: true` on a GitHub-imported skill, `bundle` holds `{ version, manifest }`.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_export` | The body is malformed, a required value is missing, the skill has no description and none was supplied, or the content cannot be represented in the chosen format. |
| 404 | `not_found` | No built-in or workspace skill has this id. |
| 409 | `stale_skill` | `expectedRevision` or `expectedDigest` does not match the saved skill. |
| 400 | `credential` | The content matches a credential pattern and is not exported. |
| 413 | `export_too_large` | The document would exceed 64 KiB for `skill-md` or 1 MiB for `json`. |

```bash
curl -X POST https://centerofagentic.com/api/skills/skill_3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11/export \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"format":"skill-md","expectedRevision":1,"expectedDigest":"8b20d135815a3e690946e8324c2d7887db56c2669a249848f9ba992efbe82884"}'
```

```json
{
  "ok": true,
  "text": "---\nname: 'quarterly-report-review'\ndescription: 'Checks a quarterly report for unsupported figures.'\nx-agentbuilder:\n  display-name: 'Quarterly report review'\n  category: 'Reporting'\n  extensions: {}\n  origin:\n    format: 'json'\n    sha256: '16bfe24b97e503193ae341724a1fadac6e769281dbed50acd2f4c65cff12a7af'\n    recordIndex: 0\n---\nRead every section. List each figure that has no stated source.",
  "bytes": 395,
  "sha256": "3a7a2a0ff6f7ee408764b3fadbae7399787983d9e4535955ba25558497cc4484",
  "mimeType": "text/markdown",
  "filename": "SKILL.md",
  "omittedResources": [],
  "diagnostics": [],
  "revision": 1,
  "digest": "8b20d135815a3e690946e8324c2d7887db56c2669a249848f9ba992efbe82884",
  "enforcement": "CoA-only"
}
```

### POST /api/skills/{id}/resources

Read the stored source files of a GitHub-imported skill

Has two modes, and each accepts only its own fields. Without `mode`, it returns up to 256 KiB of one stored file as base64, starting at `offset`; repeat with a higher `offset` until `eof` is `true`, then check the assembled file against `totalBytes` and `sha256`. With `mode` set to `review`, it returns the text reference files that the skill's instructions depend on, with their sizes and digests, for inspection. Neither mode changes the catalogue.

**Access:** API key with the `read` scope, or a signed-in workspace member.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `string` | Id of a custom skill that was imported from a GitHub folder. |

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `expectedRevision` required | `integer` | Current `revision` of the skill (1 or higher). |
| `expectedDigest` required | `string` | Current `digest` of the skill. |
| `path` | `string` | Chunk mode, required: path of the file relative to the imported folder, as listed in the import manifest, for example `references/checklist.md`. |
| `offset` | `integer` | Chunk mode, required: byte offset to start reading at; `0` for the first chunk. |
| `mode` | `"review"` | Review mode, required: the literal `review`. |
| `version` | `1` | Review mode, required: must be `1`. |

**Returns:** Chunk mode: `{ filename, path, sha256, totalBytes, offset, base64, eof }`. Review mode: `{ review, materials }`, where `review` holds `version`, `profile`, `revision`, `digest`, `manifestDigest`, `files` (each with `path`, `bytes`, `sha256`) and `materializationDigest`, and `materials` repeats each file with its `text`.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_resource` | The body is malformed or mixes the two modes, the path is not a safe relative path, or the offset is past the end of the file. |
| 404 | `not_found` | No custom skill in the workspace has this id. Chunk mode: the skill has no stored source files, or no file at `path`. |
| 409 | `stale_skill` | `expectedRevision` or `expectedDigest` does not match the saved skill. |
| 409 | `resource_unavailable` | The stored files are incomplete, or, in review mode, the skill has no stored source files. Import the source again. |
| 400 | `resource_unsupported` | Review mode: the skill depends on something other than plain text reference files (`.md`, `.txt`, `.csv`, `.json`, `.yml`, `.yaml`). |
| 400 | `resource_cycle` | Review mode: the reference files refer to each other in a loop. |
| 413 | `resource_limit` | Review mode: the referenced files exceed 128 KiB for one file, 256 KiB in total, 99 files or eight levels of references. |

```bash
curl -X POST https://centerofagentic.com/api/skills/skill_7d6c5b4a-3f2e-4d1c-8b0a-9f8e7d6c5b4a/resources \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"expectedRevision":1,"expectedDigest":"b319cd42e0d80ea7822e03fee9fde34da4fc8846dfc9a22f1aa5ec883e321453","path":"references/checklist.md","offset":0}'
```

```json
{
  "filename": "checklist.md",
  "path": "references/checklist.md",
  "sha256": "420c6d8eeedcb16058fad5ce6b980729cf969757e6b5839ff374f6397e891318",
  "totalBytes": 27,
  "offset": 0,
  "base64": "IyBDaGVja2xpc3QKLSBDaGVjayB0b3RhbHMK",
  "eof": true
}
```

## Import skills

Importing takes two calls. A preview parses the document, reports warnings and name clashes and returns a `previewId` that is valid for 15 minutes; a commit then resubmits the same request and saves every record, or none. The source can be a `SKILL.md` file, plain Markdown with metadata, or a JSON skill document (`{ "format": "agentbuilder.skill", "version": 1, "skill": { … } }`, or `agentbuilder.skills` with a `skills` array of up to 200 records). Each JSON skill record holds a `portableName` and a `content` object with `name`, `description`, `instructions` and optionally `category` and `integration`; the export endpoint produces documents in this form. Imported skills start unreviewed: until a workspace admin reviews the skill in the web workspace, a step that API keys cannot perform, assigning it to an agent or adding it to a macro is refused with `skill_not_ready`. A skill whose preview reports `inspection.dependenciesSatisfied` as `false`, for example because it declares required tools or a connector binding, can stay unassignable after that review.

### POST /api/skills/import-preview

Preview a skill import

Parses and checks the document without saving a skill. The preview stores only a handle and a digest of the request, not the document, so the commit must send the same request again. A workspace can create 30 previews per minute, 20 per caller, and the serialised request is limited to 2 MiB.

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `version` required | `1` | Must be `1`. |
| `format` required | `"skill-md" \| "markdown" \| "json"` | How to read `source`. |
| `source` required | `string` | The document text itself, never a URL. At most 64 KiB for `skill-md` and `markdown`, and 1 MiB for `json`. A `SKILL.md` needs `name` (in the same form as `portableName`) and a non-empty `description` in its front matter; the text after the front matter becomes the instructions. |
| `metadata` | `object` | Required for `markdown`: `portableName` (1 to 64 lower-case letters or digits separated by single hyphens), `name` and `description`, with optional `category` and `integration`. |
| `allowBatch` | `boolean` | Must be `true` to import a JSON document in the `agentbuilder.skills` form, whatever the number of records. |
| `choices` | `object[]` | One entry per parsed record, in order. `{ "kind": "create" }` or `{ "kind": "copy" }` adds a new skill, optionally under another `name`. `{ "kind": "replace", "id": …, "expectedRevision": … }` overwrites an existing custom skill. Defaults to `create` for every record. |
| `github` | `object` | Present when the request was produced by the GitHub source endpoint: `repository`, `commit`, `folder` and `manifestDigest`. The server reads the pinned folder again and refuses the import if it no longer matches, so the errors of the GitHub source endpoint can also occur here. Such a request holds exactly one skill. |

**Returns:** An object with `previewId`, `expiresAt`, `digest` (of the request), `documents` (the parsed records, each with `portableName`, `content`, `frontmatter`, `extensions`, `origin`, `source` and `inspection`, plus `github` for a GitHub import), `diagnostics` (warnings with `code`, `severity`, `field`, `message` and `recordIndex`), `collisions` (clashes with existing skills: `index`, `id`, `name`, `revision`, `alternatives`) and `canCommit`. `canCommit` is `false` when a clash is unresolved or the workspace would exceed 200 custom skills.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_import` | The request or the document is malformed. Parser findings are listed in `issues`. Nothing is partly accepted. |
| 400 | `credential` | The document matches a credential pattern, such as a private key or an API token. |
| 413 | `invalid_import` | `source` or its metadata exceeds a size limit, or a JSON document holds more than 200 records. The status is 413 although the code is `invalid_import`. |
| 413 | `import_too_large` | The serialised request exceeds 2 MiB. |
| 400 | `invalid_github_source` | The `github` object is malformed, or the document does not hold exactly one skill. |
| 404 | `not_found` | A `replace` choice names a skill that is not a custom skill of this workspace. |
| 409 | `github_source_changed` | The GitHub folder no longer matches the `manifestDigest` in the request. Fetch the source again. |
| 429 | `import_rate_limit` | More than 30 previews in 60 seconds for the workspace, or 20 for the caller. The response carries `Retry-After: 60`. |
| 429 | `preview_limit` | The workspace has 100 open previews, or 1,000 previews retained from the last 24 hours. |

```bash
curl -X POST https://centerofagentic.com/api/skills/import-preview \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"version":1,"format":"markdown","source":"Review every number.","metadata":{"portableName":"report-review","name":"Report review","description":"Review a report."}}'
```

```json
{
  "previewId": "c2a4e6f8-1b3d-4f5a-8c7e-9d0b2a4c6e8f",
  "expiresAt": "2026-11-28T10:30:00.123456+00:00",
  "digest": "c5b8c372987a14d9044a5aba280f32283d0c889bc46afc3be2aee3174a94671d",
  "documents": [
    {
      "portableName": "report-review",
      "content": {
        "name": "Report review",
        "category": "Custom",
        "description": "Review a report.",
        "instructions": "Review every number."
      },
      "frontmatter": { "name": "report-review", "description": "Review a report." },
      "extensions": {},
      "origin": {
        "format": "markdown",
        "sha256": "34c6ad962b4fcfc522d7fd1d1bb7c7872fc759aab8ca4703e3ed1e0ca33d1d6b",
        "recordIndex": 0
      },
      "source": {
        "format": "markdown",
        "sha256": "34c6ad962b4fcfc522d7fd1d1bb7c7872fc759aab8ca4703e3ed1e0ca33d1d6b",
        "bytes": 20,
        "recordIndex": 0
      },
      "inspection": {
        "resources": [],
        "requirements": [],
        "annotationRequired": true,
        "dependenciesSatisfied": true,
        "assignable": false
      }
    }
  ],
  "diagnostics": [],
  "collisions": [],
  "canCommit": true
}
```

### POST /api/skills/import

Commit a previewed skill import

Saves the previewed records as custom skills. `request` must be exactly the body that was previewed; a changed request needs a new preview. All records are saved together or none are. Repeating the call with the same `previewId`, `idempotencyKey` and `request` returns the original result with `replayed: true` instead of importing twice, until 24 hours after the preview was created.

**Access:** API key with the `admin` scope, or a signed-in workspace member. Only the caller that created the preview (the same API key or the same signed-in user) can use it.

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `previewId` required | `uuid` | The `previewId` returned by the preview. |
| `idempotencyKey` required | `uuid` | A UUID you generate for this commit. Reuse it only to retry the same commit. |
| `request` required | `object` | The exact import request that was previewed. |

**Returns:** An object with `skills` (one `{ id, revision, digest }` per saved skill, in record order) and `replayed`.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_import` | The body is malformed, or `previewId` or `idempotencyKey` is not a UUID. |
| 404 | `preview_not_found` | No preview with this id belongs to the calling credential. |
| 409 | `preview_changed` | `request` differs from the request that was previewed. |
| 409 | `preview_consumed` | The preview was already committed under another idempotency key. |
| 410 | `preview_expired` | The preview is older than 15 minutes. |
| 410 | `preview_cancelled` | The preview was cancelled. |
| 409 | `idempotency_conflict` | The idempotency key was already used for a different preview or request. |
| 409 | `name_conflict` | A record's name is now used by another skill. Preview again with a new name or a `replace` choice. |
| 409 | `stale_skill` | A `replace` choice names a revision that is no longer current. |
| 404 | `not_found` | A `replace` choice names a skill that no longer exists. |
| 409 | `skill_in_use` | A `replace` choice would rename a skill that agents or macros still refer to. |
| 409 | `catalog_limit` | The import would take the workspace past 200 custom skills. |
| 409 | `github_source_changed` | GitHub import: the folder no longer matches the `manifestDigest` in the request. |
| 409 | `catalog_busy` | The catalogue kept changing while the import was being saved. Nothing was saved; send the same call again. |
| 409 | `import_outcome_unknown` | The result could not be confirmed. Retry with the same `previewId`, `idempotencyKey` and `request`; do not start a new import. |

```bash
curl -X POST https://centerofagentic.com/api/skills/import \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"previewId":"c2a4e6f8-1b3d-4f5a-8c7e-9d0b2a4c6e8f","idempotencyKey":"0e9d8c7b-6a5f-4e3d-9c2b-1a0f9e8d7c6b","request":{"version":1,"format":"markdown","source":"Review every number.","metadata":{"portableName":"report-review","name":"Report review","description":"Review a report."}}}'
```

```json
{
  "skills": [
    {
      "id": "skill_7d6c5b4a-3f2e-4d1c-8b0a-9f8e7d6c5b4a",
      "revision": 1,
      "digest": "b319cd42e0d80ea7822e03fee9fde34da4fc8846dfc9a22f1aa5ec883e321453"
    }
  ],
  "replayed": false
}
```

### DELETE /api/skills/import-previews/{id}

Cancel an import preview

Marks an open preview as cancelled so it can no longer be committed. No body is needed and the catalogue is not changed.

**Access:** API key with the `admin` scope, or a signed-in workspace member. Only the caller that created the preview (the same API key or the same signed-in user) can use it.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `uuid` | The `previewId` to cancel. |

**Returns:** `{ "cancelled": true }`.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 404 | `preview_not_found` | No preview with this id belongs to the calling credential. |
| 409 | `preview_consumed` | The preview was already committed. |
| 410 | `preview_expired` | The preview is older than 15 minutes. |

## Public GitHub sources

A skill folder in a public GitHub repository can be imported at an exact commit. First discover the folders that contain a `SKILL.md`, then fetch one folder to get a ready-made import request, and pass that request to the import preview and commit. The folder is read from GitHub again at preview and at commit, so both calls can return the `github_…` errors listed here. The files of the folder are stored with the imported skill; a saved import does not follow later changes in the repository.

### POST /api/skills/github-source

Discover or fetch a skill folder in a public GitHub repository

Reads the repository anonymously: no GitHub credential is accepted, and a private repository is reported as unavailable. `discover` resolves a branch, tag or commit to one commit and lists the folders that contain a `SKILL.md`. `fetch` reads one folder at that commit and returns an import request pinned to it; neither mode saves anything. A folder is limited to 100 files and 5 MiB, its `SKILL.md` to 64 KiB, and one call to 15 seconds.

**Access:** API key with the `admin` scope, or a signed-in workspace member.

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `version` required | `1` | Must be `1`. |
| `mode` required | `"discover" \| "fetch"` | Which of the two operations to run. |
| `repository` required | `string` | The public repository as `owner/name`. A URL is not accepted. |
| `folder` required | `string` | Folder path inside the repository, without leading or trailing slashes and at most eight levels deep. An empty string means the repository root. In `discover` it narrows the search; in `fetch` it is the folder to import. |
| `ref` | `string` | `discover` only, required: the branch, tag or commit to resolve, at most 256 characters. Not allowed in `fetch`. |
| `commit` | `string` | `fetch` only, required: the full 40-character lower-case commit id returned by `discover`. Not allowed in `discover`. |

**Returns:** `discover`: `{ commit, folders, limits }`, where `folders` lists `folder` itself and every folder below it that contains a `SKILL.md` (the repository root appears as an empty string). `fetch`: `{ request, manifest, limits }`, where `request` is an import request (`version`, `format`, `source`, `github`) to send to the import preview, and `manifest` describes the folder (`version`, `repository`, `commit`, `folder`, `sourceSha256`, `files` with `path`, `bytes`, `sha256`, `gitBlob` and `kind`, `license` when the skill declares one, and `manifestDigest`). `limits` repeats the size and time limits that apply.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_github_source` | The body is malformed, contains an unknown field, or mixes `ref` and `commit` with the wrong mode. |
| 400 | `credential` | The request, a file name or a file in the folder matches a credential pattern. |
| 400 | `invalid_import` | `fetch`: the folder's `SKILL.md` is not a valid skill document, or its `name` differs from the name of the folder. Parser findings are listed in `issues`. |
| 400 | `github_unsafe_entry` | The repository redirects, or the folder contains a symlink, a submodule, a Git LFS pointer or an unsafe path. |
| 404 | `github_public_source_unavailable` | The repository, reference or folder was not found or is private, or the fetched folder has no `SKILL.md` of its own. |
| 413 | `github_limit` | The repository or folder exceeds one of the limits in `limits`. |
| 429 | `github_rate_limit` | GitHub is rate limiting anonymous requests. Retry later. |
| 502 | `github_upstream` | GitHub could not be reached or returned an inconsistent response. |
| 504 | `github_timeout` | GitHub did not answer within 5 seconds for one request or 15 seconds overall. |

```bash
curl -X POST https://centerofagentic.com/api/skills/github-source \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"version":1,"mode":"discover","repository":"example-org/agent-skills","ref":"main","folder":""}'
```

```json
{
  "commit": "1373f0c6fc4273b98b263d4b871fd35fbbdebce0",
  "folders": ["skills/report-review", "skills/ticket-triage"],
  "limits": {
    "skillBytes": 65536,
    "files": 100,
    "folderBytes": 5242880,
    "depth": 8,
    "entries": 2000,
    "requests": 128,
    "concurrency": 4,
    "requestMs": 5000,
    "totalMs": 15000,
    "metadataBytes": 1048576,
    "wireBytes": 16777216,
    "chunkBytes": 262144
  }
}
```

Source: https://centerofagentic.com/docs/api/knowledge-skills

## Related pages

- [authentication](https://centerofagentic.com/docs/authentication)
- [errors](https://centerofagentic.com/docs/api/errors)
- [The usage-request header](https://centerofagentic.com/docs/guides/troubleshooting#usage-request-header)
