Stores or replaces one secret in your org.
Stores or replaces one secret in your org. Upserts one secret under the caller's own org.
POST /v1/kms/secrets
| Address | https://api.hanzo.ai/v1/kms/secrets |
| Method | POST |
| Operation | post_kms_secrets |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Stores or replaces one secret in your org.
Upserts one secret under the caller's own org. The value is sealed before it is written — a fresh per-secret data key, itself wrapped by the master key — so plaintext never reaches disk. The receipt confirms the name and environment that were written and does not echo the value.
env is REQUIRED on a write and has no default, which is the rule most easily
got wrong here: reads and deletes still fall back to the default environment
for older callers, but a write must not, because the environment is part of
the storage key. A silently defaulted write lands in a bucket the readers that
resolve project, environment and path never look in, and the stale value keeps
being served — so the write fails loudly instead.
name is required, path is an optional subpath beneath the org root, and
the org is taken from the validated claim rather than the body.
Requires ADMIN authority over the org — a member reads, an admin writes. A machine credential holds no membership and so is never an org admin: it can read the secrets it was issued for and cannot replace one. Fail-closed admission, in order: admin of the org, well-formed org, master key present — 403, 400 and 503, all decided before any record is touched.
Request
4 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
env | body | string | — | Env is the environment to write under. REQUIRED, with no default: it is part of the storage key, so a silently defaulted write lands in a bucket the readers… |
name | body | string | — | Name is the secret's name. |
path | body | string | — | Path is an optional subpath beneath the org root, e.g. |
value | body | string | — | Value is the secret itself. It is sealed under a fresh per-secret data key before storage, so plaintext never reaches disk, and it is never echoed back,… |
Response
| Status | Body | Meaning |
|---|---|---|
200 | kmsStored | ok |
200 body — 3 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
env | body | string | — | Env is the environment the secret was written under. |
name | body | string | — | Name is the secret's name. |
stored | body | boolean | — | Stored is true; a write confirms by not failing. |
Failure carries the platform error shape — see Errors.
Examples
hanzo kms secrets createimport { Configuration, KmsApi } from 'hanzoai';
const api = new KmsApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postKmsSecrets({ env: "<env>", name: "<name>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import KmsApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = KmsApi(client).post_kms_secrets(env="<env>", name="<name>")cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.KmsAPI.PostKmsSecrets(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, kms_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = kms_api::post_kms_secrets(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.KmsApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new KmsApi(client).postKmsSecrets();curl -X POST https://api.hanzo.ai/v1/kms/secrets \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"env": "<env>",
"name": "<name>"
}'The door reaches kms through the kms tool, which names its 2 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
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_kms_config"
}
}
}'How is this guide?