Update Key
Update a key’s name, disabled state, spend limit, model allowlist, routing policy binding or expiry. Only the fields you send change; send null to remove a limit, allowlist, binding or expiry. A key’s project can’t be changed.
Authentication
A management key (mgmt_...), sent as Authorization: Bearer <key>. Reading /v1/routing-policies also accepts the organization’s gateway API keys; writing there needs a management key.
Path parameters
The key’s hash from a create or list response.
Request
Managed by Merge for Workforce; sending this field is a 400.
When the key stops working. Null means it never expires. Must be in the future; a value without an offset is UTC. Send null to remove the expiry; omit it to leave the expiry unchanged.
New spend cap in USD. Omit to keep the current cap; send null to remove it.
New window for the spend cap: daily, weekly or monthly, reset at midnight UTC.
Can’t be changed after creation; sending a value is a 400.
Response
The part of usage from requests that ran on the organization’s own provider credentials (BYOK).
The BYOK part of usage_daily.
The BYOK part of usage_monthly.
The BYOK part of usage_weekly.
Stable identifier for the key: the SHA-256 hash of the raw key, as 64 hex characters. Not the secret, so it’s safe to store and log. Use it in get, update and delete calls.
Display label: the key’s first characters, like mg_8Kx2pQr. Not the secret.
Spend in USD in the current limit_reset window.
Models the key may call. Null means unrestricted; an empty list blocks every model.
Spend cap in USD over the limit_reset window. Null means no cap.
Spend left in USD before the cap: limit minus usage, never below 0. Null when there’s no limit.
The window the spend cap applies to, reset at midnight UTC: daily, weekly (from Monday) or monthly (from the 1st). Monthly when unset.
Project the key is scoped to, or null for an organization-wide key. Can’t be changed after creation.