# Create capabilities

URL: https://docs.hanzo.ai/docs/openapi/train/capabilitiescreate

> Makes a capability in draft from captured corrections of one question: that question (its key, type and labels) is the route it will be installed behind.

`POST /v1/capabilities`

> [Train →](https://docs.hanzo.ai/docs/openapi/train) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/capabilities` |
| **Method**    | `POST`                                 |
| **Operation** | `capabilitiesCreate`                   |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Makes a capability in draft from captured corrections of one
question: that question (its key, type and labels) is the route it will be
installed behind. Refused: a name taken by another capability or by a
published job's output (409 name\_taken), corrections of two questions or not
captured (400), and a question another of the org's capabilities answers (409
route\_conflict).

## Request

2 fields, body `application/json` (required).

| Field         | In   | Type      | Required | Description                                                                                                       |
| ------------- | ---- | --------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
| `corrections` | body | string\[] | —        | Corrections are the corrections it is taught from: captured corrections of one question, which becomes its route. |
| `name`        | body | string    | —        | Name is its name: lowercase words joined by hyphens, at most 64.                                                  |

## Response

| Status    | Body             | Meaning |
| --------- | ---------------- | ------- |
| `201`     | train.Capability | created |
| `default` | problem-details  | refused |

`201` body — 35 fields.

| Field                       | In   | Type             | Always | Description                                                                                                                                                                       |
| --------------------------- | ---- | ---------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `by`                        | body | string           | —      |                                                                                                                                                                                   |
| `corrections`               | body | string\[]        | —      | Corrections are the corrections it is taught from.                                                                                                                                |
| `created`                   | body | integer (int64)  | —      |                                                                                                                                                                                   |
| `installed`                 | body | integer (int64)  | —      | Installed is the version in the org's published set, 0 when none.                                                                                                                 |
| `live`                      | body | train.Live       | —      |                                                                                                                                                                                   |
| `live.damage`               | body | integer (int64)  | —      |                                                                                                                                                                                   |
| `live.damage_rate`          | body | number (double)  | —      |                                                                                                                                                                                   |
| `live.fires`                | body | integer (int64)  | —      | Fires counts decisions it answered otherwise than the base would have.                                                                                                            |
| `live.last_fired`           | body | integer (int64)  | —      | LastFired is when it last fired, unix seconds; 0 never.                                                                                                                           |
| `live.neutral`              | body | integer (int64)  | —      |                                                                                                                                                                                   |
| `live.repair_rate`          | body | number (double)  | —      |                                                                                                                                                                                   |
| `live.repairs`              | body | integer (int64)  | —      | Repairs are fires that changed the label and no correction contradicts; Damage, fires whose label a correction put back to the base's; Neutral, fires that kept the base's label. |
| `live.version`              | body | integer (int64)  | —      |                                                                                                                                                                                   |
| `name`                      | body | string           | —      | Name is its name, one per org; it is the name its versions install under.                                                                                                         |
| `question`                  | body | train.Question   | —      |                                                                                                                                                                                   |
| `question.key`              | body | string           | —      |                                                                                                                                                                                   |
| `question.labels`           | body | string\[]        | —      |                                                                                                                                                                                   |
| `question.type`             | body | string           | —      |                                                                                                                                                                                   |
| `state`                     | body | string           | —      | State is where it is in its life: draft, trained, evaluated, publishable, installed, active, disabled or needs\_validation.                                                       |
| `updated`                   | body | integer (int64)  | —      |                                                                                                                                                                                   |
| `version`                   | body | integer (int64)  | —      | Version is its latest version, 0 in draft.                                                                                                                                        |
| `versions`                  | body | train.Version\[] | —      | Versions are its versions, newest first (one capability read).                                                                                                                    |
| `versions[].at`             | body | integer (int64)  | —      |                                                                                                                                                                                   |
| `versions[].base_sha256`    | body | string           | —      | BaseSHA256 is Kai's weights it was taught over.                                                                                                                                   |
| `versions[].by`             | body | string           | —      |                                                                                                                                                                                   |
| `versions[].bytes`          | body | integer (int64)  | —      | Bytes is its artifact's size.                                                                                                                                                     |
| `versions[].corrections`    | body | string\[]        | —      | Corrections are the corrections it was taught from.                                                                                                                               |
| `versions[].evaluation`     | body | any              | —      | Evaluation is its evaluation record, in the shared /evals words.                                                                                                                  |
| `versions[].form`           | body | string           | —      | Form is calibration, head or pair; Rank its place, 1 the smallest.                                                                                                                |
| `versions[].passed`         | body | boolean          | —      | Passed says its evaluation passed the gate: it is publishable.                                                                                                                    |
| `versions[].questions`      | body | string\[]        | —      | Questions are the question keys it answers.                                                                                                                                       |
| `versions[].rank`           | body | integer (int64)  | —      |                                                                                                                                                                                   |
| `versions[].representation` | body | string           | —      | Representation is what it reads of Kai (the weights, tokenizer, layout and pooling, hashed): the only Kai it serves on, whatever the release.                                     |
| `versions[].sha256`         | body | string           | —      | SHA256 is its artifact's: the tar the decision service installs.                                                                                                                  |
| `versions[].version`        | body | integer (int64)  | —      |                                                                                                                                                                                   |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo capabilities create
```

**SDK**

**.ts**

```ts
import { Configuration, TrainApi } from 'hanzoai';

const api = new TrainApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.capabilitiesCreate({ corrections: ["<corrections>"], name: "<name>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import TrainApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = TrainApi(client).capabilities_create(corrections=["<corrections>"], name="<name>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.TrainAPI.CapabilitiesCreate(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, train_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = train_api::capabilities_create(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.TrainApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new TrainApi(client).capabilitiesCreate();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/capabilities \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "corrections": [
         "<corrections>"
       ],
       "name": "<name>"
     }'
```

**MCP**

Tool `train`, op `capabilitiesCreate` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "train",
         "arguments": {
           "op": "capabilitiesCreate",
           "input": {
             "corrections": [
               "<corrections>"
             ],
             "name": "<name>"
           }
         }
       }
     }'
```

---

[Train API](https://docs.hanzo.ai/docs/openapi/train) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
