API reference · Secrets
Rename a secret or replace its value
/v1/secrets/{secret_id}- TypeScript
client.secrets.update()- Python
client.secrets.update()- CLI
hayonix secrets update
Changes the name, the value or both. Containers already running keep the value they started with; containers created afterwards get the new one.
Project API key (Authorization: Bearer sk_…), or a console session. Requires the secret:update permission (a key's scope, or a role that includes it).
Examples
The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.
curl -sS -X PATCH "$API_BASE_URL/secrets/sec_01jc5zq4m8k3v6x9t2w7r0b1e4" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"value": "hf_rotated_value"
}'Request
| Header | Required | Description |
|---|---|---|
Authorization | yes | Bearer and your API key. The key implies its project. |
X-Project-Id | session only | The project to act in, for console sessions. Requests with an API key leave it out. |
Path parameters
secret_idstringrequiredID of the secret
ID with prefix sec_
Body
JSON (application/json): UpdateSecretRequest.
namestringEnvironment-variable style name, unique in the project
pattern ^[A-Za-z_][A-Za-z0-9_]{0,127}$
valuestringWrite-only. Never returned.
1–65536 characters
Response
200 Secret — The updated secret
objectstringrequiredAlways `secret`: the type of this object
One of
secretidstringrequiredUnique ID (`sec_…`)
ID with prefix sec_
project_idstringrequiredProject it belongs to
ID with prefix prj_
namestringrequiredIts name
created_by_user_idstring | nullrequiredID of the user who created it
created_byobject | nullrequiredWho created it (null: created by the platform)
ShowHide 3 fields of
created_byobjectstringrequiredAlways `person`
One of
personidstringrequiredThe person’s user ID (`usr_…`)
namestring | nullrequiredTheir name as they set it; null when they are no longer a member of the organization
created_atstring (date-time)requiredWhen it was created (ISO 8601, UTC)
updated_atstring (date-time)requiredWhen it last changed (ISO 8601, UTC)
Example response
{
"object": "secret",
"id": "sec_01jc5zq4m8k3v6x9t2w7r0b1e4",
"project_id": "prj_01jc5zq4m8k3v6x9t2w7r0b1e4",
"name": "string",
"created_by_user_id": "string",
"created_by": {
"object": "person",
"id": "string",
"name": "string"
},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}Errors
Errors use the standard envelope. What this operation can answer:
| Status | Type | When |
|---|---|---|
400 | invalid_request_error | A parameter or body field is missing or not allowed; param names it. |
401 | authentication_error | The key or session is missing, revoked or expired. |
403 | permission_error | The credential lacks the permission this needs, or the organization is suspended. |
404 | not_found_error | No such resource in this project (an ID from another project is answered the same way). |
409 | conflict_error | The resource's current state does not allow this. |
429 | rate_limit_error rate_limited | Too many requests; retry after retry-after seconds. |