# Create model

URL: https://docs.hanzo.ai/docs/openapi/risk/riskpublishmodel

> Publishes your organisation's model as a NAMED VALUE, so a decision taken today can be reconstructed tomorrow and a change made today can be undone.

`POST /v1/risk/state/model`

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

|               |                                            |
| ------------- | ------------------------------------------ |
| **Address**   | `https://api.hanzo.ai/v1/risk/state/model` |
| **Method**    | `POST`                                     |
| **Operation** | `riskPublishModel`                         |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`     |

Publishes your organisation's model as a NAMED VALUE, so a decision
taken today can be reconstructed tomorrow and a change made today can be undone.

It answers with a NAME and not with the state. The masses stay on your
organisation's own encrypted store and are referred to by an address computed
from their own content: the shape, the geometry seed, the position in the window,
the threshold, the masses themselves as IEEE-754 bits, and the fold watermark
behind them. That is what makes the value nameable without making the caller its
custodian.

IT IS IDEMPOTENT ON THE VALUE. A model that has not changed publishes to the name
it already has and mints nothing, reporting minted=false — so publishing at every
boundary that matters is free. Ten values are retained per organisation, bounded
in BYTES rather than in rows, and the oldest is disposed of past that.

A model that has learned nothing is refused: planted is not learned, and a value
that reproduces nothing is not a value.

It is POST and PUT on one address because they are one plane's two verbs over one
kind of thing: POST mints a value from the model in force, PUT puts a value in
force. They were /v1/risk/state/snapshot and /v1/risk/state/restore — two addresses
named after the operation rather than after the thing, which is how a reader ends
up asking what the difference between a snapshot and a value is.

## Request

The document declares no body for `POST /v1/risk/state/model`. The handler is typed in cloud but its shape is not yet emitted, so the fields are not listed here — ask MCP's `describe` for `riskPublishModel`, which answers from the running route.

## Response

| Status    | Body                | Meaning |
| --------- | ------------------- | ------- |
| `201`     | risk.riskPublishOut | created |
| `default` | problem-details     | refused |

`201` body — 9 fields.

| Field            | In   | Type                | Always | Description                                                                                                                                                                                                                          |
| ---------------- | ---- | ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `minted`         | body | boolean             | —      | Minted is false when your model was ALREADY published under this name and nothing was written.                                                                                                                                       |
| `tenant`         | body | string              | —      | Tenant is whose history it entered.                                                                                                                                                                                                  |
| `value`          | body | risk.riskModelValue | —      |                                                                                                                                                                                                                                      |
| `value.address`  | body | string              | —      | Address names this value by its own content: the model's shape, the geometry seed, its position in the window, its threshold, its masses as IEEE-754 bits and the fold watermark behind them.                                        |
| `value.at`       | body | string              | —      | At is when it was published, RFC 3339, on the server clock.                                                                                                                                                                          |
| `value.learned`  | body | integer (int64)     | —      | Learned is how many events are behind the masses.                                                                                                                                                                                    |
| `value.sequence` | body | integer (int64)     | —      | Sequence is this value's place in YOUR organisation's own history, from 1 and contiguous until retention disposes of the oldest.                                                                                                     |
| `value.shape`    | body | string              | —      | Shape NAMES the model space the masses are only meaningful against, as `&lt;family&gt;:&lt;digest&gt;` — the KIND of model, and that family's own digest over the feature inventory in order and the detector's geometry parameters. |
| `value.warmed`   | body | string              | —      | Warmed is how far your own event surface had been folded in when this value was published, RFC 3339.                                                                                                                                 |

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

## Examples

**CLI**

```bash
hanzo risk state model create
```

**SDK**

**.ts**

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

const api = new RiskApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.riskPublishModel();
```

**.py**

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

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = RiskApi(client).risk_publish_model()
```

**.go**

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

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

**.rs**

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

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

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

**.java**

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

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

var result = new RiskApi(client).riskPublishModel();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/risk/state/model \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `risk`, op `riskPublishModel` — 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": "risk",
         "arguments": {
           "op": "riskPublishModel",
           "input": {}
         }
       }
     }'
```

---

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