Set a virtual key's default context sources
/v1/virtual-keys/{slug}/contextSet a virtual key's default context sources.
Every chat completion, Claude Messages and Responses request on the key then gets context from these sources with no code change: the gateway chooses the sections relevant to the request and adds them, as with x-context-source. A request's own x-context-source replaces the defaults, x-context-source: none turns them off, and x-context-budget, x-context-required, x-context-model and x-context-timeout adjust them. A source that is later deleted, loses the key's access or is not READY is skipped (x-context-status: UNAVAILABLE when none is left). An empty sources list removes the defaults. Each change is recorded in the sources' audit logs.
Requires a workspace admin key for the virtual key's workspace (or an organization admin key) and a plan that includes context sources (402 otherwise). Returns 400 when a source is not in the key's workspace, the key has no access to it, or the budget or time limit is out of range, 404 when the virtual key does not exist.
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 virtual key's identifier (
vk-...).
Request body application/json
The default sources and settings.
sourcesstring[]requiredContext source ids (
ctx-...) of the key's workspace, at most 5, that the key has access to. An empty list removes the defaults. A source that is later deleted, loses the key's access or is not READY is skipped (the request goes without it,x-context-status: UNAVAILABLEwhen none is left).At most 5 items
budgetinteger<int32>Most tokens of section text to add, 200 to 100000. Absent: 6000.
requiredbooleanFail a request instead of sending it without context. Default false.
modelstringThe model that chooses the sections. Absent:
gpt-6-luna.At least 0 characters · At most 200 characters
timeout_msinteger<int32>Most milliseconds the section selection may take, 100 to 60000, or 0 for no limit. Past it the request goes without context (
x-context-status: SELECT_TIMEOUT), or fails whenrequiredis true. Absent: 8000.updated_bystringWho last changed the defaults. Read-only.
updated_atstring<date-time>When they were last changed. Read-only.
Responses
sourcesstring[]requiredContext source ids (
ctx-...) of the key's workspace, at most 5, that the key has access to. An empty list removes the defaults. A source that is later deleted, loses the key's access or is not READY is skipped (the request goes without it,x-context-status: UNAVAILABLEwhen none is left).At most 5 items
budgetinteger<int32>Most tokens of section text to add, 200 to 100000. Absent: 6000.
requiredbooleanFail a request instead of sending it without context. Default false.
modelstringThe model that chooses the sections. Absent:
gpt-6-luna.At least 0 characters · At most 200 characters
timeout_msinteger<int32>Most milliseconds the section selection may take, 100 to 60000, or 0 for no limit. Past it the request goes without context (
x-context-status: SELECT_TIMEOUT), or fails whenrequiredis true. Absent: 8000.updated_bystringWho last changed the defaults. Read-only.
updated_atstring<date-time>When they were last changed. Read-only.