# Create corrections

URL: https://docs.hanzo.ai/docs/openapi/ai/decisionscorrect

> Files a correction of one question of one of the org's Kai decisions: the right answer, which must be one of that question's options and not what Kai answered, and why.

`POST /v1/decisions/{decision}/corrections`

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

|               |                                                            |
| ------------- | ---------------------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/decisions/{decision}/corrections` |
| **Method**    | `POST`                                                     |
| **Operation** | `decisionsCorrect`                                         |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`                     |

Files a correction of one question of one of the org's Kai
decisions: the right answer, which must be one of that question's options and
not what Kai answered, and why. A decision Kai captured can teach a capability
of its question (/v1/capabilities); one made with capture off is kept with
state missing and cannot. The org's first correction turns capture on, so its
next decisions can teach. Refused: 409 not\_wrong when the answer is Kai's own,
409 corrected when the question already has a correction, 404 when the
decision captured no such question.

## Request

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

| Field      | In   | Type   | Required | Description                                                                  |
| ---------- | ---- | ------ | -------- | ---------------------------------------------------------------------------- |
| `decision` | path | string | yes      | Decision is the decision's id.                                               |
| `answer`   | body | string | —        | Answer is the right option label; a score's level may be named by its index. |
| `cohort`   | body | string | —        | Cohort groups corrections the org files together.                            |
| `decision` | body | string | —        | Decision is the decision's id.                                               |
| `note`     | body | string | —        | Note says why, for the person reading it later.                              |
| `question` | body | string | —        | Question is the question's key.                                              |

## Response

| Status    | Body            | Meaning |
| --------- | --------------- | ------- |
| `201`     | Correction      | created |
| `default` | problem-details | refused |

`201` body — 12 fields.

| Field      | In   | Type            | Always | Description                                                                                                                            |
| ---------- | ---- | --------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| `answer`   | body | string          | —      | Answer is the right answer; Base what Kai answered.                                                                                    |
| `at`       | body | integer (int64) | —      |                                                                                                                                        |
| `base`     | body | string          | —      |                                                                                                                                        |
| `by`       | body | string          | —      |                                                                                                                                        |
| `cohort`   | body | string          | —      |                                                                                                                                        |
| `decision` | body | string          | —      |                                                                                                                                        |
| `id`       | body | string          | —      |                                                                                                                                        |
| `labels`   | body | string\[]       | —      |                                                                                                                                        |
| `note`     | body | string          | —      |                                                                                                                                        |
| `question` | body | string          | —      |                                                                                                                                        |
| `state`    | body | string          | —      | State is captured when the decision's state is held and the correction can teach, missing when the decision was made with capture off. |
| `type`     | body | string          | —      |                                                                                                                                        |

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

## Examples

**CLI**

```bash
hanzo decisions corrections create <decision>
```

**SDK**

**.ts**

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

const api = new AiApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.decisionsCorrect({ decision: 'decision', answer: "<answer>", cohort: "<cohort>" });
```

**.py**

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

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AiApi(client).decisions_correct(decision='decision', answer="<answer>", cohort="<cohort>")
```

**.go**

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

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

**.rs**

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

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

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

**.java**

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

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

var result = new AiApi(client).decisionsCorrect();
```

**HTTP**

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

**MCP**

Tool `ai`, op `decisionsCorrect` — 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": "ai",
         "arguments": {
           "op": "decisionsCorrect",
           "input": {
             "decision": "<decision>",
             "answer": "<answer>",
             "cohort": "<cohort>"
           }
         }
       }
     }'
```

---

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