# Replace settings

URL: https://docs.hanzo.ai/docs/openapi/settings/put-settings-by-product

> Writes the caller org's configuration for one product and answers the stored result, secrets masked.

`PUT /v1/settings/{product}`

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

|               |                                              |
| ------------- | -------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/settings/{product}` |
| **Method**    | `PUT`                                        |
| **Operation** | `put_settings_by_product`                    |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`       |

Writes the caller org's configuration for one product and answers the
stored result, secrets masked. Secret VALUES are sealed into KMS under
orgs/{org}/settings/{product}/{key} and never touch this deployment's database;
with no KMS configured a write that carries any secret is refused whole (503)
rather than dropping it or persisting it in the clear. A secret the body omits
keeps its stored value, so a partial write never silently clears one.

## Request

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

| Field       | In   | Type   | Required | Description                                                        |
| ----------- | ---- | ------ | -------- | ------------------------------------------------------------------ |
| `product`   | path | string | yes      | Product is the catalog slug, from the PATH.                        |
| `config`    | body | object | —        | Config is the product's non-secret configuration, stored verbatim. |
| `config.*`  | body | any    | —        |                                                                    |
| `product`   | body | string | —        | Product is the catalog slug, from the PATH.                        |
| `secrets`   | body | object | —        | Secrets are the secret fields, by name.                            |
| `secrets.*` | body | string | —        |                                                                    |

## Response

| Status    | Body            | Meaning |
| --------- | --------------- | ------- |
| `200`     | settings.View   | ok      |
| `default` | problem-details | refused |

`200` body — 5 fields.

| Field        | In   | Type      | Always | Description                                                                                                     |
| ------------ | ---- | --------- | ------ | --------------------------------------------------------------------------------------------------------------- |
| `config`     | body | any       | —      | Config is the product's non-secret configuration, an opaque JSON object the server stores and returns verbatim. |
| `createdAt`  | body | string    | —      | CreatedAt is when this configuration was first written, RFC 3339 UTC.                                           |
| `product`    | body | string    | —      | Product is the catalog slug this configuration belongs to.                                                      |
| `secretKeys` | body | string\[] | —      | SecretKeys names the secret fields that ARE set.                                                                |
| `updatedAt`  | body | string    | —      | UpdatedAt is when this configuration was last written, RFC 3339 UTC.                                            |

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

## Examples

**CLI**

```bash
hanzo settings set <product>
```

**SDK**

**.ts**

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

const api = new SettingsApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.putSettingsByProduct({ product: 'product', config: {}, product: "<product>" });
```

**.py**

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

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = SettingsApi(client).put_settings_by_product(product='product', config={}, product="<product>")
```

**.go**

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

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

**.rs**

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

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

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

**.java**

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

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

var result = new SettingsApi(client).putSettingsByProduct();
```

**HTTP**

```bash
curl -X PUT https://api.hanzo.ai/v1/settings/<product> \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "config": {},
       "product": "<product>"
     }'
```

**MCP**

MCP reaches **settings** through the `settings` tool, which names its 2 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "get_setting"
         }
       }
     }'
```

---

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