Update Directives
Change a project's, environment's or key's Directives, based on the policy_version you read. A stale version is refused with 409 and nothing changes. Also /v1/environments/{id}/directives and /v1/keys/{id}/directives.
Body
application/json; directives or set, not both- policy_versionintegerrequired
The version you read. It moves on by one with each change.
- directivesobjectoptional
The whole level, replacing what is there.
{}clears it. - setobjectoptional
Single fields by path, keeping everything else, as the console's table edits do:
allowedModels,limits.requestsPerMinute,budget.monthlyUsd,alerts.budgetPercentages…nullclears a field. One tag budget istagBudgets.inference-bureau-search(the whole entry;nullremoves it) ortagBudgets.inference-bureau-search.monthlyUsd; other tags are kept. One alias isaliases.org/fast, set to a model id or a preset (nullremoves it); other aliases are kept.allowedModelstakes model ids andvendor/*. A preset may carrydeprecatedAt(YYYY-MM-DD, UTC) andreplacedBy(another alias or a model id) to retire the alias.
Notes
- Validationoptional
Exactly as in the console: unknown fields, unknown routing profiles, uncertified fallback models, allowed models that are neither an id nor
vendor/*, and an alias replaced by itself or by an uncertified model are refused with400 invalid_request.alerts.lowBalanceUsdis set in the team's Directives, so projects, environments and keys refuse it. Revoked and expired keys can't change. - Conflictsoptional
409 version_conflictwhen the level changed since you read it, in the console or the API. Read it again and reapply. - Auditoptional
A
policy.updateevent with the policy before and after.