Update a virtual key
/v1/virtual-keys/{slug}Update a virtual key.
Changes the key's name, note, expiry, metadata, model allowlist, guardrails, credit settings and rate limits. The credential mode, provider keys, organization and workspace cannot be changed here (move a key with "Transfer a virtual key"; for other provider keys, create a new key).
How each field is applied:
name,noteandcredit_reset_policychange when present and are kept when left out. Settingcredit_reset_policyalso schedules its next reset from now.- The limits
credit_limit_usd,credit_alert_threshold_usd,rate_limit_rpm,rate_limit_tpmandrate_limit_rpd: a number sets the limit,nullremoves it, and leaving the field out keeps it. guardrail_slugs: a list replaces the attached guardrails ([]detaches them all); leaving it out keeps them.expires_at,metadataandmodel_allowlist: a value replaces it,nullremoves it (the key no longer expires, has no metadata, or may call every model), and leaving the field out keeps it.
When the credit limit changes, the status follows it: an EXHAUSTED key whose limit is removed, or raised above what it has spent, becomes ACTIVE; an ACTIVE key whose limit is lowered to what it has spent, or below, becomes EXHAUSTED. DISABLED and EXPIRED keys keep their status.
Requires an organization admin key, or a workspace admin key for the key's workspace.
Errors: 400 for a body that does not match the schema, or a guardrail slug that is unknown, duplicated or in another workspace; 403 without the required role; 404 when no key has this slug.
Authorization
AuthorizationBearer va_A platform API key (
va_...), created under Settings > API keys. Scoped to an organization or one workspace, with an admin or member role. Used by the management API.
Path parameters
slugstringrequiredthe key's slug
Request body application/json
the fields to change
namestringThe key's new name. Left out or
null: unchanged.notestringThe key's new note. Left out or
null: unchanged.expires_atstring<date-time>When the key expires (ISO 8601 date-time).
null: the key no longer expires. Left out: unchanged.metadatamap<string, string>Your own string key/value pairs, replacing the current ones.
nullor{}clears them. Left out: unchanged.model_allowliststring[]The models the key may call (see the key's
model_allowlist), replacing the current list.nullor[]allows every model. Left out: unchanged.guardrail_slugsstring[]Slugs of the guardrails to run on the key's requests. A list replaces the attached guardrails,
[]detaches them all; left out ornull: unchanged. Each must belong to the key's organization and, when it belongs to a workspace, to the key's workspace; no duplicates.credit_limit_usdnumber<double>The most the key may spend, in USD. A number sets it,
nullremoves the limit, left out: unchanged. The key's status follows the new limit (ACTIVEorEXHAUSTED).credit_alert_threshold_usdnumber<double>The soft spend alert, in USD. A number sets it,
nullremoves it, left out: unchanged.credit_reset_policyenum<string>When the key's spend goes back to zero:
MONTHLY,WEEKLYorNEVER. Setting it schedules the next reset from now. Left out ornull: unchanged.One of
"MONTHLY","WEEKLY","NEVER"rate_limit_rpminteger<int32>Requests per minute. A number sets the limit,
nullremoves it, left out: unchanged.rate_limit_tpminteger<int32>Tokens per minute. A number sets the limit,
nullremoves it, left out: unchanged.rate_limit_rpdinteger<int32>Requests per UTC day. A number sets the limit,
nullremoves it, left out: unchanged.
Responses
slugstringThe key's stable identifier:
vk-followed by 16 hex characters. Used in URLs, logs and routing configs.token_hintstringThe last characters of the API key's secret, to tell keys apart. Absent for a key with
legacy_auth.legacy_authbooleanTrue for a key created before API keys existed: its bare slug still authenticates, until the key is rotated for the first time.
rotated_atstring<date-time>When the API key was last rotated (ISO 8601 date-time). Absent if it never was.
namestringThe key's name, unique within the organization.
notestringA free-text note about the key. Absent when none was set.
statusenum<string>The key's status:
ACTIVE: requests are served.DISABLED: turned off by an admin; requests are refused (403) until it is enabled.EXHAUSTED: its spend reachedcredit_limit_usd; requests are refused (403) until the limit is raised or removed, the spend resets (credit_reset_policy) or, for a PLATFORM key, credit is added.EXPIRED: pastexpires_at; final.
One of
"ACTIVE","DISABLED","EXHAUSTED","EXPIRED"disable_reasonstringThe reason given when the key was disabled. Absent unless the key is
DISABLEDwith a reason.credential_modeenum<string>Where the provider credentials come from:
BYOK(your provider keys, incredentials) orPLATFORM(VectorAxis's provider accounts, paid from your organization's credits).One of
"BYOK","PLATFORM"credentialsobject[]The key's provider credentials, as hints only. Empty for a PLATFORM key.
Child attributes
providerstringThe provider id, e.g.
OPENAI(see "List supported providers").key_hintstringThe last four characters of the provider key, to tell keys apart.
vertex_project_idstringFor a
VERTEX_AIcredential: the Google Cloud project id. Absent for other providers.vertex_regionstringFor a
VERTEX_AIcredential: the Vertex AI region, orglobal. Absent for other providers.
organizationstringThe slug of the organization the key belongs to.
workspace_idstring<uuid>The workspace the key belongs to (UUID).
created_atstring<date-time>When the key was created (ISO 8601 date-time).
updated_atstring<date-time>When the key's settings or status last changed (ISO 8601 date-time).
expires_atstring<date-time>When the key expires (ISO 8601 date-time). Absent: it never expires.
last_used_atstring<date-time>When the key last served a request (ISO 8601 date-time). Absent if it never has.
total_requestsinteger<int64>How many requests the key has served.
total_cost_usdnumber<double>What the key has spent, in USD, since it was created or since its last credit reset. This is the figure
credit_limit_usdandcredit_alert_threshold_usdare compared with.metadatamap<string, string>Your own string key/value pairs. Absent when none are set.
model_allowliststring[]The models the key may call; others are refused (403
MODEL_NOT_ALLOWED). Absent: every model.credit_limit_usdnumber<double>The most the key may spend, in USD, before it becomes
EXHAUSTED. Absent: no limit.credit_alert_threshold_usdnumber<double>The soft spend alert, in USD: at or above it the key carries the
ALERT_THRESHOLD_EXCEEDEDwarning. Absent: no alert.credit_reset_policyenum<string>When the key's spend goes back to zero:
MONTHLY(the 1st of each month, 00:00 UTC),WEEKLY(each Monday, 00:00 UTC) orNEVER.One of
"MONTHLY","WEEKLY","NEVER"credit_next_reset_atstring<date-time>When the next credit reset is due (ISO 8601 date-time). Absent when the policy is
NEVER.rate_limit_rpminteger<int32>The most requests per minute (a 60-second window). Absent: no limit.
rate_limit_tpminteger<int32>The most tokens per minute (a 60-second window). Absent: no limit.
rate_limit_rpdinteger<int32>The most requests per UTC calendar day. Absent: no limit.
initial_credits_usdnumber<double>For a PLATFORM key: the credit in USD it was created with. Absent for a BYOK key.
credit_balance_usdnumber<double>For a PLATFORM key: what it may still spend, in USD (
credit_limit_usdminustotal_cost_usd). Absent for a BYOK key, or when there is no limit.provider_whiteliststring[]For a PLATFORM key: the only providers it may use, as provider ids. Absent: any provider.
guardrail_slugsstring[]Slugs of the guardrails run on every request made with the key. Absent: none.
markup_pctnumber<double>For a PLATFORM key: its own markup on the provider's price, as a fraction (
0.06is 6%). Absent: the platform default markup applies.warningsenum<string>[]Advisory warnings, computed when the key is read; they never block requests:
ALERT_THRESHOLD_EXCEEDED:total_cost_usdhas reachedcredit_alert_threshold_usd.EXPIRING_SOON: the key expires within the next few days.
Empty when there is nothing to report.