Tenants & gateways API
Tenants are the top-level organisational unit. Each tenant contains one or more gateways. A gateway holds a configuration object, a set of provider keys, routing rules, and auth tokens.
Base URL: https://<your-gateway-host>/admin/v1
Storage faults. A database fault on any tenant or gateway route — including the tenant export,
deletion protocol, branding and assets, tenant keys, restore, delete and PATCH, and the gateway's
routing rules, managed grants, local-model blocks and provider keys — follows the one admin rule: a
failed read (an existence or access check, a list, a lookup the answer depends on, the read before
a write) answers 503 { "error": "temporarily unavailable; retry later" } (nothing written; retry); a
failed write answers that 503 only when nothing was written, otherwise the sanitised
500 { "error": "internal error", "request_id": "…" } (re-read before repeating). The cause is logged
under the request_id, never returned. See
Storage faults.
Endpoints
| Method | Path | Description |
|---|---|---|
GET |
/tenants |
List all tenants |
GET |
/tenants/{id} |
Get a single tenant |
POST |
/tenants |
Create a tenant (platform admin only) |
POST |
/tenants/{id}/siem/test |
Send one test event to a SIEM target (details) |
PATCH |
/tenants/{id} |
Update a tenant |
DELETE |
/tenants/{id} |
Soft-delete (decommission) a tenant — disables all auth + routing for it; precedes purge. Platform admin (any tenant) or an org admin of their own tenant; requires a {"confirm":"<slug>"} token; "users": "delete" (platform admin) also deletes its users |
PUT |
/tenants/{id}/account-group |
Re-classify a tenant's account group (paying / myra / test) for product analytics — platform-admin only, never while impersonating, audited, always retroactive. See Account group. A transient database fault with nothing written answers 503 + Retry-After |
GET |
/tenants/{id}/private-destinations |
Read the tenant's private-destination allowlist and ceiling — tenant admin / tenant_admin of that tenant or a platform admin; a member gets 403. See Private destination allowlist |
PUT |
/tenants/{id}/private-destinations |
Replace the allowlist (cidrs, tenant admin or platform admin) and/or the ceiling (ceiling, platform admin only) — audited; a tenant admin's change may be held for approval. See Private destination allowlist |
GET |
/tenants/{id}/connector-egress-hosts |
Read the tenant's connector egress host list — platform admin only (an impersonating platform admin is refused). Consulted by every MCP connector call of the tenant. See Connector egress hosts |
PUT |
/tenants/{id}/connector-egress-hosts |
Replace the connector egress host list (hosts) — platform admin only, audited. See Connector egress hosts |
POST |
/tenants/{id}/restore |
Restore (undo) a soft-deleted tenant — clears deleted_at, resumes routing (platform-admin only; 409 on a purged tenant) |
DELETE |
/tenants/{id}/purge |
Irreversibly hard-delete ALL tenant data (platform-admin only, confirmation required) |
GET |
/tenants/{id}/export |
Exit data export: full tenant handover as a JSON+CSV ZIP (?format=json for the manifest only) |
GET |
/tenants/{id}/deletion-protocol |
Machine-readable deletion protocol (Löschprotokoll) for a purged tenant — counts-only, platform-admin only |
GET |
/tenants/{id}/analytics |
Per-tenant timeseries plus top-models for the analytics detail panel. Takes since (epoch ms), bucket (5m/15m/30m/1h/6h/1d, default 1d) and n (default 30, capped at 168) with the same strict rules as /stats/timeseries — a malformed value is 400, never the default answered as the request — and tz_offset, which (as on /stats and /stats/timeseries) falls back to UTC when malformed |
GET |
/tenants/{id}/spend |
Tenant spend history across periods |
DELETE |
/tenants/{id}/budget |
Reset the tenant spend counter (optional ?period= filter) — platform-admin only, audited |
GET |
/tenants/{id}/keys |
List tenant-scoped provider keys (TENANT_SETTINGS_MANAGE; 403 otherwise) |
POST |
/tenants/{id}/keys |
Store a tenant-scoped provider key |
DELETE |
/tenants/{id}/keys/{provider}/{alias} |
Delete a tenant-scoped provider key |
GET |
/tenants/{id}/sso-config |
Get the tenant's OIDC SSO config (never returns the secret; SSO_MANAGE, 403 otherwise) |
PUT |
/tenants/{id}/sso-config |
Create/update the OIDC SSO config (tenant_admin) |
DELETE |
/tenants/{id}/sso-config |
Remove the OIDC SSO config (tenant_admin) |
GET |
/tenants/{id}/sso-mapping |
The Sign-in Mapping table: one row per group_mapping entry with kind, target label and people count. Needs SSO_MANAGE and access to the tenant (details) |
GET |
/tenants/{id}/sso-enforcement |
Get the tenant's SSO enforcement: { enforced, break_glass_user_ids, domains }. domains are the allow-listed domains of the tenant's enabled OIDC / SAML configs. Needs SSO_MANAGE and access to the tenant; 404 for an unknown tenant |
PUT |
/tenants/{id}/sso-enforcement |
Turn "Require single sign-on" on or off. Body { "enforced": <boolean>, "break_glass_user_ids": [<user uuid>, ...] } — both fields are required (the list may be empty when enforced is false). Returns 200 with the saved { enforced, break_glass_user_ids, domains }. Enabling revokes the existing sessions and device sign-ins of the enforced domains' users (break-glass users keep theirs; API tokens are not revoked); removing an id from the list while enforced revokes that user's sessions; every save writes an audit entry. Rejects, in validation order, never writing anything: 400 malformed_body (body not valid JSON, or valid JSON that is not an object — nothing is read as {}), 400 invalid_request (enforced absent or not a boolean; break_glass_user_ids absent, not a list, more than 10 entries, an entry that is not a UUID, or a duplicate — the field property names the offender), 400 break_glass_required (enforcing with an empty list), 400 invalid_break_glass_user_ids (an id is not a user of this tenant), 409 sso_not_configured (no enabled OIDC config and no enabled SAML config the gateway can serve — SAML needs its validator configured), 409 sso_domain_in_use (a domain is used by another tenant's SSO config, by an account outside this tenant, or by a paid self-serve signup still in flight). The two 409s are checked only when switching enforcement ON; re-saving an already-enforced tenant (e.g. editing its break-glass list) is not blocked by them. 404 (unknown tenant). An empty JSON object {} as the whole body is a valid object with both fields absent, so it answers 400 invalid_request. An OIDC or SAML config save answers, in this order: 409 sso_domain_conflict (another organisation's enabled config holds a domain, or a domain newly added to this tenant's stored OIDC/SAML configs has accounts outside the tenant; enforced or not), then, only while enforced, 409 sso_domain_in_use (a domain the save newly covers but this tenant already holds in its own stored rows - a disabled stored config being re-enabled, or a domain carried over from its other-protocol config - has accounts outside the tenant). A save that passes revokes the newly covered domains' sessions |
GET |
/tenants/{id}/signin-policy |
The organisation's sign-in option { signin_policy, enforced } (email_code or password_mfa). Needs SSO_MANAGE and access to the tenant; 404 like an unknown route while the option is not rolled out to the organisation. Contract: Authentication |
PUT |
/tenants/{id}/signin-policy |
Change the sign-in option (enforced only by a platform admin; a downgrade needs a step-up). Audited as tenant.signin_policy_changed; signs nobody out. Contract: Authentication |
GET |
/tenants/{id}/saml-config |
Get the tenant's SAML SSO config (the IdP signing cert is public — returned in full; SSO_MANAGE, 403 otherwise) |
PUT |
/tenants/{id}/saml-config |
Create/update the SAML SSO config (tenant_admin) |
POST |
/tenants/{id}/saml-config/metadata-import |
Preview an IdP metadata import from an https URL (stores nothing; SSO_MANAGE) |
PUT |
/tenants/{id}/mapping-sources |
Set or clear the SAML department_attribute only (SSO_MANAGE; Mapping card) |
DELETE |
/tenants/{id}/saml-config |
Remove the SAML SSO config (tenant_admin) |
GET |
/tenants/{id}/scim-credential |
SCIM credential status (configured, base URL, created_by) — never the token (SSO_MANAGE) |
POST |
/tenants/{id}/scim-credential |
Generate/rotate the SCIM bearer (returns the plaintext ONCE; tenant_admin) |
DELETE |
/tenants/{id}/scim-credential |
Revoke the SCIM credential (tenant_admin) |
GET |
/tenants/{id}/scim-status |
SCIM provisioning health: state, last activity, user and group counts (SSO_MANAGE; see SCIM status) |
GET |
/tenants/{id}/scim-sync-log |
The tenant's scim.* audit rows, keyset-paged (SSO_MANAGE and TENANT_AUDIT_VIEW) |
GET |
/gateways |
List every gateway you can reach in one request — a platform admin: every tenant's; anyone else: their own tenant's. See Listing every gateway you can reach |
GET |
/tenants/{id}/gateways |
List gateways for a tenant |
POST |
/tenants/{id}/gateways |
Create a gateway — or update one: this is a true upsert, and posting an existing slug updates that gateway rather than creating a second one (send create_only: true to refuse an existing slug with 409 slug_taken instead) |
GET |
/gateways/{id} |
Get a single gateway |
PATCH |
/gateways/{id} |
Update gateway config |
DELETE |
/gateways/{id} |
Delete a gateway. Its stored replay records are deleted with it. A very large store is cleared in bounded steps, so DELETE can return before every record is gone; the hourly cleanup removes the rest. The deletion is recorded as a gateway.deleted audit event with the number of records removed. The gateway's human-review records are kept for 730 days (see Purging a tenant); only the held tool call is erased at once |
GET |
/gateways/{id}/spend |
Gateway spend history across periods |
GET |
/gateways/{id}/budget |
Gateway budget status: cap + authoritative current-period spend + a per-model breakdown on the charged amount |
DELETE |
/gateways/{id}/budget |
Reset the gateway spend counter (optional ?period= filter) — platform-admin only, audited |
GET |
/gateways/{id}/keys |
List gateway-scoped provider keys |
POST |
/gateways/{id}/keys |
Store a gateway-scoped provider key |
DELETE |
/gateways/{id}/keys/{provider}/{alias} |
Delete a gateway-scoped provider key |
GET |
/managed-models/catalog |
List the Myra-provided (keyless) models that may be enabled |
GET |
/gateways/{id}/managed-models/catalog |
The Myra-provided models judged for this gateway: unavailable names why enabling one would be refused (GATEWAYS_MANAGE) |
GET |
/gateways/{id}/managed-models |
List a gateway's enabled Myra-provided models |
POST |
/gateways/{id}/managed-models |
Enable a Myra-provided (keyless) model on a gateway |
DELETE |
/gateways/{id}/managed-models/{provider}/{model} |
Disable a Myra-provided model |
GET |
/gateways/{id}/local-models |
List the Myra-hosted local fleet with per-gateway enable state |
POST |
/gateways/{id}/local-model-blocks |
Disable (hard-block) a Myra-hosted local model on a gateway |
DELETE |
/gateways/{id}/local-model-blocks/{provider}/{model} |
Re-enable a Myra-hosted local model |
GET |
/tenants/{id}/model-blocks |
List the tenant-wide model blocks (GATEWAYS_MANAGE) |
POST |
/tenants/{id}/model-blocks |
Block a model for every gateway of the tenant (GATEWAYS_MANAGE) |
DELETE |
/tenants/{id}/model-blocks/{provider}/{model} |
Lift a tenant-wide model block |
POST |
/providers/test-base-url |
Pre-save reachability check for a provider base-URL override (SSRF-guarded dial; GATEWAYS_MANAGE; rate-limited + audited) |
POST /gateways/{id}/managed-models first rejects any provider/model outside the server-side
supported allowlist with 400. It then refuses — and persists nothing — any grant that this gateway
would never offer, judged by the same check the model pickers and the router use. A grant it
accepted could never appear in a picker or route, so it is not created rather than silently stored:
| Refusal | Status | code |
When |
|---|---|---|---|
| Not available on this deployment | 409 | managed_model_unavailable |
The platform model pool is not configured on the deployment (operations has not wired the managed Anthropic pool), or the model has no billable price. Permanent until operations acts — trying again changes nothing. |
| Not in the plan | 400 | plan_model_not_allowed |
A self-serve workspace whose plan does not include the model. |
| Not allowed on this gateway | 409 | managed_model_gateway_restricted |
The gateway's own settings exclude the provider: its approved-provider list, EU data residency, a sub-processor objection, or a custom endpoint (provider_base_urls) for that provider — Myra's key is never sent to a custom endpoint. |
| Gateway configuration unreadable | 500 | configuration_error |
The gateway's stored configuration cannot be resolved. |
A database fault while reading the gateway configuration or the price list answers 503 (retryable,
nothing written). The gateway's purpose is not judged: a grant prepared on a test gateway goes live
when the gateway is promoted to production. Otherwise a supported model is enabled and returns 201.
GET /gateways/{id}/managed-models/catalog answers the same question before the click. It needs
GATEWAYS_MANAGE and access to the gateway (otherwise 403, nothing listed) and returns every
supported model, sorted, as {provider, model, unavailable}. unavailable is JSON null when
POST would enable it, else the reason POST would refuse it with: pool_unwired or not_priced
(→ managed_model_unavailable), not_member (→ plan_model_not_allowed), gateway_restricted
(→ managed_model_gateway_restricted) or no_config (→ configuration_error). Both routes use one
judgement, so the list and the refusal cannot disagree. A database fault while reading the gateway, its
configuration or the price list answers 503 (retryable) instead of a list computed on a failed read.
The deployment-wide GET /managed-models/catalog (the bare supported set, no verdict) is unchanged.
Every supported model ships with its provider list price (raw cost, per 1 000 tokens, in a database
migration), so a fresh deployment can enable it before the first catalog sync. The platform margin is
added when a call is charged, not stored in the price. Once a day the gateway checks that every
supported model still has a price and alerts operations (unpriced_managed_model) if one has none.
Model id shape (all four model-keyed routes). POST and DELETE on /gateways/{id}/managed-models and on /gateways/{id}/local-model-blocks apply the same model-id rule as PUT /model-prices (see Models): ASCII letters and digits plus . _ : / ~ @ -, at least one letter or digit, at most 128 bytes. A model id with whitespace (including a leading or trailing space), control characters, %, a backslash or any non-ASCII character, a non-string model, or an id over 128 bytes is refused with 400 and code: "invalid_model_id" and nothing is written or deleted, because the database's trailing-space- and accent-insensitive collation would otherwise match such an id to a real grant or block row. The error text echoes the id with control and non-ASCII bytes replaced by ?, cut to 160 bytes. DELETE applies the rule to the URL segment after URL decoding.
Gateway tokens, routing rules, guardrails, and traces have their own pages: see Users and tokens, Routing rules, Guardrails, and Traces.
🔒
PATCH /gateways/{id}accepts one top-level key:config. Any other key (a typo such asconfg, or a field from another route) is refused with400 Bad Request{ "error": "…", "code": "unknown_field", "field": "<key>", "message": "…" }and nothing is saved, not even a validconfigsent beside it. When several keys are unknown,fieldnames the first in sorted order; the echo has ASCII control characters and invalid UTF-8 bytes replaced by?and is capped at 64 bytes. The check runs after authentication and the gateway access check (403/404come first) and beforeconfigvalidation. A body that is not a JSON object (an array) is400 malformed_body;{}andnullstay a200no-op. Earlier versions ignored unknown keys and answered200 {"ok":true}, so a client that sends extra keys must stop doing so.💡
configmust be a JSON object. OnPOST /tenants/{id}/gatewaysandPATCH /gateways/{id}, theconfigfield — when present — must be a JSON object. A scalar (number/string/boolean) or an array is rejected with400 Bad Requestand nothing is persisted. This guarantees a gateway's stored config can never become anull/scalar/array value that would break every later read of the gateway.An omitted
confignever destroys one.POSTto an existing slug is an upsert, so both routes treat an absent field and an explicit JSONnullthe same way — leave the stored config exactly as it is:
configin the bodyexisting gateway new gateway omitted untouched {}nulluntouched {}{}replaced with {}— the explicit wipe{}{ … }replaced on POST, shallow-merged onPATCHstored scalar or array 400, nothing persisted400Emptying a gateway's configuration is therefore something a caller has to say (
"config": {}), not something that happens because a field was left out. This matters most for a client that "patches by re-posting" a partial body such as{"slug": "main", "purpose": "archived"}: previously that request silently discarded the gateway's whole guardrail list — every PII detector included — and still answered201.
Validated config fields (rejected → 400). These config leaves are validated at the write boundary; a bad value is rejected and nothing is persisted. The rejection body is { "error": "<human-readable message>", "code": "invalid_config", "field": "<dotted path>" }: field names the refused setting (for example rate_limit, retry_count, circuit_breaker.window_sec, context_compaction.keep_last_turns), and error is a message for people whose wording differs per setting — match on field, not on the text:
config field |
Accepted | Rejected → 400 |
|---|---|---|
circuit_breaker.window_sec / failure_threshold / cooldown_ms |
a JSON integer in range — window_sec [1, 86400], failure_threshold [1, 10000], cooldown_ms [1, 86400000]; null or absent = the default |
a string, boolean, object/array, fractional, 0, negative or above-range value. window_sec: 0 used to make the failure counter never expire. A legacy stored malformed value is read as the default (logged), never as a crash |
circuit_breaker.failure_status_codes |
a JSON array of HTTP status codes (incl. the empty array [] = never trip); absent = default codes |
a non-array, or any non-integer / out-of-range element |
max_parallel_tools |
how many tool calls of one model turn run in parallel (config reference): a JSON integer in [1, 9007199254740991]; null or absent = 4 |
a string ("5", "inf", "1e400"), a boolean, an object/array, 0, a negative or fractional number, or a value above 9007199254740991 ("max_parallel_tools must be a whole number from 1 to 9007199254740991 …"). A legacy stored malformed value is read as 4 (logged) |
retry_count |
a JSON integer in [0, 5]; null or absent = 2 |
a string ("5", "inf", "nan", "1e400"), a boolean, an object/array, a fractional number or a value outside the range ("<field> must be a whole number from <min> to <max> …"). A legacy stored malformed value is read as the default (logged) |
timeout_ms |
a JSON integer in [1, 3600000]; null or absent = 60000 |
a string ("5", "inf", "nan", "1e400"), a boolean, an object/array, a fractional number or a value outside the range ("<field> must be a whole number from <min> to <max> …"). A legacy stored malformed value is read as the default (logged) |
cache_ttl |
a JSON integer in [0, 9007199254740991]; null or absent = 0 |
a string ("5", "inf", "nan", "1e400"), a boolean, an object/array, a fractional number or a value outside the range ("<field> must be a whole number from <min> to <max> …"). A legacy stored malformed value is read as the default (logged) |
context_compaction.threshold_tokens |
a JSON integer in [50000, 9007199254740991]; null or absent = 200000 |
a string ("5", "inf", "nan", "1e400"), a boolean, an object/array, a fractional number or a value outside the range ("<field> must be a whole number from <min> to <max> …"). A legacy stored malformed value is read as the default (logged) |
context_compaction.keep_last_turns |
a JSON integer in [1, 1000]; null or absent = 10 |
a string ("5", "inf", "nan", "1e400"), a boolean, an object/array, a fractional number or a value outside the range ("<field> must be a whole number from <min> to <max> …"). A legacy stored malformed value is read as the default (logged) |
web_search.max_results |
a JSON integer in [1, 9007199254740991]; null or absent = 5 |
a string ("5", "inf", "nan", "1e400"), a boolean, an object/array, a fractional number or a value outside the range ("<field> must be a whole number from <min> to <max> …"). A legacy stored malformed value is read as the default (logged) |
semantic_cache.max_candidates / ttl |
a JSON integer in [1, 9007199254740991]; null or absent = 100 / 86400 |
a string ("5", "inf", "nan", "1e400"), a boolean, an object/array, a fractional number or a value outside the range ("<field> must be a whole number from <min> to <max> …"). A legacy stored malformed value is read as the default (logged) |
semantic_cache.threshold |
a finite JSON number in [0, 1] (fractions allowed); null or absent = 0.95 |
a string ("0.9", "inf", "nan"), a boolean, an object/array, a non-finite number, or a number outside [0, 1] ("semantic_cache.threshold must be a number from 0 to 1 (or null for the default of 0.95)"). A legacy stored malformed value is read as the default (logged) |
compact_error_threshold |
the compaction gate's token budget: a JSON integer in [1, 10000000]; 0, null or absent = gate off |
a string ("500"), a boolean, an object/array, a negative or fractional number, or a value above 10000000 ("compact_error_threshold must be …"); a NaN/Infinity literal is refused earlier by the body parser (400 malformed_body). A legacy stored malformed value is read as off (logged), never as a crash |
log_payloads |
a JSON boolean; null or absent = the default true |
any other value (0, "false", an object …) ("log_payloads must be true or false"). A legacy stored non-boolean is read as false (logged) — never as on, because the switch also governs the turn replay record |
ip_allowlist |
a JSON array of CIDR strings — IPv4/IPv6, bare address or address/prefix (e.g. 10.0.0.0/8, 2001:db8::/32, 192.168.1.1); []/null/absent = no IP restriction |
a non-array (an object — also an empty {} — or a scalar), a non-string element, or any element that is not a valid CIDR |
guardrails / detectors / role_policies.<role>.guardrails (incl. default) |
a JSON array of detectors, or the key omitted; [] is how to clear the list |
a write that carries any of these three as null, false, true, an object (also an empty {}), a string or a number → 400 on POST, PATCH, the guardrail-config import and its dry-run, before any other guardrail check. Omit the key to leave it alone. This changes PATCH {"config": {"guardrails": null}}, which used to be accepted. A legacy stored value of such a shape is grandfathered: re-sending exactly the stored value (an export → dry-run → import round-trip, or a client echoing the GET config) is accepted; a different or newly introduced non-array is rejected |
guardrails[].context_prompt / detectors[].context_prompt (prompt_guard only) |
a valid-UTF-8 string; null clears it; absent = no context |
any non-string type (number, boolean, object/array) or a string that is not valid UTF-8 → 400 invalid_config naming the detector. A value already stored is carried through (grandfathered); one this write introduces or changes is refused. At runtime the text is capped at 2,000 bytes on a character boundary and scrubbed to valid UTF-8 before it reaches the classifier |
guardrails[].url / detectors[].url |
a guardrail detector with no url field (or url: null); the classifier/analyzer endpoints are platform-managed |
any guardrail detector — under either the guardrails or the legacy detectors key — that carries a non-null url. A tenant-set detector endpoint was a server-side request-forgery (SSRF) vector, so it is rejected outright |
The IP allowlist filters inference requests only (a request whose client IP matches no entry is rejected 403, right after authentication and before rate limits and budgets, without waiting for or parsing the request body); it does not restrict the admin API. A stored ip_allowlist that is not an array (a scalar or a non-empty object — e.g. a value written directly to the database) is never read as "no restriction": every request that passes authentication on the inference API (/v1, /copilot/v1, /direct/v1) on that gateway is refused 500 configuration_error until it is corrected; a stored entry that is not a valid CIDR string never matches. See IP allowlist.
🔒 Free-trial gateways are locked (
self_serve_trial). A free-trial workspace is provisioned with two server-fixed gateways —internal(Myra fleet) andexternal(Anthropic Haiku only) — with pre-set per-gateway budgets and provider allowlists (see Budgets). Theexternalgateway (the only one that egresses to a third-party model) is also provisioned with a defaultpii-protectPII-masking guardrail (apii_protectordetector, enabled), so personal data is masked before it leaves for the provider from day one;internalgets no default guardrail. This guardrail is not part of the trial lock below — a tenant admin can edit, toggle, or remove it on the gateway's Guardrails page during the trial and after conversion (see Guardrails). As with any PII-active gateway, a native/v1request toexternalthat carries inline base64 media (image/pdf/audio) is fail-closed rejected (pii_media_unmaskable), since PII inside binary cannot be scanned before it egresses; the workspace chat (server-side text extraction) is unaffected. While the tenant is on theself_serve_trialplan the gateway write boundary is locked server-side so the split cannot be collapsed onto real vendor spend:
PATCH /gateways/{id}that touchesbudget_usd,budget_period,provider_allowlist, orprovider_allowlist_enforced→403 Forbidden{ "error": "…", "code": "trial_gateway_locked" }(the value is not persisted). An edit that touches none of these (e.g. guardrails) still succeeds. Voucher exception: once the workspace has redeemed a voucher (avoucher_grantwallet ledger entry),budget_usdalone becomes editable by a caller withGATEWAYS_MANAGE: the workspace's gateway budgets must sum to at most the wallet's spendable balance: any value from0up to the larger of the gateway's currently stored cap and the balance minus the caps of all the workspace's other gateways (a sibling with no or an unreadable cap counts as the full balance) is accepted; the check runs under a row lock, so two simultaneous raises cannot both succeed (a busy lock answers503, retry; a gateway deleted while the write waited on the lock answers404). ThePATCHresponse'strial_budget_max_usdis computed inside that same locked step, so it always reflects the value just committed. Guardrail-config import and governance apply never changebudget_usdon a trial gateway (it is carried from the locked row). The ceiling is served astrial_budget_max_usdonGET /gateways/{id}, on the list and on thePATCHresponse (only for such a workspace and a caller withGATEWAYS_MANAGE). A higher value is refused400 Bad Request{ "error": "…", "code": "trial_gateway_budget_over_balance", "max_usd": <ceiling> }. A request that also touchesbudget_period, the provider allowlist or its enforcement is still403 trial_gateway_locked.GET /admin/auth/mereportstrial_budget_unlocked: truefor such a workspace (a UX hint only; the server decides on each PATCH). The lock keys on the presence of a locked field, so anull/garbage value is rejected exactly like a real one.POST /tenants/{id}/gateways→403 Forbidden{ "error": "…", "code": "trial_gateway_locked" }for the whole path (creating or replacing a gateway is disallowed; a trial's topology is fixed).DELETE /gateways/{id}→403 Forbidden{ "error": "…", "code": "trial_gateway_locked" }. The web app hides New Gateway and Delete for such a workspace and says why; that is a UX hint only, the server decides.POST /gateways/{id}/guardrail-config/import→403 Forbidden{ "error": "…", "code": "trial_gateway_locked" }if the import would changeprovider_allowlistorprovider_allowlist_enforced(this declarative-replace path can also strip them). A guardrails-only import that leaves those keys unchanged still succeeds.- Applying a governance template (
POST /governance/templates/{id}/apply) that changes a locked control (provider_allowlist_enforced) →403 Forbidden{ "error": "…", "code": "trial_gateway_locked" }.DELETE /gateways/{id}/budgetandDELETE /tenants/{id}/budget(spend-counter resets) →403 Forbidden— but not because of the trial — these two resets are platform-admin only for every plan (a tenant-class actor may never zero the ledger, which would re-open the per-gateway cap and theplatform_cap_usdceiling). The 403 therefore does not lift on upgrade for a tenant admin; only a platform operator can reset spend. See Resetting the tenant/gateway budget counter.The plan is read from the authoritative tenant record (never the request); a transient tenant-lookup failure returns
503(retryable), never a silent bypass. Normal editing resumes automatically once the workspace upgrades to a paid plan.
Tenants
Listing tenants
Response:
[
{
"id": "ten_abc123",
"slug": "myapp",
"plan": "starter",
"spend_cap_usd": null,
"admin_count": 2,
"effective_seat_cap": null,
"effective_spend_cap": null,
"created_at": 1742551200
}
]
Any authenticated member of a tenant may list it (the tenant selector on member surfaces relies on this). A platform admin lists every live tenant; everyone else gets only their own tenant. A user who belongs to no tenant and is not a platform admin gets an empty array []. The response is role-scoped: editor-only configuration is disclosed only to a caller who can edit the tenant (platform admin or tenant_admin). A plain member / ki_manager receives a redacted row that omits the SIEM ingest configuration (siem — which carries the Splunk HEC token / Basic credentials), the tenant spend cap (spend_cap_usd), the platform-admin-set funding ceiling (platform_cap_usd), the DEMO/trial end (trial_ends_at), the code-interpreter artifact cap (code_interpreter_artifact_max_bytes), the plan tier, the org-wide system_instruction, prompt_examples (which carries each example's steering system_prompt), the admin_count, and the effective caps (effective_seat_cap, effective_spend_cap) and the current-month spend against the cap (spend_cap_spent_usd). These fields are never sent to a non-editor. An empty result is the JSON array [].
admin_countis a read-only, server-computed count of the tenant's active administrators — users whose role isadminortenant_admin, excluding soft-deleted and disabled accounts (the same predicate the last-administrator delete/disable guard enforces). It powers the "Organisation admins" column in the admin UI. A tenant with no live administrators returns0(never blank). It is present on this list endpoint only —GET /admin/v1/tenants/{id}(the single-tenant read) does not include it. If the count sub-query faults, the field is returned asnull(the whole list still succeeds — the count degrades to "unknown" rather than failing the request), so a client distinguishes a genuine0from an unavailable count. It is redacted for non-editor members.
effective_seat_cap/effective_spend_capare read-only, server-computed fields that show the tenant's effective caps so an operator can tell an uncapped tenant from a capped one without reading the DB. Both are derived from the single resolver each cap already has (the seat cap from the same resolution user provisioning enforces, as the tenant's current cap: a scheduled seat reduction, which provisioning also enforces, is not reflected here, see Billing; the spend cap mirrors the tenant's configuredspend_cap_usd), never re-computed. Each is either a number (the cap; a0spend cap is a deliberate freeze-all),null(explicitly unlimited), or absent — foreffective_seat_cap, absent means the resolver faulted and the value is unknown (the client renders—, never "unlimited": fail closed). They are present on both this list endpoint andGET /admin/v1/tenants/{id}(recomputed each read, so a value refreshes after aPATCHthat changes budget/plan — unlikeadmin_count, which is list-only), are computed only for an editor (a non-editor member skips the work), and are redacted for non-editor members. A companion worker-0 monitor (admin/uncapped_tenant_watcher) fires a[platform_alert]once when a non-self-serve tenant with no seat cap crosses a user-count threshold.
spend_cap_spent_usdis the read-only, server-computed spend the tenant spend cap is enforced against: the tenant's current calendar month (the cap is monthly), in USD, read from the same spend ledger the enforcement uses. It is emitted only for an editor, and only on a row whosespend_cap_usdis a number (an uncapped tenant omits it; a tenant with a cap and no spend this month reports0). It is present on both this list endpoint andGET /admin/v1/tenants/{id}, is redacted for non-editor members, and is accepted and ignored onPATCH. If the ledger read faults, the field is absent (unknown — a client renders—, never0) while the rest of the response still succeeds.
signin_policy("email_code","password_mfa", or"malformed"for an allowlisted organisation whose stored option is not one of the two) is added to each row of this list for a platform admin only (not while viewing as another user), whilepassword_mfa_enabledis on; otherwise it is absent, except that a malformed or unreadablepassword_mfa_enabled, or, while it is on,password_mfa_tenant_allowlist, answers503 { "error": "temporarily unavailable" }for the whole list, and a database fault reading the stored options answers503for the whole list. PATCH refuses the key (400 unknown_field); the option changes only throughPUT /tenants/{id}/signin-policy. It is list-only (the single-tenant read does not carry it). See the changed routes for what it means and how a client treats an unexpected value.
block_message/ai_policy_urlare returned on this list as strings and are omitted when unset or cleared. See Updating a tenant for the validation rules.
Getting a tenant
Returns the single tenant record. A platform admin may read any tenant; every other caller only their own. Another tenant's id, an unknown id and a soft-deleted tenant all answer 404 (identical, see cross-tenant tenant ids); an unauthenticated caller 401. The same role-scoped projection as the list applies: a non-editor (member / ki_manager) never receives siem, spend_cap_usd, platform_cap_usd, trial_ends_at, code_interpreter_artifact_max_bytes, plan, system_instruction, prompt_examples, or the effective caps and spend (effective_seat_cap, effective_spend_cap, spend_cap_spent_usd) — only a platform admin or the tenant's tenant_admin sees the full configuration. (The effective caps ARE emitted on this single-tenant read for an editor — see the note above — unlike admin_count.)
PII masking of the stored instructions. When the gateway composes
system_instructionand a prompt example'ssystem_promptinto a chat's system prompt, a PII-masking gateway scans them like a client system prompt (PII Protector always under mandatory masking, otherwise when it setsskip_system_messages: false; the NLP PII detector, regex and keyword detectors always), and an operatorblockdetector redacts a match there instead of refusing every turn — see PII Protector — Stored content in the system prompt.
block_message and ai_policy_url are returned as strings; a field that is unset or has been cleared is omitted (not null).
Editor-only enrichment. For an editor, the response also carries the white-label text branding (brand_product_name, brand_home_greeting, brand_chat_disclaimer, brand_sidebar_links) plus the decoded prompt_examples — these live off the tenant list payload (kept off the inference hot path) and are read here via a separate branding query. if that branding sub-read fails (a transient DB fault, or the tenant is deleted between the two reads), the response is still 200 for the rest of the record but the four branding-text fields are absent and a flag "branding_unavailable": true is set. A client MUST treat that as "branding not loaded" (show the fields read-only, and OMIT them from the next PATCH) rather than as an unbranded tenant — sending them back as null would wipe the stored columns. On a successful read the flag is absent.
Creating a tenant
Only a platform admin may create a tenant (permission TENANT_CREATE). Any other role receives 403 { "error": "forbidden", "code": "permission_required" }. A slug that is not a non-empty string, or longer than 255 bytes, is 400. A slug may contain only lower-case ASCII letters, digits and hyphens and must not start with a hyphen (^[a-z0-9][a-z0-9-]*$); anything else (upper case, _, ., a space, a leading -) is 400 { "error": "slug may contain only lower-case letters, digits and hyphens, and must not start with a hyphen", "code": "invalid_slug" } and nothing is created. The slug becomes part of hostnames, hence the single charset.
curl -X POST https://<your-gateway-host>/admin/v1/tenants \
-H "Content-Type: application/json" \
-d '{
"slug": "myapp",
"plan": "starter",
"account_group": "paying"
}'
| Field | Type | Required | Description |
|---|---|---|---|
slug |
string | Yes | URL-safe identifier. Must be unique. Used in inference endpoint URLs. creating a tenant with a slug that already exists is rejected 409 { "error": "an organisation with this name already exists", "code": "slug_taken" } — nothing is created and the existing organisation is left untouched. (Previously this silently returned the existing org's id with 201, creating nothing and dropping the submitted settings.) A genuinely new slug returns 201 { "id", "slug" }. Uniqueness is global (it also covers a soft-deleted organisation still holding the name — purge it to free the slug). On PATCH the slug is read-only: re-sending the unchanged value is a no-op, a different value is 400 read_only_field. |
account_group |
string | Yes (POST only) |
The product-analytics account group of the new tenant: exactly "paying", "myra" or "test" (case-sensitive). An operator-created tenant has no sign-up facts to classify, so the group is required; it is recorded as the tenant's first group event (see Account group). Rejected 400 { "code": "invalid_account_group" } — nothing is created — when it is absent, JSON null, "", not a string, wrong case ("PAYING"), unknown, or "trial" (the trial group is derived from the sign-up lifecycle, never asserted by hand). Not accepted on PATCH — answers 400 unknown_field (use PUT /tenants/{id}/account-group). |
plan |
string | No | Arbitrary plan label (e.g. starter, pro). Not enforced by the gateway. Platform admin only. POST is platform-admin-only for the whole route. On PATCH, a non-platform-admin request that supplies plan with a value different from the stored one is rejected 403 naming the field and writes nothing; omitting it — or re-sending the unchanged value — is a 200 no-op. Every committed plan change is audited (tenant.plan_changed: actor, time, before.plan, after.plan, after.trial_conversion). Customer e-mail (MAP-4935): every committed plan change (the plan differs from the one stored, read under the row lock) also sends the workspace's notification recipient one e-mail admin-plan-changed, in the workspace language (default_locale, English or German). A move to the free trial says that the trial has ended and how to buy a plan, with the price calculator on Your plan while the platform setting paid_signup_enabled is on, otherwise through Contact us (the setting is read when the plan changes). A move to enterprise says that the workspace is on Enterprise and to contact the Myra account manager or support. Any other move names the new plan where it has a customer-facing name (today only self_serve_custom, Custom), else says that Myra changed the plan. The notice is written in the same transaction as the plan change and sent after it, with retries (a failed send never undoes the change; a fault writing the notice rolls the save back: 503 on a transient database conflict, else 500). No e-mail for a save that does not change the plan, and none while the workspace is suspended or partner-billed. A scheduled switch (POST .../plan-switch) sends its own e-mails (below). Free-trial tenants: see Converting a free-trial tenant below — while the platform setting paid_signup_enabled ("Offer paid upgrade at signup") is on, only a move to enterprise is allowed (a trial conversion) and any other change of a trial tenant's plan is refused 409 trial_plan_locked; while it is off, a move to standard or enterprise is a trial conversion. Paying self-serve tenants (for example self_serve_starter) are not locked: a platform admin can move them to free, standard or enterprise. |
grant_usd |
number | No | PATCH only. A one-shot, additive operator FUNDING grant (USD) to the tenant wallet (the wallet money-model rework — replaces the retired budget_usd tenant budget). A value > 0 credits an enterprise tenant's prepaid wallet once — the balance the managed Your plan tile / Wallet page display (billing overview). It is TRANSIENT (not a stored column) and purely additive: two deliberate grants of $50 legitimately make $100; a grant is never a balance-relative "set to X", so it can never claw back or recompute a spent-down balance. Idempotent on grant_nonce (below): a retried request carrying the same nonce dedups (nothing credited twice); two distinct nonces each credit. Platform-admin-only: a grant creates wallet credit from nothing — a Myra operation — so any non-platform actor's grant is rejected 403 (like frozen), never held and never credited; a workspace adds funds only through Stripe checkout. A platform admin's grant credits immediately (200). A grant on a non-enterprise tenant is skipped (200, nothing credited — self-serve tenants fund through Stripe). grant_usd > platform_cap_usd → 400 (the per-grant ceiling, enforced for every role). Fail-closed validation: a negative / NaN / +inf / non-number is rejected 400; absent means no funding action (distinct from a malformed value). 0 is a no-op (nothing to credit). The wallet_ledger row carries the granting admin's id (granted_by) under the admin_grant kind with NULL Stripe fields, and the grant is audited (tenant.funds_granted). |
grant_nonce |
string | with grant_usd |
PATCH only. The client-supplied idempotency token for a funding grant: REQUIRED whenever grant_usd > 0. The SPA mints it once per "Add funds" click and reuses it on a retry, so a lost-response retry dedups instead of double-crediting; a new click mints a new nonce. The server composes a tenant-scoped stored key from it, so a low-entropy or cross-tenant-reused token can never collide with another tenant's grant. Must be a non-empty string of at most 200 characters — absent/empty/overlong with a grant_usd > 0 → 400. |
frozen |
boolean | No | PATCH only, platform admin only. An explicit operator freeze/unfreeze of the tenant wallet (the wallet money-model rework). true freezes the wallet (every request refused regardless of balance, 429 quota_exceeded); false unfreezes. It takes effect immediately (not four-eyes-held — a brake must not wait on approval) and survives a plan tier switch, a trial→paid conversion, and payment: it is cleared only by an explicit operator frozen: false, never automatically. A tenant_admin sending frozen is rejected 403 (a tenant must not unfreeze itself — fail closed); a non-boolean is 400; omitting it is a no-op. Audited (tenant.wallet_frozen_changed). |
spend_cap_usd |
number | null | No | The per-tenant SELF-IMPOSED spend cap. A tenant-wide monthly USD usage ceiling, INDEPENDENT of and BELOW the wallet balance: a request is admitted only if the wallet can pay (and is not frozen) AND the tenant's monthly spend is under this cap. It is the tenant-scope sibling of the per-gateway (gateway.budget_usd) and per-token (auth_token.budget_usd) caps. Tenant-admin-settable — it is not in the platform-admin-only set, because a cap only self-LIMITS (the wallet is the hard money bound): a tenant_admin may set/clear it on their own tenant (TENANT_SETTINGS_MANAGE + own-tenant scope); it is not four-eyes-gated and not bounded by platform_cap_usd for a native tenant. For a partner-billed tenant it is bounded by it: the effective monthly cap is min(spend_cap_usd, platform_cap_usd), and an absent spend_cap_usd means the ceiling binds. null/absent = no cap (unlimited within the wallet); a number >= 0 sets the cap; the window is always monthly (there is no tenant-level period field); 0 is a deliberate freeze-all (every request refused from the first). Fail-closed validation (trust boundary): a non-number is rejected 400 ("spend_cap_usd must be a number or null") and never degrades to NULL/unlimited; a negative/NaN/+inf value is rejected 400; omitting the field preserves the stored value; JSON null clears it. An over-cap request is refused 429 quota_exceeded (the same refusal the per-gateway cap gives); the compaction/summarize route honours it identically. Editor-only (redacted from non-editor members). |
spend_fail_closed |
boolean | No | Tenant-admin settable (permission TENANT_SETTINGS_MANAGE, own tenant). When true, a request whose spend read faults at admission is refused 429 spend_read_failed instead of failing open. A partner-billed tenant always fails closed with 503 spend_unverified instead, whatever this switch says (see Partner-billed tenants). Default false. Accepts only true, false, 1 or 0; anything else (null, a string, another number, an object) is 400 invalid_spend_fail_closed and nothing is written. A change writes a tenant.spend_fail_closed_changed audit row; re-sending the current value does not. GET returns it as 0 or 1. |
block_message |
string | null | No | The tenant's custom message shown to end users when a request is blocked (appended to the refusal of a content-policy block, and shown in the web app's policy-block bubble; see Error codes — tenant block notice). At most 300 Unicode code points (not bytes) after trimming; must be valid UTF-8 and contain no control, line-break or invisible/bidirectional formatting characters. Tenant-admin-settable. Fail-closed validation: a non-string is rejected 400 { "error": "block_message must be a string", "code": "invalid_field", "field": "block_message" }; an over-length value 400 "block_message must be at most 300 characters"; invalid UTF-8 400 "block_message must be valid UTF-8"; a control/formatting character 400 "block_message must not contain control or formatting characters". A rejected field refuses the whole PATCH and writes nothing. Omitting the field preserves the stored value; JSON null, "" or whitespace-only clears it. Digit-only text such as "12345" stays a string. Returned by GET (list and detail) as a string; omitted when unset or cleared. |
ai_policy_url |
string | null | No | Link to the tenant's AI policy (appended to the content-policy refusal as Policy: <url> and shown as an https link in the web app's policy-block bubble; see Error codes — tenant block notice). A strict absolute https:// URL of at most 2048 bytes, printable ASCII only (percent-encode anything else), with a plain host[:port] authority; credentials (user@host), http://, other schemes, relative URLs, whitespace and <>"\{} |
platform_cap_usd |
number | null | No | PATCH only, platform admin only. The per-grant ceiling: a funding grant_usd larger than this is rejected 400 ({ "error": "grant_usd exceeds the platform-admin-set cap", "platform_cap_usd": <cap> }) — for a platform admin only; any other caller's grant is the platform-only 403 before the cap is looked at, so the stored cap is never echoed to them. null/absent = no ceiling (any grant amount is accepted). For a native tenant it no longer caps cumulative tenant spend — an operator can grant again — so it relies on four-eyes and the audit trail for governance. For a partner-billed tenant it is instead the monthly spend ceiling on the tenant ledger; a missing or malformed ceiling refuses requests with 429 quota_exceeded (the frozen-cap message). A change is enforced from the next request: the write flushes the tenant's cached gateway configuration (an unchanged re-send does not). Same PATCH rule as plan: a non-platform-admin change → 403; omit or re-send the stored value → 200 no-op. Must be >= 0 — a negative/NaN/+inf cap is rejected 400. A tenant admin sees it read-only in User Management › Organisation › Edit › General. For a portal-managed tenant the provisioning job's apply_entitlements step also writes it from the desired budget_ceiling (USD only; see Budget ceiling). |
trial_ends_at |
number | null | No | DEMO/trial phase end — absolute unix timestamp in SECONDS. A tenant with this set is on a trial: once the current time reaches it, the gateway blocks all inference for the tenant with 402 { "error": { "code": "trial_expired" } } (the /admin/* surfaces stay reachable so the account can be upgraded). null = not on a trial. On POST, an absent field means the same; on PATCH, an absent field keeps the stored value and only an explicit JSON null clears it (the dashboard omits the field when its date was not edited, so an unrelated save never moves or re-arms a trial). A trial's spend is bounded by its wallet (seeded on provisioning) and the trial gateways' per-gateway caps. An active or in-grace self-serve subscription supersedes a still-set (stale) trial_ends_at — a converted DEMO tenant is never hard-blocked trial_expired while paying. The supersede is narrow: only a served subscription (active or grace) skips the trial gate. A tenant that is inactive, or carries a self-serve plan label with no subscription, is still trial_expired if the demo end-date has passed (fail-closed). Platform admin only (same PATCH/POST rule as plan). A set / extend / clear is audited (tenant.trial_changed, with the before/after epoch); a no-op re-save is not audited. Accepted: a whole positive unix-seconds integer within (now, now+100y] plus past values (a past epoch = an already-ended/revoked trial), or null to clear. Rejected → 400: a non-integer, a negative or zero number, a milliseconds magnitude (> now+100y), or an ISO-8601 / hex / non-decimal string. |
request_logging_disabled |
number (0|1) |
No | PATCH only, platform admin only. 1 turns off request logging for this tenant: the gateway writes no request_log/request_log_legs rows for its traffic and the tenant's Request Logs view stays empty. 0 (default) logs normally. A tenant admin that tries to change it is refused 403; from a platform admin any value other than 0 or 1 is 400. Billing, quota enforcement, and separately-configured SIEM/webhook forwarding are unaffected. It also stops new turn replay records for the tenant (existing ones expire after the tenant's replay retention, 30 days by default). |
compliance_report_enabled |
number (0|1) |
No | PATCH only. Platform admin only. Enables the scheduled compliance-report snapshot job for this tenant (see Compliance API): 1 opts the tenant into the worker-0 sweep minting its monthly governance snapshots; 0 (default) leaves it off. Enablement is per-tenant only — there is no deployment-wide switch. The snapshot content is DPO-gated governance evidence, so this is not tenant self-service: a non-platform-admin request that changes the flag is rejected 403 naming the field and writes nothing (omit or re-send the unchanged value → 200 no-op). A change is audited (tenant.compliance_report_enabled_changed, before/after) only when the value actually flips; a non-numeric value is a tonumber no-op and any number other than 1 coerces to 0. |
live_transcription_enabled |
number (0|1) |
No | PATCH only, platform admin only. A feature ENTITLEMENT — whether the workspace's members may dictate by live transcription (the WebSocket relay). A non-platform-admin PATCH that changes it is rejected 403 { "error": "live_transcription_enabled is platform-admin-only and cannot be changed by a tenant admin" } and writes nothing; omitting it or re-sending the unchanged value is a 200 no-op. A value other than exactly 0 / 1 (or "0" / "1") from a platform admin is 400. Default 0. Enforced server-side on every stream: a workspace without it receives the error not_entitled and the close 4403 (a failure to read the flag is unavailable, never not_entitled). A change is audited (tenant.live_transcription_enabled_changed, before/after) only when the value flips. |
voice_mode_enabled |
number (0|1, or "0"|"1") |
No | PATCH only, platform admin only. A feature ENTITLEMENT — whether the workspace's members may hold a voice conversation (WebSocket session). A non-platform-admin PATCH that changes it is rejected 403 { "code": "platform_admin_only" } and writes nothing; omitting it or re-sending the unchanged value is a 200 no-op. A value other than exactly 0 / 1 from a platform admin is 400. Default 0, and it stays off until voice mode ships. Enforced server-side on every session: a workspace without it receives the error not_entitled and the close 4403. Independent of live_transcription_enabled. A change is audited as tenant.voice_mode_enabled_changed (who/when/before/after); re-sending the unchanged value writes and audits nothing. |
config_approval_required / agent_review_required |
number (0|1) |
No | PATCH. The organization's four-eyes switch for configuration changes (Config approvals) and its agent-review switch. The 0/1 rule (also for org_share_enabled, mattermost_delivery_enabled, pii_internal_delivery_enabled, pii_preview_auto_show, playground_enabled, agents_enabled, workflows_enabled, scheduled_tasks_enabled, compliance_report_enabled, live_transcription_enabled, voice_mode_enabled, require_token_owner, and a platform admin's request_logging_disabled): a present value must be exactly 0 or 1 (a JSON number, or the string "0" / "1"); anything else (true, "yes", 2, 1.5, null) is 400 { "error": "<field> must be 0 or 1" } before anything is written — never a silent no-op that leaves the switch unchanged while the caller believes it changed. Omitting the field leaves it unchanged. Switching config_approval_required OFF is never held for approval: it applies immediately (200) and is audited (tenant.config_approval_changed, who/when/before/after), exactly like switching it ON — so a sole admin can always disable four-eyes. While the switch is on, every other gated field still answers 202 pending_approval. agent_review_required itself is not four-eyes tracked: sent alone it applies immediately (200) and is audited (tenant.agent_review_changed, before/after). Send it on its own PATCH: if the same body also changes a gated field on a four-eyes tenant, the whole body is held (202) and the agent_review_required value is discarded. The admin UI's Agent review required checkbox does exactly this. |
reactivation_emails_enabled |
number (0|1) | null |
No | PATCH only. Tenant admin or platform admin. The per-tenant switch for the member-reactivation e-mails. Tri-state: 1 = on, 0 = off, null = Auto (on for an enterprise plan or an unexpired trial with at least one purpose=production gateway and not a test fixture; off otherwise). Stored default by plan (details): a self_serve_trial tenant is null (Auto, so on while its trial is unexpired — migration 0342, CEO decision 2026-09-29) unless a tenant admin opted out; enterprise tenants (POCs included) were set to 0 by migration 0337 and stay off until enabled per tenant. A mail is sent only when this resolves to on and the platform setting reactivation_emails_enabled is true. Accepted: JSON null, or a JSON number 0 or 1. Rejected → 400 { "error": "reactivation_emails_enabled must be null, 0 or 1" } and nothing written: a string ("1"), a boolean, any other number, an array/object. Not four-eyes gated. A change is audited (tenant.reactivation_emails_enabled_changed, before/after; the unset state is written as "auto"); re-sending the stored value is a 200 no-op. GET /tenants/:id additionally returns reactivation_emails_effective (0|1, editors only) — what the tri-state resolves to right now. |
default_locale |
string ("en"|"de") | null |
No | PATCH only. Tenant admin or platform admin. The workspace's default e-mail language — the second link of the one lifecycle-mail language chain (member's own locale → this → English) used by the sign-in code, the invitation and the member-reactivation e-mails. Accepted: JSON null (clear → "not chosen": English until the next same-tenant invitation seeds it again from the inviter's interface language), or a string naming a supported language — stored normalized ("DE", " de-DE " → "de"). Rejected → 400 { "error": "default_locale must be null, \"en\" or \"de\"" } and nothing written: any other language ("fr"), an empty or blank string, a number, a boolean, an array/object, a dangling tag ("en-"). Not four-eyes gated. A change is audited (tenant.default_locale_changed, before/after; the unset state is written as "auto"); re-sending the stored value is a 200 no-op. Returned by GET /tenants/:id as stored (null when not chosen). |
default_user_type |
string | No | The tenant's chat-persona slug ("Default user type") — it selects the /easy chips, example prompts and system prompts for every member of the tenant from their next request (it is read per request, not copied onto users). A genuine change that applies immediately is audited (tenant.default_user_type_changed, before/after); a change held for config approval is traced by its approval rows instead. Settable by a platform admin and by the workspace's own tenant admin (a self-serve workspace owns its onboarding). Accepted: a slug that exists in the live persona registry (GET /user-types, e.g. consumer (the default), bundestag) — the set a tenant can grant. Rejected (both roles, nothing written): any other value — an unknown or differently-cased slug, an empty string, a non-string, JSON null on PATCH — answers 400 { "error": "unknown default_user_type", "allowed": [...] }. Any other non-platform caller (e.g. a custom-role holder of TENANT_SETTINGS_MANAGE) that tries to change it gets 403 { "error": "default_user_type can be changed only by a tenant admin or a platform admin" }. A tenant admin's change is four-eyes-tracked: with config approval on, it is held (202) and re-validated against the registry at approval time. Accepted on POST (create) too (platform admin) — omitting it or sending JSON null on create → the consumer default. Omitting it or re-sending the stored value on PATCH is a 200 no-op. |
default_department_id |
string | null | No | The tenant's default department (details): users with no department assignment (and not admin-pinned to none) are held to it. Accepted: the id of a live department of this same workspace, exactly as the API lists it (generated as a lower-case uuid), or JSON null to clear. Rejected (nothing written): a non-string, an empty string, or a string with invisible or non-uuid characters (rejected as malformed before any lookup) → 400 { "error": "invalid_default_department_id" }; an unknown, deleted or other-workspace department, or a well-formed different spelling of a real id (for example upper-case) → 400 { "error": "department_not_found" }. Settable only by a tenant admin or platform admin; any other caller that tries to change it gets 403 { "error": "default_department_id and department_source_precedence can be changed only by a tenant admin or a platform admin" }. Only a byte-identical echo of the stored id counts as "unchanged" for such a caller; an upper-case spelling is a change attempt and gets the 403. Four-eyes-tracked like default_user_type: with config approval on, the change is held (202) and the department is re-checked at approval time. Audited as tenant.default_department_changed. A department that is the default cannot be deleted (409 department_is_tenant_default). |
department_source_precedence |
string | No | manual (default) or idp: which source wins when the identity provider also supplies a department. Only the setting is stored in this release; the identity-provider logic follows separately. Rejected: any other value (including null, empty, wrong case) → 400 { "error": "invalid_department_source_precedence" }. Same 403, four-eyes and audit rules as default_department_id (tenant.department_source_precedence_changed). |
default_role |
string | No | PATCH. The role a newly provisioned account starts with when it is created automatically (first single sign-on with just-in-time provisioning, or a SCIM POST /Users). Must be one of the roles a tenant administrator may assign (the same set as the user role picker); the allowed values are returned as default_role_options on GET /admin/v1/tenants/{id} and the field reads member when nothing is stored, and also when the stored value is outside the allowed set (what new accounts actually get). Existing accounts are never changed. Rejected: any other value, including null, an empty string, a non-string, admin/platform_admin, or a role outside the set → 400 { "error": "invalid_default_role", "allowed": [...] }; nothing is written. A stored value that has since left the allowed set is treated as member at provisioning time (logged as a warning). Only a tenant administrator of the organisation or a platform administrator may change it (anyone else gets 403; a delegate's unchanged echo is a 200 no-op). Under config approval a change is held (202) for a second administrator; audited as tenant.default_role_changed. |
scim_deprovision_limit |
integer | null | No | PATCH. Maximum SCIM deprovisions per tenant per hour (the mass-deprovision breaker). Integer 1-10000; null resets to the default of 25; anything else is 400. Omitted means unchanged. Tenant administrators only (403 tenant_admin_only for delegates). The change goes through the configuration approval lane when the tenant requires it. |
agent_delegation_limits |
object | null | No | PATCH. The organisation's lowered agent delegation limits (max_depth, max_calls, max_tokens, max_run_seconds, max_fanout; each 1..platform limit or null). Above the platform limit or below 1 is 422; malformed is 400. Tenant administrators only (403 tenant_admin_only for delegates); config approval applies. |
member_budget_mode / member_budget_usd |
string / number | null | No | PATCH. The default spend limit a newly provisioned member starts with, using the same rules as a department's member limit: member_budget_mode is exactly inherit (default, no organisation default), none (no limit) or amount; member_budget_usd is a USD amount from 0 to 1,000,000 and is required only with amount (0 freezes every new member). A lone member_budget_usd without a mode → 400 member_budget_mode_required; an invalid mode → 400 invalid_member_budget_mode; an amount with a mode other than amount, or out of range → 400 invalid_member_budget_usd. Same 403, four-eyes (202) and audit rules as default_role (tenant.member_budget_changed, with before and after). |
assistant_name |
string | null | No | The per-tenant white-label name the model's assistant answers as (up to 80 characters; leading/trailing whitespace trimmed). accepted on POST (create) AND PATCH — the chosen name is persisted at creation (it was previously silently dropped, so a new tenant always showed the platform default). Omitting it, or sending JSON null / an empty-or-whitespace-only string, → null = the platform default name. A non-string value → 400 { "error": "assistant_name must be a string or null" }; a value over 80 characters → 400 { "error": "assistant_name must be at most 80 characters" } — on both routes, nothing created/written. |
display_name |
string | null | No | The organisation's display name, shown by the admin UI (Organisation Overview title and lede) instead of the slug; the slug stays the only identifier. Platform admin only, accepted on PATCH only. Up to 120 characters (codepoints; the server trims leading/trailing ASCII whitespace only). JSON null or an empty / whitespace-only string clears it (stored as null; the UI falls back to the slug). A value consisting only of Unicode whitespace (e.g. a non-breaking space) is not treated as empty: it is refused 400 with reason "blank" (the admin UI trims Unicode whitespace before sending, so it clears the field instead). A non-string value, a value over 120 characters, invalid UTF-8, or control, zero-width or bidi characters → 400 { "code": "invalid_field", "field": "display_name", "reason": "…" } and nothing is written. A tenant admin who sends a value different from the stored one → 403 { "code": "platform_admin_only", "field": "display_name" }; an unchanged echo is a 200 no-op. An unchanged echo of the stored value is accepted from either role and writes nothing, even when that stored value is longer than 120 codepoints (set through the portal). A change is audited as tenant.display_name_changed (before/after); an unchanged value writes and audits nothing. Returned by GET /tenants/{id} and the list; an unset name is omitted. |
playground_enabled |
number (0|1) |
No | PATCH only, platform admin only. A feature ENTITLEMENT — which capabilities a workspace has been granted — so it is a platform-operator decision, not tenant self-service. A non-platform-admin PATCH that changes it is rejected 403 { "error": "<field> is platform-admin-only and cannot be changed by a tenant admin" } and writes nothing; the 403 returns before the four-eyes gate, so a tenant admin cannot have the change merely approved by a second tenant admin either. Omitting the field, or re-sending the unchanged stored value, stays a valid 200 no-op (idempotent full-object round-trips keep working). A wrong type (e.g. the string "0") from a non-platform-admin counts as a change attempt and is rejected 403 rather than coerced; a platform admin's value must be exactly 0 / 1 (or "0" / "1"), anything else is 400 (the 0/1 rule above). The per-tenant Playground feature flag. Default 0 for every newly-created tenant (migration 0293 — Playground is a premium / not-yet-public feature, so it is off for trial, admin-created and paid signups alike; a platform admin enables it per-tenant afterwards; existing tenant rows were left unchanged). 1 = Playground available; 0 marks it a Premium feature in the SPA — the nav entry stays visible with a Premium badge and a click opens the shared upgrade pop-up, rather than being hidden (a not-entitled deep-link to the route still bounces to chat) — and enforces the switch server-side (invariant 11 — the nav is never the authz boundary): the playground-only POST /admin/v1/playground/search (and its deprecated GET form) returns 403 { "error": "feature_disabled" } (a transient flag-read fault → 503). The single-trace read GET /admin/v1/playground/trace/{id} is REQUEST_LOGS_VIEW-gated, not flag-gated. Exempt: POST /admin/v1/playground/token — chat AND the Playground UI mint their short-lived inference token via this one route (there is no separate chat_enabled flag), so gating it would break ordinary chat with feature_disabled; minting depends only on gateway access + the impersonation guard. Unlike agents_enabled/workflows_enabled/scheduled_tasks_enabled, a change here is not audited (matches org_share_enabled). |
agents_enabled |
number (0|1) |
No | PATCH only, platform admin only. A feature ENTITLEMENT — which capabilities a workspace has been granted — so it is a platform-operator decision, not tenant self-service. A non-platform-admin PATCH that changes it is rejected 403 { "error": "<field> is platform-admin-only and cannot be changed by a tenant admin" } and writes nothing; the 403 returns before the four-eyes gate, so a tenant admin cannot have the change merely approved by a second tenant admin either. Omitting the field, or re-sending the unchanged stored value, stays a valid 200 no-op (idempotent full-object round-trips keep working). A wrong type (e.g. the string "0") from a non-platform-admin counts as a change attempt and is rejected 403 rather than coerced; a platform admin's value must be exactly 0 / 1 (or "0" / "1"), anything else is 400 (the 0/1 rule above). The per-tenant Agents feature flag. Default 0 for every newly-created tenant (migration 0293 — Agents is a premium / not-yet-public feature, so it is off for trial, admin-created and paid signups alike; a platform admin enables it per-tenant afterwards; existing tenant rows were left unchanged). 1 = Agents available; 0 keeps the Agents nav entry visible but LOCKED — an upgrade/"Coming soon" teaser badge, and a click lands on the /upgrade/agents upsell page instead of the workspace (replaces a legacy behavior of hiding the nav entry entirely) — and enforces the switch server-side (invariant 11 — the nav is never the authz boundary): every /admin/v1/gateways/{gw}/agents… route and the tenant's org agent-catalog return 403 { "error": "feature_disabled" }, a human agent invoke (/v1/{tenant}/{gw}/agents/{slug}/invoke from a user session/token, the run-as-self preview, and the in-chat agent bridge) returns 403 { "error": { "code": "agents_disabled" } }, the inbound agent-webhook receiver returns 503 (no run enqueued), and the scheduler withholds the tenant's agent schedules + pending webhook runs at the claim layer (no fire, no failure email, no auto-pause — they resume when re-enabled). Exempt (still reachable at 0): the governance review decisions (approve/flag/disable/reactivate) on already-created agents, the gateway compliance audit read, and agent-steps that run inside an enabled Workflow (governed by workflows_enabled). A change is audited (tenant.agents_enabled_changed, before/after) only when the value actually flips. |
workflows_enabled |
number (0|1) |
No | PATCH only, platform admin only. A feature ENTITLEMENT — which capabilities a workspace has been granted — so it is a platform-operator decision, not tenant self-service. A non-platform-admin PATCH that changes it is rejected 403 { "error": "<field> is platform-admin-only and cannot be changed by a tenant admin" } and writes nothing; the 403 returns before the four-eyes gate, so a tenant admin cannot have the change merely approved by a second tenant admin either. Omitting the field, or re-sending the unchanged stored value, stays a valid 200 no-op (idempotent full-object round-trips keep working). A wrong type (e.g. the string "0") from a non-platform-admin counts as a change attempt and is rejected 403 rather than coerced; a platform admin's value must be exactly 0 / 1 (or "0" / "1"), anything else is 400 (the 0/1 rule above). The per-tenant Workflows (Baukasten) feature flag. 0 (default, fail-closed) keeps the Workflows nav entry visible but LOCKED — an upgrade/"Coming soon" teaser badge, and a click lands on the /upgrade/workflows upsell page instead of the builder (replaces a legacy behavior of hiding the nav entry entirely) — and blocks the builder + its /admin/v1/gateways/{gw}/workflows… routes for this workspace; 1 enables it. The dedicated POST /admin/v1/gateways/{id}/workflows-feature route writes the SAME column and is platform-admin-only for the same reason — a tenant admin gets 403 there too, so the guard above cannot be side-stepped. Shares one write with the dedicated POST /admin/v1/gateways/{gw}/workflows-feature endpoint (identical platform-admin authz). A change is audited (tenant.workflows_enabled_changed, before/after) only when the value actually flips. |
scheduled_tasks_enabled |
number (0|1) |
No | PATCH only, platform admin only. A feature ENTITLEMENT — which capabilities a workspace has been granted — so it is a platform-operator decision, not tenant self-service. A non-platform-admin PATCH that changes it is rejected 403 { "error": "<field> is platform-admin-only and cannot be changed by a tenant admin" } and writes nothing; the 403 returns before the four-eyes gate, so a tenant admin cannot have the change merely approved by a second tenant admin either. Omitting the field, or re-sending the unchanged stored value, stays a valid 200 no-op (idempotent full-object round-trips keep working). A wrong type (e.g. the string "0") from a non-platform-admin counts as a change attempt and is rejected 403 rather than coerced; a platform admin's value must be exactly 0 / 1 (or "0" / "1"), anything else is 400 (the 0/1 rule above). The per-tenant Scheduled Tasks feature flag. Default 0 for every newly-created tenant (migration 0293 — Scheduled Tasks is a premium / not-yet-public feature, so it is off for trial, admin-created and paid signups alike; a platform admin enables it per-tenant afterwards; existing tenant rows were left unchanged). 1 = Scheduled Tasks available; 0 keeps the Scheduled Tasks nav entry visible but LOCKED — an upgrade/"Coming soon" teaser badge, and a click lands on the /upgrade/scheduled-tasks upsell page instead of the workspace (replaces a legacy behavior of hiding the nav entry entirely) — and enforces the switch server-side (invariant 11 — the nav is never the authz boundary): every /admin/v1/scheduled-tasks… route returns 403 { "error": "feature_disabled" } (a transient flag-read fault → 503), and the scheduler withholds the tenant's scheduled prompt-tasks at the claim layer (no fire, no email; next_run_at untouched so they resume when re-enabled). A change is audited (tenant.scheduled_tasks_enabled_changed, before/after) only when the value actually flips. |
pii_preview_auto_show |
number (0|1) |
No | PATCH only. Tenant-admin settable (a display preference, not an access control). 1 opens the pre-send PII masking preview in chat automatically; 0 (the default) leaves it to the user. A value other than exactly 0 / 1 (or "0" / "1") is 400 and writes nothing (the 0/1 rule above). Not audited. |
impersonation_allowed |
number (0|1) |
No | PATCH only. Tenant-admin settable (permission TENANT_SETTINGS_MANAGE). Default 1. When 0, no administrator (platform administrators included) can start "View as user" for this tenant's users, and a session in progress ends on its next request. Accepted: true, false, 1, 0; anything else (null, "1", 2, an object) is rejected with 400 { "code": "invalid_impersonation_allowed" } and nothing is written. An actual change is audited (tenant.impersonation_allowed_changed). See Impersonation. |
cost_warning_threshold_usd |
number | null | No | PATCH only. Tenant-admin settable. The amount in US dollars at or above which an answer from an external (non-Myra) model carries the cost notice (compared with the answer's charged cost, so an answer on the customer's own provider key, charged 0, never carries it), for callers who may see the cost of each answer. null (the default) turns the notice off. Accepted on PATCH: a number above 0 and at most 1000000, rounded to 4 decimals, or null to clear. Anything else ("", "5", 0, a negative number, a number that rounds to 0, an object) is rejected with 400 { "code": "invalid_cost_warning_threshold_usd" } and nothing is written. Send it in its own PATCH: together with a field that waits for four-eyes approval it is rejected with 400 { "code": "cost_warning_threshold_requires_separate_patch" }, so the change is never dropped silently. The admin UI does this itself: it sends the threshold first, in its own PATCH, and only then the rest of the form (a held rest never swallows the threshold). An actual change is audited (tenant.cost_warning_threshold_changed). Read back on GET. See Cost warning for external models. |
show_cost_to_members |
number (0|1) |
No | PATCH only. Tenant-admin settable. When 1, every member of the tenant sees the charged cost of each answer in chat. Default 0. A caller with the per-user cost permission sees it regardless. Accepted on PATCH: true, false, 1, 0. Anything else (null, "1", "yes", 2, an object) is rejected with 400 { "code": "invalid_show_cost_to_members" } and nothing is written. An actual change is audited (tenant.show_cost_to_members_changed). See Cost of each answer. |
pii_internal_delivery_enabled |
number (0|1) |
No | PATCH only. Tenant-admin settable (for the caller's OWN tenant) — unlike the platform-only flags. Opts the tenant in to delivering a scheduled/workflow agent run's UNMASKED output by email to a tenant-internal recipient when the run masked PII, instead of the blanket fail-closed block. Default 1 (ON) since migration 0358 (reverses 0218's default-0; the migration also backfilled existing active tenants to 1), and a tenant admin can toggle it in Workspace settings (the tenant edit form). Set 0 to go back to blocking every masked run's output. 1 allows delivery only for a recipient that resolves to an active, registered user of the same tenant (storage.find_admin_user_by_email, server-side); an external / disabled-user / other-tenant / non-user address STILL blocks (content-free "delivery blocked" notice). Email only — Mattermost and webhook stay blocked regardless (no per-channel/URL tenant-ownership proof). Because a tenant admin relaxing their own PII egress boundary is a governance event, every change is audited (tenant.pii_internal_delivery_changed). A value other than exactly 0 / 1 (or "0" / "1") is 400 (the 0/1 rule above). |
mattermost_delivery_enabled |
number (0|1) |
No | PATCH only, platform admin only. Enables scheduled/workflow Mattermost output delivery for this tenant. Default 1 (ON) since migration 0357 (reverses migration 0204's default-0; the migration also backfilled existing active tenants to 1). A platform admin may set 0 to disable it per tenant, in which case the agent scheduler and workflow runner record blocked_tenant. Scheduled Mattermost delivery posts through the tenant's own bot token (mattermost_bot_token, below) — there is no shared internal bot (the shared internal bot was removed; the CEO rejected shared-bot egress). Toggling this flag is a platform-operator decision — a non-platform-admin PATCH that tries to change it is rejected 403 (same rule as plan); omitting it or re-sending the stored value is a 200 no-op; a value other than exactly 0 / 1 (or "0" / "1") is 400 and writes nothing (the 0/1 rule above). Every change is audited (tenant.mattermost_delivery_changed). Applied immediately. Note (post default-on): with the flag ON, egress is scoped by the tenant's own bot's channel membership (its bot posts only to channels it was invited to). Whenever Mattermost cannot go through — no per-tenant token, a token that fails to decrypt, or the Mattermost POST itself failing — the full result is emailed to the schedule/workflow owner instead (the "email the user, never fail" directive), so the flag being ON never silently drops a result. Email/webhook delivery is unaffected (no per-tenant flag). |
mattermost_bot_token |
string | null | No | PATCH only, platform admin only. WRITE-ONLY. The tenant's own Mattermost bot access token, so scheduled/agent/workflow delivery posts as the tenant's bot — scoping egress to the channels that bot was invited to and removing the shared-bot cross-tenant reach the former shared bot opened. Stored encrypted at rest (AES-256, master-key envelope); never returned by GET (the read exposes only the boolean mattermost_bot_token_set), never logged, and audited as a boolean only (tenant.mattermost_bot_token). Accepted: a non-empty opaque string, trimmed, ≤255 chars, no control characters and no internal whitespace → validated then encrypted before any write. Rejected: a non-string value → 400 { "error": "mattermost_bot_token must be a string or null" }; an empty/too-long/whitespace/control-char string → 400 naming the rule. Clears the token (the tenant then has no per-tenant bot) on JSON null or "". A non-platform-admin PATCH that supplies the field at all is rejected 403 { "error": "mattermost_bot_token is platform-admin-only and cannot be changed by a tenant admin" } (write-only, so there is no stored value to diff against — presence alone is the trigger); omitting it is a 200 no-op. Resolution at delivery (never-fail): token present + decryptable → the tenant's bot is used; absent (no token) → the full result is emailed to the schedule/workflow owner instead (there is no shared bot); present but undecryptable → logged server-side (never the token) and also emailed to the owner — explicitly not blocked_tenant, because with no shared bot there is no permissive path to fall into, so blocking would only drop a deliverable result. The only genuinely un-deliverable case (a missing/inactive/cross-tenant owner, or the owner email itself failing) is recorded as failed. |
token_max_lifetime_days |
integer | No | PATCH. Maximum lifetime, in days, of a token minted or edited on the user-facing token routes. Default null (no cap; tokens may be non-expiring); PATCH null clears the cap. Otherwise a whole number from 1 to 3650; any other value (string, fractional, zero, negative, above 3650) is 400 and writes nothing. Also bounds the absolute lifetime of new device-code and MCP OAuth credential families and the access tokens they issue. Not retroactive: existing tokens and families keep working until they expire or are revoked. Tenant-admin-settable (write level). Audited as tenant.token_max_lifetime_days_changed (before/after). Scheduler service and chat-bridge tokens are never subject to it. See Token lifetime policy. |
self_mint_tokens |
integer (0 or 1) | No | PATCH. 1 (default) lets members mint their own tokens via POST /me/tokens and POST /me/connect/ox; 0 makes both, and POST /admin/v1/device/approve, answer 403 self_mint_disabled. Admin mint routes and MCP OAuth consent are unaffected. Any other value, booleans included, is 400 (like the other tenant switches). Audited as tenant.self_mint_tokens_changed. |
conversation_retention_days |
number | null | No | Platform-admin-only. Per-tenant chat-content Löschfrist in days. null/0 = disabled (default); a whole number 30–3650 arms automated deletion of conversations with no activity for that many days. Any other value (fractional, <30, >3650, wrong type) is rejected 400 and writes nothing. Automated deletion must also be enabled deployment-wide by your operator. See Data retention. |
request_log_retention_days |
number | null | No | The effective per-tenant request-log Löschfrist in days; a tenant_admin may change it for their own tenant, shortening only: up to the platform-set maximum request_log_retention_max_days. If a maximum is set, a value above it (and null/0, which means keep forever) is rejected 400 { "code": "retention_above_max", "field": "request_log_retention_days", "max": <days> } and writes nothing. With no maximum set, any valid value is accepted. (A platform admin is held to the same rule: raise the maximum first, or send both keys in one PATCH; the maximum is applied first.) null/0 = disabled (default, per tenant); a whole number 30–3650 arms automated permanent anonymisation of request_log rows older than that many days (user, IP, user agent, prompts and responses are erased; billing facts kept; the same for access-decision arguments and per-user usage_daily rows) and deletion of the rows at the later of that many days and 730 days. Independent of conversation_retention_days. The append-only request_log_legs cost ledger is never deleted (only its user_id is reset). Any other value (fractional, <30, >3650, wrong type) is rejected 400 and writes nothing. The deployment-wide switch for automated deletion is on by default in production and beta (off in dev and integration); an operator turns it off with AIG_REQUEST_LOG_RETENTION_ENABLED=false, so setting this value there starts permanent anonymisation at the next sweep. Each change is audited; each committed batch of a sweep writes a counts-only Löschprotokoll audit row (batch, truncated). Where the optional ClickHouse analytics copy is enabled, the sweep does not reach it (nothing in it is deleted or anonymised): its text expires after 14 days and its other personal fields after 730 days — see ClickHouse analytics sink. |
request_log_retention_max_days |
number | null | No | Platform-admin-only. The ceiling for request_log_retention_days: a whole number 30–3650, or null/0 for no ceiling. Returned by GET /tenants/{id}. Lowering it also clamps the effective value down to the new maximum in the same write (a shorter effective value is left alone; raising the maximum never lengthens a tenant's shorter choice). A tenant_admin that tries to change it gets 403 platform_admin_only; an unchanged echo is a no-op. Audited as tenant.request_log_retention_changed with both columns before and after. Existing tenants were migrated so that their current retention is their maximum. |
pii_masking_enforced |
number (0|1) |
No | PATCH only, platform admin only. Makes PII masking mandatory for every user of the tenant (see PII Protector). Accepted: 0 or 1 (also "0" / "1"); anything else (2, true, "yes", null, an object) is 400 and nothing is written. A tenant_admin who sends a changed value gets 403 { "code": "platform_admin_only", "field": "pii_masking_enforced" } and nothing is written; echoing the current value unchanged is a no-op 200, so a full-object round trip still works. An actual change is audited. |
code_interpreter_artifact_max_bytes |
integer | null | No | PATCH only, platform admin only. Largest single code-interpreter artifact (in DECODED bytes) this tenant may egress from the sandbox — a spreadsheet, document, image, or data file the model produces. null/absent = the built-in default, 25 MiB (it was 4 MiB) — already the ceiling, so the setting can no longer raise anything. Accepted: a whole integer in [4194304, 26214400] (4 MiB … 25 MiB), or null to reset to the default. Rejected → 400 (nothing persisted): a non-integer, a fractional byte count, 0, a negative number, or any value below 4 MiB or above 25 MiB. The setting only ever raises the cap and never lowers it below the default. The same effective cap also bounds the tenant's live-delivered images and written files (they share the per-turn wire budget). The gateway re-reads the stored cap on every egress and clamps to it — the client is never the size authority. A non-platform-admin PATCH that changes it is rejected 403 (same rule as plan); omit or re-send the stored value for a 200 no-op. Every change is audited (tenant.code_interpreter_artifact_cap_changed, before/after bytes). |
expected_version |
integer | No | PATCH only. Optimistic-concurrency precondition. Must be a non-negative integer — the row_version the caller read from a prior GET. When present, the update is applied only if the tenant's current row_version still equals it; if another request changed the tenant in between, the PATCH is rejected 409 { "error": "stale", "row_version": <current> } and writes nothing. Any other type (float, string, negative, null) is rejected 400. Omitting it keeps the legacy last-writer-wins behaviour (backward-compatible for scripted callers). A successful PATCH bumps row_version and returns the new value (see Response). |
Amount input. Applies to
spend_cap_usdand to the gatewayconfig.budget_usd. The console's amount fields read what you type exactly; this is the console's input rule, not an API rule: the API takes JSON numbers. The console accepts plain digits with at most one decimal separator (50,12.5,12,5). It refuses, with a message under the field as you type and nothing sent: an ambiguous amount (10,000,10.000), thousands grouping (1,234.50), more than six decimal places or 15 significant digits, anything that is not an amount (letters, currency symbols, exponents such as1e3, signs) and an amount out of range. See Entering an amount.
Response: { "id": "...", "slug": "..." } on POST. A PATCH returns { "ok": true, "row_version": <new> } — adopt the returned row_version as the expected_version for the next edit so a follow-up save does not falsely 409.
Account group (product analytics)
Every tenant carries an account group used to split product-analytics numbers: paying, trial, myra (Myra-internal) or test (automated). The group is a history, not a flag: an append-only list of group events, so a trial chat stays a trial chat after the tenant pays. Events are written by the platform when a tenant is created (self-serve trial → trial, pay-first → paying, a verified owner address whose domain is exactly myra.security / myrasecurity.com → myra, the fixture/synthetic tenants → test), when a trial first pays — through a Stripe subscription or when a platform administrator moves the tenant from the trial plan to enterprise with PATCH /tenants/{id} (trial → paying; a myra/test/overridden tenant is never flipped by a payment) and by the operator override below. Tenants created before this feature are classified once from their current state (an estimate: the paid date is the subscription's creation date; only a self-serve trial — a sign-up record or the trial plan — is given a trial start, a trial_ends_at on an operator-created tenant alone never makes it a trial); an admin-created Myra-domain owner is not assumed to be Myra — apply the override.
curl -X PUT https://<your-gateway-host>/admin/v1/tenants/<tenant-id>/account-group \
-H "Content-Type: application/json" \
-d '{ "account_group": "test" }'
Who: a platform admin only (role admin, whether or not the account belongs to a Myra tenant). A tenant_admin and any other role receive 403 { "error": "forbidden" } (holding the Insights view permission does not help — this is a write); while impersonating ("View as User") the request is refused 403 { "code": "impersonation_forbidden" } before any permission check. The permission is deliberately not the analytics-view permission: re-classifying a tenant rewrites its analytics history.
Body (strict): exactly one key, account_group, whose value is "paying", "myra" or "test". Rejected 400 { "code": "invalid_account_group" }: a missing or empty body, extra keys, a JSON null value, a non-string, "", wrong case, an unknown value or "trial". A body that is valid JSON but not an object (an array such as ["paying"]) is 400 { "code": "malformed_body" }, as on every tenant object-body route (see Error codes). An unknown or soft-deleted tenant is 404. A tenant that has no creation milestone yet (a seed row the analytics reconcile has not classified) is 400 { "code": "unclassified_tenant" }.
Semantics: the override is always retroactive — it takes effect from the tenant's creation, so re-labelling a mis-classified tenant removes its whole history from the customer numbers. Overrides are step functions (a temporary window cannot be expressed) and a later override replaces the earlier one (write order). Submitting the same group again is a no-op (200 { "changed": false }, nothing appended, no tenant.account_group.override audit row; the generic admin-request audit row is still written). Because the group is applied when numbers are read, an override changes open and live ranges retroactively; closed, matured months that were already frozen never change. Every effective change writes an audit row (action: tenant.account_group.override, entity_id = the tenant id, the event sequence in the details). Response: 200 { "account_group": "test", "changed": true }.
Data handling: the group history and the lifecycle milestones (created, trial_started, paid) hold no user id and no email; they are deleted with the tenant on a purge and counted in the deletion protocol (Löschprotokoll).
Storage faults. When the group-history write fails with a transient database fault and the storage layer proved that nothing was written (a lock wait, deadlock or lost connection before the commit), the route answers 503 { "error": "temporarily unavailable; retry later" } with a Retry-After header; send the same request again. Any other fault, including one where the outcome is unknown, answers the sanitised 500 { "error": "could not update the account group", "code": "account_group_update_failed" }. A 404 for an unknown tenant and a 400 for an unclassifiable one are never turned into a 503.
Private destination allowlist
A tenant's outbound calls can be allowed to reach specific addresses inside the private ranges, on top of the operator denylist (siem_egress_deny_cidrs), which always wins. The policy has two lists per tenant: the ceiling, set only by a platform admin, which says how far a tenant may go, and the tenant's own allowlist (cidrs), which must lie wholly inside the ceiling. The allowlist is consulted by tenant-visible shared MCP connectors: such a connector may reach a private address inside it, at save time and before every call (see Outbound address validation). Other outbound calls do not consult it yet.
# platform admin: set the ceiling
curl -X PUT https://<your-gateway-host>/admin/v1/tenants/<tenant-id>/private-destinations \
-H "Content-Type: application/json" \
-d '{ "ceiling": ["172.16.0.0/16", "100.64.0.0/16"] }'
# tenant admin (or platform admin): list the ranges the tenant needs, inside the ceiling
curl -X PUT https://<your-gateway-host>/admin/v1/tenants/<tenant-id>/private-destinations \
-H "Content-Type: application/json" \
-d '{ "cidrs": ["172.16.5.0/24", "100.64.12.0/24"] }'
Who: GET and PUT are open to a platform admin and to a tenant_admin / admin of the tenant itself who may edit the tenant (the tenant-editor role); a plain member receives 403. A request that carries the ceiling key from anyone but a platform admin is refused 403 { "code": "ceiling_platform_admin_only" } before the body is looked at, whatever else it contains (so a GET response sent straight back by a tenant admin is a 403; send only cidrs). When the tenant requires config approval, a tenant admin's change to cidrs is held for a second administrator (202 { "status": "pending_approval", "approval_id": ... }) and the stored list stays unchanged until it is approved; the held change is checked again against the ceiling and the operator denylist when it is applied. Before anything is held, the change is checked synchronously against the ceiling, the never-allowable set and the operator denylist: a cidrs change that would be refused is answered 400 (or 409/500/503 as listed below) at once and no approval request is created. A clear ([]) is still held like any other change. A platform admin viewing as a tenant admin (impersonation) is treated as that tenant admin: a ceiling key is refused, and a cidrs change is allowed and its audit row records the impersonator.
Body (strict): an object with cidrs, ceiling, or both, and no other key. Each is an array of at most 32 strings a.b.c.d/n, each the network address of its range (no host bits set), written canonically (no leading zeros), IPv4 only, and inside 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 or 100.64.0.0/10. Duplicates are refused. Anything else — a missing body, {}, extra keys, an object or null instead of an array, a non-string element — is 400 { "code": "invalid_private_destinations" }, and nothing is stored. [] clears a list.
Ceiling: every cidrs entry must lie wholly inside one ceiling entry. While no ceiling is set, any non-empty cidrs is 400 (only [] is accepted). When cidrs and ceiling are sent together, cidrs is checked against the new ceiling only. A ceiling change that would leave already-stored cidrs outside it is 409 { "code": "ceiling_orphans_entries" } and nothing is stored; clear or shrink cidrs first, or send both keys in one request.
Never allowable: 100.100.100.200/32 (cloud metadata), 172.17.0.0/16, 172.28.0.0/16, 172.30.0.0/16 and 172.31.0.0/16 (the docker networks of the gateway host and its database), and every subnet declared in the repository's compose files — any entry (in cidrs or ceiling) that overlaps one of them is 400. As a consequence 172.16.0.0/12 and 100.64.0.0/10 (which contains the metadata address) as a whole can never be an entry of either list. Ranges outside the private class (for example 172.32.0.0/16) are refused anyway. Use sub-ranges: a ceiling of 172.16.0.0/16 and 100.64.0.0/16, and tenant entries such as 172.16.5.0/24 and 100.64.12.0/24.
Operator denylist first: an entry that overlaps a siem_egress_deny_cidrs entry is 400. While the denylist is empty, a non-empty save (either key) is 409 { "code": "infra_denylist_unset" } — set the denylist first. If the denylist cannot be read (or holds an entry in non-canonical form) the save is 503 { "code": "private_destinations_unverifiable" }; nothing is stored. The same code answers when the tenant's stored lists cannot be read at the up-front check of a held request. Clearing ([]) never needs the denylist.
Responses: 200 { "cidrs": [...], "ceiling": [...], "changed": true|false }; GET returns { "cidrs": [...], "ceiling": [...] }. Saving identical lists is a no-op (changed: false, no audit row). An unknown or deleted tenant is 404 { "code": "tenant_not_found" }. A write that stores nothing because the database is busy or unreachable (lock wait, deadlock, no connection) is 503 (retry); any other storage fault is the generic 500. Every effective change writes an audit row tenant.private_destinations_changed with the before and after lists. If the audit entry cannot be written, the change is rolled back and nothing is stored (503 when it provably stored nothing, otherwise 500). The row records only the list that changed. After a successful save the stored lists are read back; if that read-back finds a corrupt ceiling the answer is 500 { "code": "private_destinations_corrupt" } (503 if the store cannot be read) instead of a success body, so a response never shows an empty list for a list that is broken. A list that cannot be encoded for storage is 500 { "code": "private_destinations_not_encodable" }; nothing is saved and, for a tenant admin's PUT, no approval request is created.
Stored value no longer valid: if a stored list stops passing these rules — corrupt data, an entry outside the ceiling, or a later release widens the never-allowable set over an entry — GET answers 500 { "code": "private_destinations_corrupt" } and every send that would consult the list is refused as a whole. A broken list never counts as an empty one. The same holds for a corrupt or unreadable ceiling on a tenant admin's PUT: 500 private_destinations_corrupt / 503 private_destinations_unverifiable, synchronously, with no approval request created. When a held change is later approved and the stored ceiling turns out to be corrupt, the approval is not applied: it is recorded as failed with 409 { "error": "apply_failed", "reason": "private_destinations_corrupt" } (permanent, not retryable), the stored value stays untouched and no audit row is written. Only an unverifiable operator denylist or a write that provably stored nothing is a transient 503 (approve again). A platform admin repairs it with one request that replaces both lists, for example { "cidrs": [], "ceiling": [ ... ] }.
Not exported: both lists are platform policy for the tenant, not tenant content. They are not part of the exit data export and are not copied when a tenant is cloned.
Connector egress hosts
A per-tenant list of the exact host:port destinations the tenant's MCP connectors may reach even though they are private, internal or loopback. Every MCP connector egress decision of the tenant reads this list, and only this list; the deployment-wide AIG_SSRF_ALLOW is no longer consulted for connectors. The same list and rule also govern the tenant's other outbound fetches: the chat URL fetch tool, URL / SharePoint / Graph connector sync, the workflow Fetch node and SAML metadata import and refresh. An unlisted private target is refused on each of them, and so is a redirect to one. How it applies:
- A connector whose
host:portis listed may reach a public, private-range or loopback (127.0.0.0/8) address overhttp://orhttps://. Unspecified (0.0.0.0/8), link-local and cloud-metadata, multicast,240.0.0.0/4, broadcast, TEST-NET and non-public IPv6 addresses (and addresses that translate to them) stay refused even when listed. - A listed name is resolved by the gateway and the connection is pinned to the address checked; every address of the answer must pass. A name that does not resolve is refused.
- The operator denylist always wins over the list. If it cannot be read the call is refused as unverifiable.
- An unlisted target is refused unless it is public, or (tenant-visible shared connector) inside the tenant's private destinations. A listed entry decides by itself: there is no fallback to the other rules.
- A plain
http://connector URL is accepted only when itshost:portis listed (match is exact, lower case,https://is always allowed). - The list is the connector's own tenant's. Another tenant's list never applies, and provider / token-exchange targets that belong to no tenant are public-only.
- An absent list is empty. A stored value that does not parse or is not canonical makes a connector call that needs the list fail closed as unverifiable (logged), never as empty.
- Discovery's own scheme rules for OAuth metadata are unchanged (see the MCP API).
Both endpoints are platform admin only: a tenant admin, a member, and a platform admin who is impersonating a tenant user get 403; no session is 401.
curl -X PUT https://<your-gateway-host>/admin/v1/tenants/<tenant-id>/connector-egress-hosts \
-H "Content-Type: application/json" \
-d '{"hosts": ["youtrack.example.com:443", "10.232.10.252:8750"]}'
Body (strict): an object with exactly the key hosts, an array of at most 32 strings host:port. The host is a DNS name or a canonical dotted IPv4 address (no scheme, path, user info, wildcard, IPv6, trailing dot, or shortened / octal / hex IPv4 forms); the port is 1-65535 without leading zeros. Cloud metadata IP literals are refused. Loopback (127.0.0.0/8) and 0.0.0.0 literals are accepted on purpose. Canonical literals in the other deny classes (multicast 224.0.0.0/4, 240.0.0.0/4, 255.255.255.255, the TEST-NET ranges) are stored as given; connector egress refuses them even when listed. A name is checked when connector egress resolves it. Hosts are lowercased and duplicates are refused. Anything else, including null or a missing hosts, is 400 { "code": "invalid_connector_egress_hosts" } and nothing is stored. A body that is not valid JSON, or valid JSON that is not an object, is 400 { "code": "malformed_body" }. [] clears the list. The value is not part of the tenant export and is not copied by a tenant clone.
Responses: PUT answers 200 { "hosts": [...], "changed": true|false } with the list read back from storage after the write (the committed state: if another platform admin saved at the same moment, it may show their list rather than yours; the audit trail records each change); GET answers 200 { "hosts": [...] } ([] when none). Saving an identical list is a no-op (changed: false, no audit row). An unknown or deleted tenant is 404 { "code": "tenant_not_found" }. Every effective change writes an audit row tenant.connector_egress_hosts_changed with the before and after lists in the same transaction; if it cannot be written nothing is stored (503 when it provably stored nothing, otherwise 500).
Stored value no longer valid: a stored value that does not parse, or parses but is not in the canonical form the gateway writes (for example upper case or extra spaces), is reported as corrupt until it is saved again. GET (and a PUT read-back) answers 500 { "code": "connector_egress_hosts_corrupt" }; a broken list is never shown as an empty one. A platform admin repairs it by PUTting a valid list. A transient storage fault (database busy, lock wait, no connection) answers 503 (retry); any other storage fault is the generic 500. If the list cannot be encoded for storage, PUT answers 500 { "code": "connector_egress_hosts_not_encodable" } and the stored list is left untouched. The audit row for that repair records the broken value only as { "corrupt": true, "bytes": n, "sha256": "..." }, never the text.
Updating a tenant
curl -X PATCH https://<your-gateway-host>/admin/v1/tenants/{id} \
-H "Content-Type: application/json" \
-d '{"plan": "pro", "spend_cap_usd": 1000.00}'
⚠️ Retired fields are rejected, not ignored.
POSTandPATCHon a tenant answer400{ "error": "field_retired", "field": "<field>", "message": "The field '<field>' was retired. …" }when the body carriesbudget_usd,budget_period,budget_four_eyes_required,budget_currencyorbudget_amount— for any value other than absent, JSONnullor""— and write nothing (the check runs before the platform-only403, thefrozenbrake and any other change in the body). Usespend_cap_usdfor a tenant cap andgrant_usd(platform admin) for funding. APATCHthat merely echoes the tenant's unchangedbudget_currencyis a200no-op. A body that is a JSON array (not an object) is refused with400malformed_bodyon both routes. Gatewayconfig.budget_usdis unaffected.⚠️
PATCHaccepts only the documented keys; anything else is rejected, not ignored. A body key the endpoint does not know (a typo such asspend_capforspend_cap_usd, oraccount_group) answers400{ "error": "unknown_field", "code": "unknown_field", "field": "<key>", "message": "…" }and writes nothing (thefieldecho is capped at 64 bytes). Read-only keys thatGETreturns —id,slug,created_at,curator_enabled,tts_model,tts_voice,brand_logo_version,trial_credit_eur,invoice_recipient,billing_settings_enabled,pending_voucher_code,pending_voucher_email— may be echoed back unchanged (so a full-object round-trip works) but a changed value is refused400{ "error": "read_only_field", "field": "<key>" }. Computed keys thatGETreturns (row_version,effective_spend_cap,spend_cap_spent_usd,effective_seat_cap,admin_count,mcp_dcr_connections, the*_version/budget_fx_*/*_set/branding_unavailable/trial_conversion_targets/seats_editable/reactivation_emails_effectivefields) are accepted and ignored.workflow_recipient_allowlisthas one wire shape in both directions:GETreturns it as a JSON array of entries (nullwhen no allowlist is set; clearing it with[]ornullstores nothing), exactly whatPATCHaccepts, so it round-trips; a stored value that is not an array (corrupt, e.g. written directly to the database) is returned as its raw string and aPATCHof that string is refused400recipient_allowlist_errorrather than clearing the allowlist. Redacted-field rule: a caller who is not a tenant editor (admin/tenant_admin) but holdsTENANT_SETTINGS_MANAGEthrough a custom role does not seeplan,platform_cap_usd,trial_ends_at,code_interpreter_artifact_max_bytes,pending_voucher_codeandpending_voucher_emailinGET; sending any of them in aPATCH— with any value, JSONnullincluded — is refused with the platform-only403without comparing against the stored value, so the answer never reveals it (theGETwrite-back of a redacted response omits them and stays a200no-op). The same holds forgrant_usd: a non-platform caller's grant is always the platform-only403, whatever the amount or the storedplatform_cap_usd(the per-grant cap400is a platform-admin answer).siemis hidden from a custom-role caller too, so it is validated on everyPATCHfor them (a legacy-invalid stored value is not grandfathered for an unchanged echo, which is a400like any invalid value);admin/tenant_adminkeep the unchanged-echo no-op. Precedence: retired (field_retired), unknown (unknown_field), the redacted-field403for a custom-role caller, read-only (read_only_field), then the platform-only403for the other platform fields, thefrozenbrake and the writes.POST /admin/v1/tenantsis unchanged.A tenant
PATCH(includingfrozen) is atomic with its audit entries. The change and its audit entry are one transaction: the audit entry is written just before the commit, so a change is never stored without its entry, and an entry is never stored for a change that failed. If the audit entry cannot be written, the change is rolled back and the answer is503(nothing stored, retry the request) or500(not retryable: nothing is stored, except when the commit itself failed, then the change may or may not be stored: reload before retrying). APATCHthat changes nothing commits normally and writes no entry.
Session policy (PATCH only). session_max_age_s (whole seconds, 3600 to 2592000) is the absolute lifetime of an admin session from sign-in; session_idle_timeout_s (whole seconds, 300 to 2592000) is the time a session may go without renewal (no open signed-in tab). On PATCH, an absent field leaves that limit unchanged and null clears it (no limit); a tenant that has never set a limit has no limit. Any other value outside the bounds, a non-integer, a string or a boolean answers 400 and nothing is written; so does echoing back a stored value of 0 or less. The policy follows the same gate as every other tenant setting: the caller needs the TENANT_SETTINGS_MANAGE permission and access to the tenant, so a tenant admin, or a custom role holding that permission, may change it for its own tenant. Each change writes a tenant.session_policy_changed audit event. Both appear on the tenant object and in the tenant export. They are not accepted on POST.
Body errors on POST and PATCH /tenants (nothing is written in each case):
| Status | error / code |
Route | When |
|---|---|---|---|
400 |
malformed_body |
both | A body that is not valid JSON, or a JSON array. |
400 |
field_retired |
both | The body carries a retired budget field (budget_usd, budget_period, budget_four_eyes_required, budget_amount, budget_currency) with a value other than absent, null or "". The body names the field in field; message points at spend_cap_usd, grant_usd and the gateway config.budget_usd. On PATCH an unchanged budget_currency echo is not refused. |
400 |
invalid_spend_fail_closed |
PATCH |
spend_fail_closed is not true, false, 1 or 0. |
400 |
unknown_field |
PATCH |
A body key the endpoint does not accept. field names it (capped at 64 bytes). |
400 |
read_only_field |
PATCH |
A read-only key sent with a changed value. |
400 |
invalid_account_group |
POST |
account_group absent or not paying / myra / test. |
409 |
slug_taken |
POST |
An organisation with this slug already exists. |
The deny-burst thresholds for the automatic agent pause are set with the same call (a tenant administrator for their own organisation, or a platform administrator): protection_deny_burst_count (whole number 5 to 1000, default 20) and protection_deny_burst_window_s (whole number 60 to 86400, default 300). The volume-spike factor for the volume-spike detection is protection_volume_factor (whole number 2 to 100, default 10); it follows the same rules. The repeated-approval-rejection thresholds of the automatic pause are protection_rejection_count (whole number 2 to 100, default 5) and protection_rejection_window_s (whole number 300 to 604800, default 3600), with the same rules. The sixth field, protection_count_expiries (a JSON boolean, default false), decides whether an approval that expires undecided counts towards that pause like a rejection; any value other than true or false (including 0, 1, "true" and null) is 400 { "code": "invalid_field", "field": "protection_count_expiries" }. All six are returned on the tenant record (protection_count_expiries as a boolean) and included in the tenant export. An out-of-range or non-integer value is 400; an unsent field is left unchanged; sending the stored value again writes and audits nothing; a change is audited as tenant.protection_thresholds_changed with the old and new values of all six. In the console they are the Agent protection section of Organisation settings › Agents (see Agent protection).
Four-eyes. The six protection settings are held by config approval like the other governance settings: when the organisation's config_approval_required is on, a tenant administrator's actual change answers 202 { "status": "pending_approval", "approval_id": "…" } and nothing is written; the approver sees a summary such as Agent protection: refused calls 20 -> 30, count expired approvals false -> true. At approval the held values are validated again with the same bounds (a held value that is out of range or of the wrong type fails the approval with corrupt_payload, nothing written) and applied on top of the values in force then: a setting the request did not change keeps its current value. The audit entry is written at approval, under the requester. A platform administrator's change, and any change while config approval is off, applies immediately. An unchanged echo is never held. A held body keeps only its four-eyes fields, so send untracked fields in their own PATCH (the console does this for you).
Gateway and tenant configuration changes are visible on every gateway node within about 5 seconds; on the node that handled the change they take effect immediately.
Default approval waiting time for new agents
PATCH /admin/v1/tenants/{id} accepts approval_ttl_default_s: the waiting time, in seconds, that new agents of the
organisation start with for calls held for approval (the agent's
tool_config.approval.ttl_seconds). The tenant record (GET) returns it; null means not
set. It is included in the tenant export.
curl -X PATCH https://<your-gateway-host>/admin/v1/tenants/{id} \
-H "Content-Type: application/json" \
-d '{"approval_ttl_default_s": 3600}'
Accepted shape: a whole number from 300 (5 minutes) to 604800 (7 days), or JSON null to clear it (not
set). An absent field leaves the stored value unchanged. Echoing back the stored value unchanged is always accepted and
writes nothing.
What is rejected: any other value — 299, 604801, a fraction (300.5), a string ("3600"), a boolean, an array
or object — answers 400 { "error": "…", "code": "invalid_field", "field": "approval_ttl_default_s" } and nothing of the
PATCH is written.
- Who may set it: the same gate as the other tenant settings and the protection thresholds: a tenant
administrator for their own organisation, or a platform administrator (a custom role holding the
TENANT_SETTINGS_MANAGEpermission counts too). A member gets403. - Four-eyes. Under config approval a tenant administrator's actual change is held for a
second administrator like the other General settings (
202; the stored value stays unchanged until it is approved, and it is re-validated against 300–604800 at approval). A platform administrator's change, and any change while config approval is off, applies immediately. An unchanged echo is never held. - Audit. An actual change writes
tenant.approval_ttl_default_changedwithbeforeandafter({"approval_ttl_default_s": <seconds or null>}) when it is applied (immediately, or at approval); an unchanged echo writes no entry. - Create time only. The default is written into an agent (internal or external) when it is created without its own
tool_config.approval.ttl_seconds; an explicit value in the create body wins. It is not a run-time fallback: changing or clearing it never changes an existing agent, and an agent without a stored value keeps waiting 7 days. There is no organisation maximum: each agent may still set any value from 5 minutes to 7 days. - For agent authors, the signed-in user's
/admin/auth/mecarries the same value astenant_approval_ttl_default_s, so the agent editor and the external-agent wizard can preselect it.
Require an owner on every access token
PATCH /admin/v1/tenants/{id} accepts require_token_owner (0/1, default 0). The value must be exactly 0 or 1 (a JSON number, or the string "0"/"1"); anything else (true, "yes", 2, null) is 400. When it is 1, POST /admin/v1/gateways/{id}/tokens refuses a token that has neither an owner (user_id) nor an agent (agent_id): 400 { "error": "token_owner_required" }, nothing is created. A token bound to a user or to an agent is unaffected. The change needs the same permission as the other workspace switches, is audited as tenant.require_token_owner_changed (before/after, written only on an actual change) and, under config approval, is held for a second administrator (202; the flag stays unchanged until it is approved).
The switch is not retroactive: tokens that already exist without an owner keep working. Switching it on does not revoke them; the gateway page (Organisation › AI setup › Gateways, tab Auth tokens) lists how many there are (GET /gateways/{id}/tokens?owner=none, see Users & tokens). The gateway's own internal credentials (scheduler, chat bridge) are created by the platform, not by this route, and are never affected.
Unverified MCP clients
PATCH /admin/v1/tenants/{id} accepts mcp_dcr_enabled (0/1, default 1): whether MCP clients that register themselves
(POST /oauth/register) may be authorized for this workspace. A genuine change is audited as tenant.mcp_dcr_changed and, under
config approval, is held for a second administrator like the other workspace switches. Switching off blocks
authorize, consent approval, proxy calls and refresh of unverified clients at once; see MCP proxy OAuth.
The agent they act through is one unverified-clients agent per gateway.
GET /admin/v1/tenants/{id} returns mcp_dcr_connections: the number of live connections of unverified clients (active, not revoked, not expired) that switching mcp_dcr_enabled off would cut. It is present only for callers holding the tenant-settings permission, and is null when the count could not be read (treat it as unknown, not zero).
Privacy mode
PATCH /admin/v1/tenants/{id} accepts content_logging_disabled (0/1, default 0; the console shows it inverted as "Store prompts and answers in request logs" on Governance › Privacy, with the hint "Off: logs keep cost, model and timing only"). When 1, the request log of every gateway of the workspace stores no prompt or answer: the logger drops prompt, prompt_scrubbed, response and response_raw (including provider error bodies), and payload logging, tracing bodies (trace steps) and replay capture are forced off whatever the gateway setting says. It does not change chat conversation history or agent run results, which keep their own retention (see Data retention), and the value is returned on GET /admin/v1/tenants/{id} and in the tenant export. Anything but 0/1 (number or "0"/"1", JSON null included) is 400; an unsent field is unchanged. A genuine change is audited as tenant.content_logging_disabled_changed (before/after) and, under config approval, is held for a second administrator (202) like the other workspace switches. Content stored earlier is not purged. Reading content that exists requires a reason.
Named-person reports
PATCH /admin/v1/tenants/{id} accepts named_reports_enabled (0/1, default 1 = allowed; the console shows it as "Allow usage reports by named person" on Governance › Privacy, with the hint "Off: reports show departments and groups"). When 0, the person-level analytics of the workspace stay anonymised: GET /admin/v1/stats/analytics?anonymize=0 (and false) is refused 403 with code named_reports_disabled for every workspace role, tenant administrators included, and the console's Anonymized checkbox is locked on. The read fails closed: only a stored 1 allows; 0, NULL, any other value or an unknown workspace is refused, a database fault is 503. Anything but 0/1 (number or "0"/"1", JSON null included) in the PATCH is 400; an unsent field is unchanged. The value is returned on GET /admin/v1/tenants/{id} and in the tenant export. A genuine change is audited as tenant.named_reports_enabled_changed (before/after) and, under config approval, is held for a second administrator (202) like the other workspace switches.
AI-answer corrections
PATCH /admin/v1/tenants/{id} accepts answer_corrections_enabled (0/1, default 1 = allowed; the console shows it as "Allow users to correct AI answers" on Governance › Privacy). When 0, saving a correction under an AI answer is refused: PATCH /admin/v1/conversations/{id}/messages/{mid} with a non-empty corrected_content answers 403 with code answer_corrections_disabled and writes nothing. Clearing a correction (null or an empty or whitespace-only string) stays allowed, and corrections already stored stay stored and are still shown, copied and exported. Request validation runs first, so a malformed corrected_content is 400 whatever the policy. The check fails closed: for a user with a workspace only a stored 1 allows a correction; 0, NULL, any other value or a missing workspace is refused 403, a database fault while reading the policy is 503. A user without a workspace has no workspace policy and is not restricted. Anything but 0/1 (number or "0"/"1", JSON null included) in the PATCH is 400; an unsent field is unchanged. The value is returned on GET /admin/v1/tenants/{id} and in the tenant export, and GET /admin/auth/me carries it as tenant_answer_corrections_enabled (see Authentication). A genuine change is audited as tenant.answer_corrections_enabled_changed (before/after) and, under config approval, is held for a second administrator (202) like the other workspace switches.
Web-search confirmation
PATCH /admin/v1/tenants/{id} accepts web_search_confirmation_enabled (0/1, also "0"/"1"; default 0, which is OFF; the console shows it as "Web-search confirmation" on Governance › Privacy). With 1, once a chat contains web content, the user approves the main websites once before pages open (see untrusted content). With 0 (the default), no such card appears and those web tools run without asking; tools of connected apps that write or send data still ask, and the conversation is still marked as containing untrusted content. Any other value (true, 2, -1, null, "", "01", an object) is 400. A stored value that is not exactly 0 or 1 is treated as 1 (the user is asked): both a missing value and a malformed one fail closed, and each is logged as a warning. When the default changed to 0, workspaces whose admin had never changed the value were switched to 0; a workspace whose admin had changed it keeps its value. The value is returned on GET /admin/v1/tenants/{id} and in the tenant export.
Only a tenant admin of the workspace or a platform admin may change the value. Any other caller, for example a delegate holding only the tenant-settings permission, is refused 403 with code tenant_admin_only. Omitting the key, or sending the value already stored, changes nothing and answers 200. A change is audited as tenant.web_search_confirmation_enabled_changed and takes effect for the next chat turn. When config approval is on, a change is held (202) and the value stays unchanged until a second administrator approves it.
Smallest group in reports
PATCH /admin/v1/tenants/{id} accepts report_min_group_size, the smallest number of distinct people a user group must have before its analytics may be shown (the console shows it as "Smallest group in reports" on Governance › Privacy). It is a whole number from 5 to 1000; the default is 5, and the floor of 5 cannot be lowered. A larger value makes the group gate in /stats/analytics and /stats/usage-series stricter for that workspace: a group with fewer members is refused 403 group_below_minimum with k_min set to the workspace value. Anything else (below 5, above 1000, a fraction, a string, JSON null) is 400 with the offending field; an unsent field is unchanged. The value is returned on GET /admin/v1/tenants/{id} and in the tenant export. A genuine change is audited as tenant.report_min_group_size_changed (before/after) and, under config approval, is held for a second administrator (202) like the other workspace switches.
Platform administrators (the operator) are not bound by this setting; their reveals are audited as well (see /stats/analytics). Residual risk: a tenant administrator may switch the setting back on alone (unless the workspace requires config approval), so it limits accidental and routine reveals, and every switch and every reveal is on the audit trail; it is not a barrier against a malicious tenant administrator.
Agent delegation limits
PATCH /admin/v1/tenants/{id} accepts agent_delegation_limits: the organisation's limits for agents calling other agents as tools (the console shows them on Organisation settings › Agents › Delegation limits). They can only lower the platform limits, which stay the hard ceiling:
| Key | Meaning | Platform limit |
|---|---|---|
max_depth |
levels of agents calling agents | 3 |
max_calls |
sub-agent calls per run (whole delegation tree) | 8 |
max_tokens |
tokens all sub-agents of one run may use together | 300000 |
max_run_seconds |
wall clock of the whole delegation tree, in seconds (each sub-agent still stops after at most 180 s) | 240 |
max_fanout |
sub-agents per parallel agent_fanout call |
5 |
{ "agent_delegation_limits": { "max_depth": 2, "max_calls": 4, "max_tokens": 150000, "max_run_seconds": null, "max_fanout": 3 } }
Accepted shape. An object whose keys are among the five above; each value a whole number from 1 to its platform limit, or null (= the platform limit). The object replaces the stored one: a key that is not sent is null. "agent_delegation_limits": null resets every key to the platform limit. An unsent field is unchanged.
Rejected. A value above the platform limit or below 1 is 422 { "code": "delegation_limit_range", "field": "agent_delegation_limits.<key>", "limit": <platform limit> } (the message names both). A value that is not an object (array, string, number), an unknown key, or a value that is not a whole number (string, fraction, boolean, object) is 400 invalid_field with the offending field. A rejected request writes nothing.
Who. Tenant administrators and platform administrators. A member has no TENANT_SETTINGS_MANAGE and gets 403; a custom-role delegate that holds it is refused 403 tenant_admin_only on an actual change (an unchanged echo is a no-op). A genuine change is audited as tenant.agent_delegation_limits_changed (before/after, all five keys) and, under config approval, is held for a second administrator (202); the held value is validated again when it is applied.
Read back. GET /admin/v1/tenants/{id} returns agent_delegation_limits (all five keys, null = platform limit) and agent_delegation_platform_limits (the five platform limits), so a client can show both. The setting is in the tenant export. A run uses the lowest of the platform limit, this value and the agent's own value; if the setting cannot be read, the run uses the platform limits.
Just-in-time provisioning
PATCH /admin/v1/tenants/{id} accepts jit_provisioning (0/1, default 0): whether the first single sign-on (OIDC or SAML) sign-in of an unknown address inside the tenant's allowed email domains creates an account with the tenant's default_role (member unless changed). Only a tenant administrator of that organisation or a platform administrator may change it (anyone else gets 403); any other value than 0, 1, "0" or "1" is 400. A genuine change is audited as tenant.jit_provisioning_changed (with before and after) and, under config approval, is held for a second administrator like the other workspace switches. The field is returned on the tenant record and included in the tenant export. An unchanged echo means the numeric 0/1 already stored; a string "1" sent by a delegate counts as a change (and is 403 for a caller who may not change it).
The address claim from the identity provider is untrusted. It is trimmed and lowercased, then accepted only if it is ASCII, contains exactly one @, has a valid RFC address shape, is at most 254 bytes, and its normalised domain is in the configuration's allowed_email_domains. Anything else is refused with 403 (sso_denied) and nothing is created.
The account is created through the seat-capped path: with no free seat the sign-in is refused with 403 and the browser lands on /login?error=sso_seat_limit. An address that belongs to another organisation, a deleted account (in this or another organisation) and a disabled account are never created or revived; they stay refused as with the switch off (while the organisation has no free seat, every unknown address, including these, is answered with sso_seat_limit).
A disabled account that already holds an SSO link is refused before anything else happens: the sign-in returns 403 and the browser lands on /login?error=sso_denied, with no group or department sync, no last-login update and no session. The refusal is audited as sso.account_disabled.login_denied (OIDC) or saml.account_disabled.login_denied (SAML). A link whose account was deleted (including by SCIM deprovisioning) never creates a new account through just-in-time provisioning: it can only re-link to an existing active account with the matching e-mail address, otherwise the sign-in is refused with 403 and audited as sso.account_deleted.login_denied / saml.account_deleted.login_denied.
Tenant guardrail baseline and fail-closed switch
Two organisation-wide guardrail settings apply to every gateway of the organisation, including gateways created later. Both are set with PATCH /admin/v1/tenants/{id} by a platform administrator or the organisation's tenant administrator. Under config approval a tenant administrator's change is held for a second administrator, like the other workspace switches.
guardrail_baseline is a list of guardrail detectors that runs on every gateway in addition to the gateway's own guardrails. The baseline is not stored on the gateways. The gateway adds it to the detector list when it loads a gateway configuration, so a gateway cannot remove or disable a baseline detector: not with guardrails: [], not with an enabled: false detector of the same name, and not with a guardrail-config import. Only the tenant itself can switch a baseline rule off, by storing enabled: false on it (the rule stays in the list but is not applied). Baseline detectors run after the gateway's own detectors, in every phase (request, response, tool results), and count towards the "PII protected" state of every gateway. A change applies at once: the cached configuration of every gateway in the organisation is refreshed.
Accepted shape:
| Value | Meaning |
|---|---|
| JSON array of detector objects (1–64) | Stored as the baseline. Each detector uses the same shape as a gateway detector (see Guardrails) and passes the same write checks as a guardrail-config import, for example no url field (SSRF guard) and a boolean fail_open. |
null or [] |
Clears the baseline (stored as "no baseline"). |
Rejected with 400 and code: "invalid_guardrail_baseline"; nothing is written:
- anything other than an array or
null, for example an object ({}too), a string, a number; - an element that is not an object, or has no non-empty string
type; - a
typethat is not a detector type the gateway can run (e.g.keyword_filter); - an
actionother thanblock,scruborflag. An unrecognised action would only flag, so the floor would be weaker than intended; enabledset to anything other than a boolean.enabled: falseis stored and switches the rule off (not applied; protective PII fail-safes stay armed; switching a PII masker off is audited asguardrail_masker.deactivated).enabled: trueis accepted and dropped. A non-boolean value already stored is ignored at runtime, so the rule runs;- a
regexdetector with an unknown entry inpatterns, or acustom_patternsentry that is empty, not a string, or not a valid pattern. The runtime would skip such a pattern silently; - an unreadable stored baseline (
{}or any non-array value) is never read as "no baseline"; sendnull,[]or a valid array to repair it; - more than 64 detectors, or more than 65,535 bytes once encoded;
- anything the guardrail-config import rejects for a detector.
guardrails_fail_closed (0/1, true/false, default 0) is the organisation-wide fail-closed switch. When it is on, every guardrail that errors refuses the request with guardrail_unavailable instead of degrading. This covers every detector type and action, including flag detectors and detectors with fail_open: true, at the request phase, the response phase and the tool-result checks, and it applies to the gateway's own detectors and to the baseline. When it is off, each detector's own fail_open applies as before. Any other value ("1", 2, null) is 400 with code: "invalid_guardrails_fail_closed".
💡 Note: A baseline detector keeps the same optional fields as a gateway detector, including
fail_open(a Tier 2 outage then followsfail_openunless the fail-closed switch is on) and keyword lists. To make the baseline a hard floor, turn the switch on and use detectors that cannot silently match nothing.💡 Note: With the switch on, a detector that errors on a transient connection problem is retried up to 3 times (0.25 s, 0.5 s and 1 s apart, about 1.75 s in total) before the request is refused. An outage therefore adds up to about 1.75 s per affected detector before the refusal.
GET /admin/v1/tenants/{id} returns guardrail_baseline (the stored array, or null) and guardrails_fail_closed (0/1). Both are returned only to callers who may edit the organisation. Other members do not receive them, because the baseline's keywords and patterns are policy content. (Callers who may manage gateways see the baseline through the gateway read views, with keywords and patterns redacted unless they can manage gateways.) Numeric detector fields are stored and returned at full double precision (17 significant digits, integers up to 2^53-1), not rounded. Re-sending an unchanged value (for example a GET → PATCH round-trip) does nothing. A genuine change is audited as tenant.guardrail_baseline_changed or tenant.guardrails_fail_closed_changed. The baseline audit entry records the number of detectors and each detector's type, name and action, never its keywords or patterns. Both settings are included in the tenant export.
If the stored baseline is ever unreadable (for example after a manual database edit), the gateway does not treat it as "no baseline". It runs a synthetic tenant_baseline_corrupt detector instead, so every request on every gateway of the organisation is refused with guardrail_unavailable until the baseline is repaired with a PATCH. That detector also appears in the gateway read views. Admin reads and writes keep working, so the repair is possible.
Minimum for every source (source_policy_floor)
source_policy_floor is the organisation's minimum for the personal-data and keyword cells of every source: every connector's source policy and every gateway's built-in sources. It is set with PATCH /admin/v1/tenants/{id} by a platform administrator or the organisation's tenant administrator (anyone else: 403 tenant_editor_only).
{ "source_policy_floor": { "pii": { "delivery": "approval_2" }, "keywords": { "input": "block" } } }
- Accepted shape. An object (never an array,
[]included) withpii(keysinput,result,delivery) and / orkeywords(keysinput,result); each cell one of its levels (pii.inputallow/mask/block,pii.resultallow/mask,pii.deliveryallow/internal_only/approval_1/approval_2/block,keywords.inputallow/flag/block,keywords.resultallow/flag/withhold) ornull(no minimum for that cell).nullor{}clears the floor. - Rejected (
400 invalid_source_policy_floor,field: "source_policy_floor", nothing written). Anything other than an object ornull, an unknown key (atrustclass is not a floor cell), an unknown level, a level of another column. - How it applies. The floor never rewrites a stored connector or gateway setting: every read of a source's effective policy takes the stricter of the floor and the source's own cell (the contract shows such a cell with
source: "tenant_floor"). A source cell set explicitly below the floor is refused at its writer with400 source_policy_below_floor.pii_masking_enforcedstays the switch for "personal data coming back is always masked": it counts aspii.result=maskin the floor, without being stored in it. Example:pii.delivery=approval_2makes every external delivery of personal data need two people. - Changes. Raising the floor saves at once. Lowering it (a cell looser than stored, or removed) is held for a second administrator under config approval, like the guardrail baseline; the approval re-checks the held value, and ends
apply_failedwith reasonsource_policy_stalewhen the floor changed since the request (a raise made meanwhile is never reverted). Re-sending an unchanged value does nothing. A change is audited astenant.source_policy_floor_changedwith the floor before and after, and applies to every gateway of the organisation at once (the cached gateway configuration is refreshed). - Effect of a proposed floor.
GET /admin/v1/tenants/{id}/source-policy-floor/impact?floor=<JSON>counts what a floor would raise right now, before it is saved:{ "connectors": 4, "builtins": 3, "gateways": 2 }— connectors and built-in sources with at least one own cell looser than the floor, and the gateways those built-in sources are on. A connector's keyword cell it does not set itself follows its gateway and is not counted; a stored setting that cannot be read already counts as its strictest and is not counted. Counts only, never names. Tenant editors only (403 forbiddenotherwise). Accepted: exactly one parameterfloor, the URL-encoded JSON of a floor (the shape above;nullor{}= no floor) of at most 2048 bytes. Rejected (400, nothing read):floorabsent or empty →floor_required; not JSON, an array, too long, repeated, or a value the floor validator refuses →invalid_source_policy_floor; any other parameter →unknown_param; too many parameters →malformed_query. A read fault is the retryable503, never zero. - Read.
GET /admin/v1/tenants/{id}returnssource_policy_floor(the object, ornull) to callers who may edit the organisation. A stored value that cannot be read is returned as it is stored; the gateway then treats every cell as its strictest level until it is repaired. Included in the tenant export.
Delivery channel class (delivery_channel_class)
delivery_channel_class says which unattended delivery channels of the organisation count as internal. The
delivery disposition of a run (internal_only, approval_1, approval_2, block)
limits external delivery only; internal delivery is never limited by it. Without a setting every channel is
external, as before. It is set with PATCH /admin/v1/tenants/{id} by a platform administrator or the organisation's
tenant administrator (anyone else: 403 tenant_editor_only).
{ "delivery_channel_class": { "webhook": "internal", "mattermost": "external", "email": "external" } }
| Channel | What it covers | internal means |
|---|---|---|
webhook |
every outbound webhook of a scheduled agent or a workflow deliver step | a run's result goes to the webhook whatever its delivery disposition (no release, no block) |
mattermost |
the organisation's Mattermost delivery bot (scheduled agents and workflow deliver steps) | the same for Mattermost; the owner-e-mail fallback when Mattermost is unavailable stays under the internal-delivery rules of e-mail |
email |
every e-mail recipient of a scheduled agent, a task or a workflow deliver step | every recipient counts as internal (external keeps today's rule: an active user of the same organisation). The organisation's internal delivery setting (pii_internal_delivery_enabled) must still be on; a workflow's recipient must still be on the recipient allowlist |
Chat bridges (Mattermost / Teams / Slack conversations with an agent) answer the person who wrote to them and are no unattended delivery channel; they are not part of this setting.
- Accepted shape. An object whose keys are
webhook,mattermost,emailand whose values are exactly"internal"or"external", ornull. A whole value: a channel the object leaves out isexternal;nullor{}makes every channel external. - Rejected (
400 invalid_delivery_channel_class,field: "delivery_channel_class", nothing written). Anything other than an object ornull(an array, a string, a number), an unknown channel (teams,sms), any other value ("Internal",true,1,nullfor a channel). - Changes. Making a channel internal loosens the delivery policy: it is held for a second administrator under
config approval like a lowering of the minimum for every source
(
202 pending_approval, nothing written until approved). The approval re-checks the held value and endsapply_failedwith reasondelivery_channel_class_stalewhen the stored value changed since the request (a channel made external meanwhile is never reverted). Making a channel external saves at once. Re-sending an unchanged value does nothing. A change is audited astenant.delivery_channel_class_changedwith the full object before and after. - Read.
GET /admin/v1/tenants/{id}returnsdelivery_channel_classas the full object (every channel,internalorexternal) to callers who may edit the organisation. A stored value that cannot be read is returned as it is stored (the editor says it must be repaired); the delivery gates treat it as every channelexternal(fail closed) until it is repaired with aPATCH. Every delivery cleared because its channel is internal is logged by the gateway. Included in the tenant export. - Where it applies. The scheduler's and the workflow runner's delivery clearance (an internal webhook / Mattermost
channel is cleared, see Delivery disposition), the delivery release (an internal
channel is never held), the agent contract's
delivery.channels(external: false), and the e-mail internal-recipient check. A read fault of the organisation counts every channel as external.
Converting a free-trial tenant
A customer on the free trial who contacted Myra (while "Offer paid upgrade at signup" is off, the in-app upgrade buttons lead to the contact form) is converted by a platform admin with PATCH /admin/v1/tenants/{id} { "plan": "standard" } or { "plan": "enterprise" }. The rule is read from the platform setting paid_signup_enabled on every request:
Setting paid_signup_enabled |
Trial tenant plan change |
|---|---|
off (an explicit "false", or no row / an empty value — the documented default) |
Allowed. A change to standard / enterprise is a trial conversion: the same save clears trial_ends_at (so the tenant is never blocked trial_expired on its new plan) and lifts the trial's limits exactly like a Stripe trial→paid conversion (the tenant spend ledger is reset; the trial gateways' per-gateway budget caps and provider restriction are removed); the gateway config cache is refreshed at once. A move to any other catalog plan is a plain plan change (no conversion side effects). |
on ("true") |
Only the exact string "enterprise" is accepted (a sales-led trial conversion, with the same side effects as above). Any other present change (standard, another plan, null, another casing, garbage) is 409 { "error": "trial_plan_locked", "detail": "while \"Offer paid upgrade at signup\" is on, only Enterprise can be set on a free-trial tenant — …" } — the customer upgrades through the price calculator. Nothing is written. |
unreadable / malformed (settings store unavailable, a stored value other than "true"/"false") |
503 { "error": "temporarily unavailable; retry later" } (the standard retry answer) — nothing written; never guessed open. |
Rejected on a conversion: a body that also carries a non-null trial_ends_at → 400 trial_ends_at_conflicts_with_conversion (the conversion ends the trial; send null or omit it). If the tenant's plan changed concurrently (e.g. a Stripe conversion landed between the read and the write) → 409 { "error": "stale" }, rolled back. A tenant admin is refused 403 as for any plan change. An unchanged plan echo is never a change (no 409, no audit). Audited as tenant.plan_changed (with trial_conversion: true) plus tenant.trial_changed (the cleared end date). A converted Standard tenant has no seat cap until the platform admin sets seats (Tenant entitlements); it tops up its wallet by card (Billing › Wallet). A trial→enterprise conversion records the tenant's paid milestone (analytics account group paying); a trial→standard conversion does not record it, and a Standard wallet top-up does not either — set the account group with the operator override below when the customer is paying.
Moving a tenant onto the free trial (MAP-4402a). A platform admin may move a tenant to self_serve_trial; the dashboard offers it from enterprise only (for example to hand a lapsed customer the self-serve buy path), the API accepts it from any assignable plan. The rules apply to every source plan and are enforced under the tenant row lock:
trial_ends_atabsent → the trial end defaults to now (a stored end of the source plan is replaced), so the trial starts already expired; the tenant is blocked from inference until a plan is set again or it converts. A past value is accepted as given. A future value is refused (400 trial_ends_at_future); JSONnullis refused (400 trial_ends_at_required). A trial tenant never ends up without a trial end.- A tenant whose Stripe subscription has not ended (any status except
canceled/incomplete_expired; dunning counts) cannot move ontoself_serve_trial:409 subscription_present, nothing written. A fault reading that row answers503. An ended subscription does not block the move (MAP-4702): the row is kept, and the later purchase through the calculator replaces it (one subscription row per workspace), so a workspace that ever paid can be set back to the trial and buy again. A paid Custom workspace is answered409 plan_switch_requiredinstead (below): it reaches the trial through the scheduled switch. - The seat cap, entitlements and other settings of the source plan stay dormant on the row (they are not erased); the own-key purge of a move onto a self-serve plan applies as for every such move.
- A
planthat merely echoes the stored plan is never written (an unchanged save cannot revert a tenant converted meanwhile); a trialplanagainst a tenant whose locked plan moved answers409 stale.
Moving a paid Custom workspace: the scheduled switch (MAP-4701). While a Custom workspace (self_serve_custom, any paid self-serve plan) has a live Stripe subscription (any status except canceled / incomplete_expired; dunning — past_due, unpaid — counts as live), its paid period is kept: the plan is never changed directly. A PATCH that changes its plan (to Free, Standard, Enterprise or the trial) is 409 plan_switch_required, nothing written (decided on the plan and subscription read under the row locks; a fault reading the subscription answers 503). A Custom workspace without a subscription row, or whose subscription has ended, is moved directly as before. The move goes through these two routes instead (platform admin only; any other caller 403):
POST /admin/v1/tenants/{id}/plan-switchwith exactly{ "plan": "enterprise" }or{ "plan": "self_serve_trial" }(MAP-4702) schedules the switch. Nothing is written to Stripe at this point: the live subscription is read, and the target is recorded as a pending switch. Both targets follow the same states. About 72 hours before the period ends (commit_due_at, recomputed whenever Stripe reports a new period end), a background job commits it: the Stripe subscription is set to cancel at the end of the period (cancel_at_period_end). If the period ends sooner, the switch is committed in the same request. The workspace stays on Custom, with full access, until the subscription ends;customer.subscription.deletedthen moves it to the target (Enterprise: no subscription gate, the tenant's own provider keys are kept; trial: the trial end is set to the moment of the switch,trial_ends_at= now, so the workspace shows "trial expired" and its owner can buy a plan again through the price calculator — the purchase replaces the ended subscription row on the same Stripe customer; an admin may set a new trial end afterwards) and auditstenant.plan_changed(actorsystem,reason: scheduled_switch). The customer gets no "subscription ended" e-mail for it. Customer e-mails (MAP-4936): scheduling the switch e-mails the workspace's notification recipient once (admin-plan-switch-scheduled, workspace language) with the date the subscription ends and the plan it then moves to; the workspace keeps its current plan with full access until then. The date is the fixed cancellation date when that is not later than the period end, else the period end, shown as a UTC calendar day. When the switch takes effect, the recipient gets theadmin-plan-changede-mail once (a redeliveredcustomer.subscription.deletedand a plan that is already the target send nothing). Both e-mails are written in the same transaction as the switch / the plan move and sent after it, with retries (a failed send never undoes the change; a fault writing the notice rolls the request back: when scheduling503on a transient database conflict, else500; when it takes effect a failed webhook that Stripe redelivers). No e-mail while the workspace is suspended or partner-billed, and none after an undo or a dropped switch. If the tenant is no longer on Custom by then (another admin moved it), the switch is dropped and nothing else changes. If the subscription already ends by its period end (the customer cancelled it, or ops set a fixed cancellation date on or before the period end), the switch is recorded as committed at once, without a Stripe write, and takes effect when the subscription ends. A fixed date after the period end is replaced by the period end at the commit (the paid period is kept, the later date is not). Audited astenant.plan_switch_scheduled.DELETE /admin/v1/tenants/{id}/plan-switchundoes a pending switch, in our database only; Stripe was never told, and the subscription renews as before. Once the switch is committed, the undo answers409 plan_switch_committed: our system never reverts a cancellation in Stripe, because such a write could land after the customer's own statutory cancellation. The customer can still keep Custom by choosing Don't cancel in the Stripe billing portal, which drops the switch (below). Audited astenant.plan_switch_undone. A scheduling e-mail that is still owed (not sent yet, for example while it is retried) is withdrawn in the same transaction and never sent; one whose send is already in progress may still arrive, and an already-sent one cannot be retracted. A fault withdrawing it rolls the undo back (503on a transient database conflict, else500).- Answers.
200 { "plan_switch": {…} | null }— the switch as it is now (shape below).400 invalid_plan_switch_target:planmissing, not a string, another casing or not a switch target (enterprise,self_serve_trial);400 unknown_fieldfor any other body key; a non-object body400 malformed_body.404 tenant_not_found.409 plan_switch_not_applicable: the tenant is not on a paid Custom plan, has no subscription, or the subscription has already ended (change the plan directly).409 plan_switch_pending: a switch is already recorded (undo it first to pick another).409 plan_change_pending: the customer has a plan change in flight, scheduled (a Stripe subscription schedule) or waiting for payment — schedule after it applied or the customer cancelled it.409 no_plan_switch(undo): none is recorded.409 plan_switch_committed(undo): Stripe already ends the subscription for the switch.502 stripe_unavailable: the live subscription could not be read, or its cancellation date or period is unreadable; nothing changed. A storage fault answers the standard503retry; a fault writing or withdrawing the customer e-mail that a retry cannot heal answers the sanitised500(nothing changed). - How the commit is decided. The job takes a due switch by compare-and-set (state
committing, a lease) before any Stripe call, re-reads the live subscription, releases only our own subscription schedule, and writescancel_at_period_end=truewith one idempotency key per switch; a retry reuses it. A definite Stripe refusal (a 4xx other than 409 / 429) puts the switch back topending(retried in an hour) and alerts ops (plan_switch_commit_failed). After a timeout, a dropped connection, a 5xx, a 409 or a 429 the outcome is unknown: the switch stayscommittingand is resumed with the same key. The switch is settled only on proof for the current stored key: a completed (2xx) answer to that same-key request, or acustomer.subscription.updatedevent carrying exactly that key asrequest.idempotency_key. Neither a live state on its own (a subscription the customer cancelled meanwhile) nor an event of an older commit settles it. After that proof, a read of the live subscription decides, never the (possibly replayed) answer: ending →committed; renewing → the customer reactivated after our write, so the switch is dropped. The key is never replaced. Once it was sent, the switch leavescommittingonly on that proof, or on a definite refusal of that same request (then back topending). Any other failure on a retry keepscommittingand the key: a schedule that cannot be released, a failed live read, or an ambiguous answer. Ops are paged (plan_switch_commit_failed), the same key is retried later, and the switch cannot be undone meanwhile. A switch not committed 36 hours before the period end alerts ops, and 6 hours before it pages them (plan_switch_commit_overdue). A malformed cancellation date never records, commits or drops a switch. At deletion the switch is kept asapplied, so a redeliveredcustomer.subscription.deletedapplies nothing twice and sends no "subscription ended" mail. - While it is scheduled. The customer's price-calculator change is refused (
change_blocker: switch_scheduled, Billing); the customer can change plans again once the admin undoes a pending switch. If the customer clicks Don't cancel in the Stripe billing portal (or ops remove the cancellation in Stripe), the subscription renews: in every state (pending, committing, committed) the switch is dropped once a live read confirms the renewal, audited astenant.plan_switch_dropped(actorsystem), and ops get the alertplan_switch_dropped— schedule again if still wanted. While the job's own write is unsettled, such a change only marks the switch; the job drops it after settling its write and never sends a second key. A customer statutory cancellation (§ 312k form) before the commit is written to Stripe as usual, and the switch still applies at period end. After the commit the form writes nothing to Stripe (the subscription already ends) but still sends the regular written (§ 312k Textform) confirmation, with the period end (or the fixed cancellation date) as the termination date. A repeat declaration after one is recorded gets the "already cancelling" status mail: no second confirmation, and the first receipt date is kept. Either way the date of the customer's declaration is recorded for information (customer_cancelled_at, shown in Tenants → Edit; it never drives a Stripe write). A renewal of such a subscription pages ops (plan_switch_customer_cancel_revoked).
Convert to Managed (convert_to_managed: true). A platform admin can end a stale trial without changing the plan: PATCH /admin/v1/tenants/{id} with { "convert_to_managed": true } (the dashboard's Convert to Managed button on the tenant's trial card). It clears trial_ends_at (so the tenant is no longer blocked 402 trial_expired); nothing else changes (plan, budgets, spend caps and gateway settings stay as they are). It records the paid milestone (once, and only when a trial end date was actually cleared; a conversion that finds nothing to clear answers 200 and records nothing). A tenant in the analytics account group test is not a customer and is refused (convert_to_managed_test_tenant, below); a tenant with no account group yet converts. Audited as tenant.trial_changed with reason converted_to_managed. It is a one-way action on a tenant that currently has a trial end date; the trial gate itself is unchanged, so deliberate demo/POC end dates keep blocking until converted or cleared. Platform admin only (a tenant admin gets 403). Rejected → 400: a value other than boolean true → invalid_convert_to_managed; combined with a plan change (including a trial-to-plan conversion or plan: null) → convert_to_managed_conflicts; combined with a non-null trial_ends_at → trial_ends_at_conflicts_with_conversion; on a self-serve plan (self_serve_*, whose trial is owned by the subscription) → convert_to_managed_self_serve; in the analytics account group test → convert_to_managed_test_tenant (checked under the row lock, whether or not a trial end date is left). If the account group cannot be read the save fails 500 and nothing changes.
Read side. GET /admin/v1/tenants and GET /admin/v1/tenants/{id} carry two server-derived, editor-only fields the Edit pop-up renders from (the client never re-derives the rule):
trial_conversion_targets— always an array:["standard","enterprise"]only for a free-trial tenant, a platform admin caller and the setting off;[]otherwise (setting on or unreadable, a non-trial plan, atenant_admincaller).plan_move_targets(MAP-4402a) — the plans the dashboard's plan select offers a platform admin for this tenant (the UI's offer, derived on the server bybilling.admin_plan_policy; it is not thePATCH's whole rule: thePATCHaccepts any assignable plan under the guards above — the trial conversion rule, the subscription guard and the trial-end rule — and refuses only what those refuse). A free-trial tenant gets itstrial_conversion_targets; any other plan gets["free","standard","enterprise"], plus"self_serve_trial"only when the stored plan isenterpriseand the tenant has no subscription that has not ended (an ended one does not count, MAP-4702; if the rows cannot be read, the trial is not offered). A paid Custom tenant (a live subscription, above) gets[]: it moves only through the scheduled switch (MAP-4701); if its subscription cannot be read,[]too.[]for atenant_adminand every non-platform caller. The admin UI offers exactly this list (plus the stored plan) and never derives a move itself.plan_switch_targets(MAP-4701) — the plans a platform admin may schedule a switch to:["enterprise","self_serve_trial"]for a paid Custom tenant without a recorded switch;[]otherwise (another plan, no live subscription, a switch already recorded, the subscription unreadable, a non-platform caller).plan_switch(MAP-4701) — the recorded switch ornull:{ "plan": "enterprise" | "self_serve_trial", "state": "pending" | "committing" | "committed", "committed": boolean, "effective_at": unix seconds, "commit_due_at": unix seconds | absent, "customer_cancelled_at": unix seconds | absent }.pending= not yet told to Stripe, the admin can undo it;committing= the job is telling Stripe;committed= Stripe ends the subscription at period end (no admin undo).committed= the state is notpending.effective_at= the fixed cancellation date when one is stored, else the period end.commit_due_at= when a pending switch is committed.customer_cancelled_at= the customer's § 312k cancellation via the cancellation form (information only). Shown to every editor (a tenant admin sees it on Your plan too). Absent when the subscription could not be read (unknown, nevernull).seats_editable—truewhen a platform admin may edit the seats:enterprisealways,standardonly while the setting is off;falsefor every other plan and for atenant_admincaller.
All of them are stripped from a non-editor member's row.
⚠️
plan/platform_cap_usd/trial_ends_at/mattermost_delivery_enabled/mattermost_bot_token/code_interpreter_artifact_max_bytes/compliance_report_enabled/playground_enabled/agents_enabled/workflows_enabled/scheduled_tasks_enabled/conversation_retention_days/request_log_retention_max_days/bedrock_region/vertex_region/web_search_provider/request_logging_disabled/provider_allowlist/provider_allowlist_enforcedare platform-admin-only. (The former per-period tenant budget is retired — the tenant limit isspend_cap_usdplus the prepaid wallet.) APATCHfrom a non-platform-admin (e.g. atenant_admin) that tries to change any of them is rejected with403 { "error": "<field> is platform-admin-only and cannot be changed by a tenant admin" }and the request writes nothing (no partial update, no side effect). APATCHthat omits them (the normal tenant-admin edit shape) or re-sends the current stored value is a valid200no-op — so idempotent full-object round-trips and tenant-admin edits of other fields (branding, assistant name, …) keep working. The SPA hides these controls from a tenant admin (defense in depth), but the backend is the authoritative boundary — the rejection applies to every caller (public admin API, mobile, scripts), not just the dashboard.Data & Retention + Routing: the tenant-admin SPA does not show the Data & Retention tab (
conversation_retention_days,request_log_retention_max_days) or the Routing tab (bedrock_region,vertex_region,web_search_provider), and the API enforces it too: atenant_adminPATCHthat would change any of the five is rejected403naming the field and writes nothing. The compare is NULL-normalising per field so an idempotent full-object round-trip keeps working — for the retention pairnulland0are both "disabled"; for the two regionsnulland""are both "unset"; forweb_search_provideronlynullis "unset" (""is that field's own400, for every caller). Otherwise the value is compared verbatim: a padded or re-cased echo of the stored value counts as a change (fail closed), and so does a wrong-typed value ("90",42). An unchanged echo (or an omit) is a200no-op for these columns — no re-write, no audit row, no gateway-cache flush (the tenant'srow_versionstill advances, as on every successfulPATCH). Scope, stated honestly: this guards the tenant's org-wide default columns. The per-gateway region / web-search override onPATCH /admin/v1/gateways/{id}(GATEWAYS_MANAGE) is a different surface and remains tenant-admin-settable; whether it should be gated too is still an open ruling. The retention pair has no other write door, so that half is a complete boundary.
grant_usdis platform-admin-only: a funding grant is in the 403 list above — it creates wallet credit from nothing, a Myra operation, so a non-platform actor's grant is rejected403(never held, never credited); a workspace adds funds only through Stripe checkout.frozenis likewise platform-admin-only: a tenant must never unfreeze itself.A funding grant that hits a transient database fault is rolled back whole. When the wallet credit of a
grant_usdfails with a transient fault (a lock wait or deadlock), the wholePATCHis rolled back (no wallet credit, no field change, norow_versionbump) and the answer is503 { "error": "temporarily unavailable; retry later" }with aRetry-Afterheader. Send the same request again with the samegrant_nonce: the grant is idempotent on it, so it credits once. Any other credit failure answers500 { "code": "wallet_credit_failed" }, also with everything rolled back.🔒 Optimistic concurrency (avoiding lost updates). The tenant edit is a read-modify-write: a client loads the tenant, then saves. Two concurrent edits to the same tenant would otherwise clobber each other (last-writer-wins on the whole row). To prevent this, read
row_versionfromGET /admin/v1/tenants/{id}(or the list) and send it back asexpected_versionon thePATCH. If the tenant changed under you, thePATCHreturns409 { "error": "stale", "row_version": <current> }and writes nothing — reload and retry. On success thePATCHreturns the bumpedrow_version; adopt it for your next save. Concurrent edits to the same field remain last-writer-wins by nature; the precondition prevents silent loss of a concurrent edit to a different field. Every successfulPATCHadvancesrow_version— except a four-eyes202held response, which returns before the transaction and therefore leaves the caller's token still valid — including one that omitsexpected_version— so a caller that does send the precondition always detects a concurrent write, whatever the other caller did.expected_versionis therefore opt-in: omit it and your own request keeps the legacy last-writer-wins behaviour (no409), but it still bumps the version and cannot silently slip past a concurrent precondition-checking editor. This mirrors the workflow-draftupdated_atprecondition.⚛️ Atomicity — a
PATCHapplies all-or-nothing. All of aPATCH's field writes and therow_versionbump are applied inside a single database transaction. If any write fails mid-request, the whole edit is rolled back: the tenant row — including itsrow_version— is left exactly as it was before the request, and thePATCHreturns500 { "error": "internal error", "request_id": "…" }(the database's own text is never returned). Nothing is left half-applied, so a retry sees the unchanged row and does not spuriously409on a phantom version bump, and a concurrentGETcan never observe a partially-updated tenant (e.g. the new branding but the old regions). A validation error (400) is detected before the transaction opens, so it likewise writes nothing. Compliance audit-log entries for the change and the per-gateway config-cache refresh (for residency-affecting fields) are applied after the transaction commits, so they reflect only a change that actually persisted.
To disable request logging for a tenant (platform admin only):
curl -X PATCH https://<your-gateway-host>/admin/v1/tenants/{id} \
-H "Content-Type: application/json" \
-d '{"request_logging_disabled": 1}'
SIEM egress target (siem)
siem configures an external destination the gateway delivers a copy of each event to (see SIEM targets). It is tenant-admin-settable (a tenant_admin with TENANT_SETTINGS_MANAGE / GATEWAYS_MANAGE may set it) and schema-validated at the write boundary (malformed input is rejected 400, never clamped or coerced). The SSRF control is the egress validator, not an admin wall: the syslog transports (udp/tcp/tls) may target the tenant's own private/internal SIEM, but a host that resolves to a loopback, link-local/cloud-metadata, ULA, multicast/reserved address, or any address in the operator's Myra-infra denylist, is rejected 400 (and blocked again at delivery against the pinned IP). HTTP transports (splunk_hec/elasticsearch/vector) remain public-only. The same object is accepted on POST /admin/v1/tenants and, as config.siem, on the gateway routes (Updating gateway config).
Accepted shape (object; unknown top-level fields are rejected 400):
| Field | Applies to | Rule |
|---|---|---|
type |
all | Required. One of splunk_hec, elasticsearch, vector, syslog. |
url |
splunk_hec / elasticsearch / vector |
Required for these types. A string that passes the gateway's SSRF egress check — an http/https URL to a public host. A loopback / RFC1918 / link-local / 169.254.x / non-http(s) / userinfo-bearing URL is rejected 400. Max 2048 chars. |
token / index / username / password (tenant siem: token and password are write-only, see below) |
splunk_hec: token / index; elasticsearch: index / username / password; vector: token |
Optional strings, max 512 chars, no control characters. Each HTTP type accepts only the keys listed for it, the ones the gateway sends: username / password on splunk_hec, token on elasticsearch, and index / username / password on vector are rejected 400. A token is sent as Authorization: Splunk <token> to splunk_hec and as Authorization: Bearer <token> to vector (to vector, an empty token sends no header). A vector token containing a space is rejected 400 (siem.token must not contain spaces (it is sent as a bearer token)). A legacy stored value that is not a valid header value (whitespace, a control character, over 4096 bytes) is kept on an unchanged echo but is not sent. |
host |
syslog |
Required. A bare hostname or IP that passes the same egress check (a /, @, or whitespace is rejected). Max 512 chars. |
port |
syslog |
Optional integer in [1, 65535] (default 514; use 6514 for tls). A non-integer, fractional, string, or out-of-range value is rejected 400. |
protocol |
syslog |
Optional; udp, tcp, or tls (default udp). tls is TLS-encrypted syslog over TCP, with the receiver certificate verified against the public CA trust store. Any other value is rejected 400. |
format |
syslog |
Optional; cef or rfc5424 (default cef) — the payload inside an RFC 5424 syslog message (wire format). |
events |
all | Optional array of all / security / blocked / guardrail / scrubbed / access / governance (max 16). An object, a non-string element, or an unknown name is rejected 400. |
Rejected (each → 400, nothing stored): a non-object siem; an unknown type; a missing url (HTTP types) or host (syslog); an HTTP url the SSRF chokepoint refuses (public-only), or a syslog host the egress policy denies (loopback/link-local/metadata/ULA/multicast/Myra-denylist, or any private host when self-serve is off); a bad port/protocol/format; a malformed events; any unknown field; a syslog-only field (host/port/protocol/format) on an HTTP type, or an HTTP-only field (url/token/index/username/password) on syslog; a string key the HTTP type does not accept — username / password on splunk_hec, token on elasticsearch, index / username / password on vector (siem.<field> is not valid for type <type>; present in any form, an empty string or null too); any field over its length cap; a host name that is not a valid DNS name (an empty label, a label over 63 bytes, a label starting or ending with -, a name over 253 bytes, or any character other than letters, digits, - and .; this applies to a syslog host and to the host of an HTTP url), which is refused as a plain 400 before any DNS query is made. A rejection body is { "error": "invalid siem: <reason>", "code": "invalid_siem" } (formerly siem_invalid). A syslog host that cannot be verified right now (DNS error, egress denylist unreadable or malformed) is answered 503 (code siem_target_unverifiable, retry), not 400. An omitted siem leaves the stored value unchanged; an editor's (admin / tenant_admin) unchanged-echo siem is a 200 no-op (a custom-role caller's siem is validated every time) — so a config stored with a key its type does not accept, before such keys were refused (API only, the SIEM forms never sent them), still saves unchanged for an editor; any change has to drop it. Testing such a stored configuration answers 409 invalid_stored_siem_config until it is saved without them.
Write-only credentials (tenant siem). token and password are never returned: GET /admin/v1/tenants/{id} shows token_set / password_set booleans in their place, and both are stored encrypted (sealed) with the master key. On PATCH by a tenant editor (platform admin / tenant_admin), a leaf that is absent keeps the stored value, "" or null clears it, and a non-empty string replaces it. A caller who is not an editor (a custom role with TENANT_SETTINGS_MANAGE) cannot read the stored configuration, so their PATCH is a full replace: an absent leaf clears the stored one. A non-empty submitted secret is always a real write, even when it equals the stored one: it is re-sealed, audited as a change (tenant.siem_changed naming token / password) and the gateways are flushed. token_set / password_set are read-only: ignored on write when boolean, 400 otherwise. A stored credential is never sent to another address: changing the url while leaving a stored token / password out answers 400 with code: "siem_credential_required" (re-enter the credential or send ""); changing the type keeps nothing. A blank (whitespace-only) value is 400 invalid_siem. If the value cannot be sealed (no master key) the write answers a sanitised 500 and stores nothing.
Clearing. "siem": null clears the tenant SIEM configuration (same TENANT_SETTINGS_MANAGE permission as setting it, including custom-role callers who hold it; otherwise 403). The answer is the same 200 whether or not a value was stored, so repeating it is safe. {}, [] and any other non-object value (false, 0, a string) are rejected 400 and never clear. A PATCH that carries siem (a value or null) together with a field that needs four-eyes approval is rejected 400 with code: "siem_requires_separate_patch", nothing written and no approval request created; send siem in its own PATCH. Each set, change or clear is audited as tenant.siem_changed, recording only {type, host} before and after, never a token, password, username or URL path/query. Every other SIEM field that changed (url, port, protocol, format, index, events, token, username, password) is named with the fixed placeholder "(previous value)" before / "(new value)" after instead of its value, so the audit entry shows which fields changed (a token-only rotation names token); an unchanged field is left out. For a caller who cannot read the stored configuration (custom role with TENANT_SETTINGS_MANAGE), url, token, username and password are named whenever either side holds them, so the entry never reveals whether a guessed credential matches. A siem value that normalises to exactly the stored configuration (e.g. only an added "index": null) is no change: nothing is written, audited or streamed.
Egress restriction (delivery). The validated target is also re-checked at delivery time: the HTTP transports connect to the pinned, re-validated IP (closing the DNS-rebinding window), and the syslog transports re-resolve the host through the same egress policy and connect to that pinned IP, with a socket timeout — so a stored target that later resolves to a denied address delivers nothing (logged at WARN).
Stored values at delivery (syslog). A stored config written before this validation existed is handled fail-closed: an absent (or JSON null) protocol / format takes the default (udp / cef), but a present value outside the accepted set (for example "TLS") delivers nothing (logged at WARN) — it is never downgraded to plaintext UDP.
Event fields at delivery (syslog). Each event's field values are untrusted (request path, client address, detector and model names) and are sanitised when the syslog message is built: invalid UTF-8 → U+FFFD; control characters and Unicode line breaks → space; a value of the wrong type is left out exactly like a missing one; a client/actor address that is not a valid IP is left out; an unusable event time (missing, non-numeric, seconds instead of milliseconds) is replaced by the send time; a non-integer or out-of-range status (or a negative cost / token count) is left out — in both the CEF and the JSON format. One message never exceeds 8192 bytes. See Syslog wire format.
Test the SIEM connection
POST /admin/v1/tenants/{id}/siem/test sends one real test event to a SIEM target and tells you how far it got. For splunk_hec, elasticsearch and vector that writes one real document into your index; for syslog it sends one real message. The event carries a test marker (siem_test in the JSON payloads, class SIEM_TEST in CEF) so you can filter it out. The test ignores the target's events filter. The SIEM streaming page (Organisation › Governance & security › SIEM streaming) runs this test on the form's current values, unsaved changes included (Testing the connection).
Permission: TENANT_SETTINGS_MANAGE (the same as setting siem), on a tenant you can reach; another or unknown tenant answers the same 404 as GET.
Body field gateway_id (optional, string): test a gateway's SIEM override instead of the tenant's. An empty body then tests the gateway's stored config.siem; a submitted siem that omits token / password reuses the gateway's stored secret for the same target (the secret is write-only and never leaves the server). Changing the url without re-entering the secret is 400 siem_credential_required; changing the type uses no stored secret. Only a platform admin or tenant_admin can use the stored secret this way. An unknown gateway, or one of another tenant, answers 404 gateway_not_found. gateway_id, when present, must be a non-empty string of at most 64 bytes; anything else (including JSON null) is 400 invalid_field.
Body (all optional):
- Empty body (or
{}): test the stored configuration. Only a platformadminortenant_adminmay do this. Any other caller gets one fixed400{ "code": "siem_required" }, whether or not a configuration is stored. Nothing is stored:409siem_not_configured, or409invalid_stored_siem_config(formerlysiem_config_invalid) for an unreadable stored value. A stored value that decodes but fails validation (for example an unknowntype, or a host name saved before the strict host-name rule such asa_b.example.com) is also409invalid_stored_siem_config, never dialled and never resolved; only a syslog host that cannot be verified right now stays503. The400invalid_siem(formerlysiem_invalid) is for a submitted configuration. { "siem": { ... } }: test the submitted configuration without saving it. It is validated exactly like aPATCHand a rejection is the same400(or503when a syslog host cannot be verified). Rejected targets (loopback, link-local/metadata, a disallowed private host, a bad schema) are never dialled. A stored configuration written before validation existed is not grandfathered.- Any other body (
null, a number, a string,false,[], invalid JSON) is400malformed_body. A key other thansiemis400.siemmust be a non-empty object:null, a scalar or an array is400invalid_siem;{}is400siem_required(all with the sentencesiem must be a non-empty object).
Response 200 (even when the test fails):
{ "ok": false, "stage": "connect", "detail": "connect timeout", "status": null, "latency_ms": 5003 }
stage |
Meaning |
|---|---|
ssrf_gate |
The target resolves to a blocked address (or could not be resolved) at dial time. Nothing was sent. |
connect |
The connection could not be established (DNS, TCP). For the HTTP backends this also includes HTTPS TLS failures. |
tls_handshake |
Syslog protocol: "tls" only: the TLS handshake failed. |
auth |
The SIEM answered HTTP 401 or 403. |
send |
The SIEM answered another non-2xx status, timed out reading the answer, or a socket write failed. |
delivered |
ok: true. HTTP 2xx, or the syslog frame was written. UDP has no acknowledgement, so delivered means the datagram was handed to the network. |
config |
The target type is not usable. |
detail is a fixed text per stage plus an error kind (timeout, refused, closed, failed). It never contains the SIEM's response body, a token, password, username or URL path. The 15-second bound covers connect, TLS and send. Resolving a host name is not part of it. A name is resolved when the target is checked and again to pin the dial; each resolution asks for an IPv4 and an IPv6 answer, and each of those can take up to about 4 seconds (resolver timeout 2 s, one retry). The worst case for a target given by name is therefore longer than 15 seconds. A malformed host name (see the rejected list in Tenant SIEM) is refused before any lookup.
Rate limits (fail closed, checked before the body is read): 10 tests per minute per user and 30 per minute per tenant, otherwise 429 rate_limited. The per-user limit is checked first; the tenant budget is only consumed by calls the user limit admits, so one user who hits their limit cannot exhaust the tenant's budget.
An attempt is audited as tenant.siem_tested once its configuration is being evaluated, recording only {type, host, ok, stage, source} (source is stored or submitted), never a credential. Audited: a submitted or stored configuration that fails validation (including rejected loopback, private or metadata targets, stage validate), a stored configuration that is missing (siem_not_configured) or unreadable (invalid_stored_siem_config, stage config), and every real test (stages ssrf_gate, connect, tls_handshake, auth, send, delivered, and config for an unusable type). Not audited: a malformed or unknown-field body (malformed_body, unknown_field), a missing siem for a caller who may not use the stored configuration (siem_required), a present but malformed siem (invalid_siem), 401, 403, 404 and 429 responses.
White-label text branding
Per-tenant white-labeling of the in-app product identity, editable by admin or
tenant_admin (edit-only — not accepted on tenant creation). Every value is untrusted
input, validated at the trust boundary and stored fail-closed; each field is cleared by
sending JSON null or an empty/whitespace-only string, which reverts that surface to
the platform default. The values ride the authenticated /me payload (and, for the
non-sensitive subset, the public login-branding endpoint) and are rendered verbatim by
the app, so control characters and non-http(s) link URLs are rejected.
curl -X PATCH https://<your-gateway-host>/admin/v1/tenants/{id} \
-H "Content-Type: application/json" \
-d '{
"brand_product_name": "Acme Assistant",
"brand_home_greeting": "Welcome to Acme Assistant",
"brand_chat_disclaimer": "Acme Assistant can make mistakes. Verify important information.",
"brand_sidebar_links": [
{ "label": "Docs", "url": "https://docs.acme.example" },
{ "label": "Status", "url": "https://status.acme.example" }
]
}'
| Field | Accepted | Rejected → 400 |
|---|---|---|
brand_product_name |
string ≤ 80 chars (trimmed); null/empty clears |
non-string, over-length, or any control character |
brand_home_greeting |
string ≤ 200 chars (trimmed); null/empty clears |
non-string, over-length, or any control character |
brand_chat_disclaimer |
string ≤ 128 chars (trimmed); null/empty clears |
non-string, over-length, or any control character |
brand_sidebar_links |
a JSON array of at most 4 { "label", "url" } objects; null/[] clears |
not an array, more than 4 items, a missing/empty/over-40-char label, a missing/over-512-char url, a control character, or a URL that is not an absolute http:///https:// URL (a javascript:, data:, protocol-relative //host, or relative/scheme-less URL is rejected as an XSS vector) |
brand_primary_color |
exactly #RRGGBB (trimmed, stored lower-case); null/empty clears. Used by the document exports |
a non-string, or any other colour form (#RGB, a named colour, a value with ;, } or quotes) |
brand_font_family |
1–120 characters: letters, digits, spaces and hyphens (trimmed); null/empty clears. Used by the document exports |
a non-string, over 120 characters, or any other character (quotes, ;, braces, angle brackets, tab, newline) |
Product-name precedence (one source of truth). The default in-app product name is
"Myra AI Workspace". When brand_product_name is set, it overrides that
default only in the in-app product strings — the browser tab title, the app-chrome
wordmark's accessible label, the login-card title, and the tenant's transactional
emails (the login-code and invitation emails' subject, body, header, and footer). It
does not change the product name used in the documentation or marketing surfaces,
which remain "Myra AI Workspace" regardless of tenant branding. Clearing the
field reverts every in-app surface to the default (each email also falls back to the
default fail-closed).
Per-tenant cloud region (Bedrock / Vertex)
A tenant carries a default cloud region for the region-bearing providers, inherited by
every gateway under it that sets no region of its own (see
Region resolution).
Platform-admin-only: a tenant_admin changing either field is rejected 403; an
unchanged echo (null/"" while unset, or the stored token verbatim) is a 200 no-op.
curl -X PATCH https://<your-gateway-host>/admin/v1/tenants/{id} \
-H "Content-Type: application/json" \
-d '{"bedrock_region": "eu-central-1", "vertex_region": "europe-west4"}'
| Field | Accepted | Rejected |
|---|---|---|
bedrock_region |
A known EU AWS region token (eu-central-1, eu-west-1, eu-west-3, eu-north-1, eu-south-1, eu-south-2); or null / "" to clear (inherit the env / US default). |
Any non-EU region (e.g. us-east-1), unknown/garbage token, uppercase, embedded CR/LF or /, over-long (> 32 chars), or a non-string → HTTP 400 with allowed listing the valid options. |
vertex_region |
A known EU GCP region token (europe-west3, europe-west10, europe-west1, europe-west4, europe-west9, europe-west8, europe-west12, europe-central2, europe-north1, europe-north2, europe-southwest1); or null / "" to clear. |
As above. |
Values are validated unconditionally as EU-member regions at the trust boundary
(region.is_eu, fail closed) — independent of whether eu_region_routing enforcement is
on. The region only chooses which Bedrock / Vertex endpoint is dialed: it never makes the
route EU residency (both are US-owned clouds, refused under eu_region_routing in every
region — see Data residency). Enumerate the valid options with GET /admin/v1/cloud-regions (below) rather than
hardcoding them. The two columns are written atomically; a PATCH that sets only one
preserves the other.
Web-search provider default
A tenant also carries a default web-search provider its gateways inherit — the
tenant-level twin of the per-gateway web_search.provider (see
Web Search — Supported providers).
Platform-admin-only: a tenant_admin changing it is rejected 403; null while unset, or the stored value verbatim, is a 200 no-op ("" stays that field's own 400).
curl -X PATCH https://<your-gateway-host>/admin/v1/tenants/{id} \
-H "Content-Type: application/json" \
-d '{"web_search_provider": "linkup"}'
| Field | Accepted | Rejected |
|---|---|---|
web_search_provider |
"brave" or "linkup" (lower-cased — "BRAVE"/"Linkup" resolve); or JSON null to clear (no tenant default). |
Any other value — an unknown provider ("google"), a value with surrounding whitespace ("BRAVE ", " linkup"; not trimmed), an empty string "", a number, boolean, object, or array → HTTP 400 with allowed listing the valid providers. |
Unlike the region fields, "" does not clear — the enum is strict (the SPA sends JSON
null for the "no tenant default" option). The value is validated at the trust boundary
against the search-adapter registry (utils.search.normalize_known_provider) — the client
is never the authority. A change is audited (tenant.web_search_provider_changed) and
flushes the tenant's gateway-config cache so it takes effect immediately.
Resolution + the EU floor. The tenant default fills a gateway's web_search.provider
only when the gateway already has a web_search block and sets no provider of its own
(a tenant default never enables web search on a gateway that has none). A per-gateway
provider overrides the tenant default — except under an armed EU residency floor
(eu_region_routing on, per-gateway or inherited): a non-EU per-gateway provider is
then clamped up to an EU tenant default (a gateway may still choose another EU
provider). When the tenant default is absent or non-EU the gateway value is left alone and
the search-egress gate still fail-closes a non-EU query under enforcement. The gateway's
web_search.api_key must be valid for the effective provider (one key per gateway).
Gateways saved before this feature carry an explicit
"brave"provider (the old form always stamped one), so on a non-enforcing tenant the new default does not retroactively apply to them — re-save such a gateway with the Tenant default option to make it inherit.
Auto model-selection policy
A tenant carries an auto_default policy that governs which model the server picks for
an Auto conversation (one created with no explicit model pin). It reorders the selection
objective over the same eligible candidate set — the eligibility guards (data-residency
offer set, plan allowlist, tool-calling capability, local-only tier) are unchanged, so
whatever Auto picks under any policy is still a model the workspace is actually allowed to
run.
curl -X PATCH https://<your-gateway-host>/admin/v1/tenants/{id} \
-H "Content-Type: application/json" \
-d '{"auto_default": "best"}'
| Field | Accepted | Rejected |
|---|---|---|
auto_default |
Exactly one of "cheapest_tool_capable" (default), "balanced", or "best". |
Any other value — an unknown policy ("premium"), a different case ("BEST"), surrounding whitespace (" best", "best "; not trimmed), an empty string "", JSON null, a number, boolean, object, or array → HTTP 400 with allowed listing the valid policies. |
cheapest_tool_capable(the column default — today's behaviour): the cheapest tool-calling model, preferring the preferred providers.balanced: the second-highest quality tier available across the fleet (falls back to the single best tier when only one exists).best: the highest quality tier available across the fleet.
The column is NOT NULL (default cheapest_tool_capable), so there is no "inherit"
state and JSON null is rejected, not a clear. The value is validated at the trust
boundary against the one policy authority (core.auto_policy.is_valid) —
the client never sets the routing objective. A change is audited
(tenant.auto_default_changed); it needs no gateway-config flush because the policy is read
at route-resolve time, not folded into gateway config. A stored value the server no longer
recognises fails safe to cheapest_tool_capable.
Cloud-region options
Returns the ordered EU region options for the tenant SELECT, grouped by provider scheme (the single source of truth is the backend region allowlist — the SPA must not hardcode it):
{
"aws": [ { "value": "eu-central-1", "label": "Frankfurt, DE" }, ... ],
"gcp": [ { "value": "europe-west3", "label": "Frankfurt, DE" }, ... ]
}
Any authenticated admin or tenant_admin may read it (static, non-sensitive labels).
Deleting a tenant (soft delete)
curl -X DELETE https://<your-gateway-host>/admin/v1/tenants/{id} \
-H 'Content-Type: application/json' \
-d '{"confirm": "<tenant-slug>", "users": "keep"}'
Sets deleted_at on the tenant — the decommission step. Every row is retained (so
the tenant can still be exported before purge), but the tenant is disabled: it is
hidden from listings and, as of the fail-closed hardening, stops resolving on every
authentication and routing path. A soft-deleted tenant's gateways no longer route,
its API tokens no longer authenticate, its users can no longer sign in (session, email
OTP, OIDC/SAML, SCIM all reject), SSO discovery / …/start no longer respond for it,
and its public conversation shares (/share/{token}) go dark immediately — the
snapshot returns a public 404, not at purge time — each resolver enforces
tenant.deleted_at IS NULL in SQL and denies (401/404) otherwise. This is the step to
take at contract notice; the permanent erasure below is the contract-end companion, and
the restore below is its reversible undo.
This is a destructive-action endpoint, guarded fail-closed:
- Actor gate (a combination). A platform administrator (role
admin) may delete any tenant. An organisation administrator (roletenant_admin) may delete only their own tenant — the target id must equal the actor's session tenant (derived server-side, never from the path); any other tenant, or no such tenant → 404 (identical, see cross-tenant tenant ids). The check is on the enum role, so the delete is not reachable through a custom role that merely grantsTENANT_SETTINGS_MANAGE— deleting the organisation is not a delegable capability. A same-tenantmember/viewer(even one holding a delegatedTENANT_SETTINGS_MANAGE) → 403; unauthenticated → 401. -
Confirmation token. The request body must contain
{"confirm": "<tenant slug>"}matching the tenant's own slug exactly (a "type the name to confirm" guard, shared with the purge below). A missing / non-string / empty / whitespace-only / mismatched value → 400, and nothing is deleted (deleted_atstaysNULL). The id is already in the URL, so the id is not accepted as confirmation. -
What happens to the users (
users). Every user of the tenant holds their email address (an address belongs to at most one active account platform-wide) and cannot sign in while the tenant is deleted. The body'susersfield decides:usersEffect absent, or "keep"The users are kept: the tenant can be restored with its people. Until then they cannot sign in and their addresses stay taken (a platform admin finds them with GET /users?scope=deleted_tenantsand can move or delete them later)."delete"Platform administrators only (an organisation admin → 403 users_delete_requires_platform_admin). Every live user is deleted exactly like a single-user delete — sessions and API keys end, push-notification registrations are removed, the address is free for a new invite at once (for a self-serve tenant the one-free-trial lock is released too, as for a platform-admin delete). Restoring the tenant later does not restore these users. Refused with409, nothing deleted, when the tenant holds an account a single delete would not remove in bulk: a protected account (protected_user_in_tenant), a platform-role account (platform_user_in_tenant— move or delete it individually), or the caller's own account (actor_in_tenant).anything else ( null,"","DELETE", a number, …)400 invalid_users_option— nothing is deleted (a malformed value never falls back to "keep").The tenant, the users and an audit row
tenant.deletedwith{"users": "delete" | "keep", "users_deleted": <n>}are written in one transaction. The response is200 { "ok": true, "users": "delete" | "keep", "users_deleted": <n> }. Deleting a tenant that is already deleted (for example a concurrent second request) →404.Portal-managed organisations. An organisation administrator who deletes a tenant that the partner portal manages gets
409 { "error": "…", "code": "portal_managed" }and nothing changes — the tenant, its users and the audit log are untouched; the organisation is deleted in the partner portal. The refusal comes after the access and request checks (401,404,403,400) and before the gateway list and the Salesforce registrant read, so a refused delete does not raise the registrant-read alert or answer the503that read can cause. A fault in this check is503(retry), nothing deleted; a tenant deleted meanwhile is404here. The check runs again inside the delete transaction under a row lock, so a concurrent change cannot slip past it: an organisation that becomes portal-managed between the two checks is still refused (409), and only in that narrow race the registrant read has already run. A platform administrator keeps the delete, and a native tenant is deleted as before.
Lifecycle: decommission → disabled → (restore | purge). Soft-delete is reversible at the product level — a platform admin can restore it — or terminal via the purge below. Because a decommissioned tenant can no longer authenticate, it generates no new PII / request-log rows, which is what makes the purge's erasure guarantee (below) complete.
Scheduled and inbound-webhook agent runs stop too. The scheduler's due-work queries exclude soft-deleted tenants (
tenant.deleted_at IS NULL), so a decommissioned tenant's scheduled runs and pending inbound-webhook runs no longer fire.Cache caveat (bounded). The soft-delete now immediately flushes the per-worker gateway-config cache for every gateway of the tenant, cross-worker — so the next request re-reads storage, sees
deleted_at, and refuses; the previous ≤60 s window is closed. Routing therefore stops at once, which also closes the only path the ≤300 s auth-token cache could have used (a rare service token still needs the gateway config to resolve, and that now fails immediately). This tightening matters because it prevents a late in-flight inference from writing newrequest_log/request_log_legsrows after decommission that a subsequent purge could miss.
Restoring a soft-deleted tenant
Clears deleted_at — the product-level undo of the soft delete, so the
decommission step is genuinely reversible. The tenant becomes reachable again on every
authentication and routing path, and the per-worker gateway-config cache is flushed
cross-worker so inference routing resumes immediately (admin sign-in and admin routes
resume the moment deleted_at is cleared — they read the tenant per request, uncached).
Guarded fail-closed:
- Platform administrators only (role
admin;require_platform_admin). An organisation administrator, or any holder of a delegatedTENANT_SETTINGS_MANAGE, → 403; unauthenticated → 401. Restore is a Myra-operations recovery lever (strictly higher than the soft delete's owntenant_adminarm) — in particular it is how atenant_adminwho deleted their own organisation is brought back. A portal-managed tenant is never deleted by an organisation administrator (409 portal_managed), so an organisation administrator can only end up needing this recovery for a native tenant; a platform administrator may restore any soft-deleted tenant. - Already live (not soft-deleted) → 200
{ "ok": true, "already_active": true }(idempotent no-op — re-running restore converges). - Atomic with its audit entry. The restore and its audit entry commit together. If the audit entry cannot be written, the change is rolled back and the answer is
503(nothing stored, retry the request) or500(not retryable: nothing is stored, except when the commit itself failed, then the change may or may not be stored: reload before retrying). - Purged or non-existent → 409
{ "error": "cannot restore a purged or nonexistent tenant" }. A purged tenant has been hard-deleted, so it is indistinguishable from one that never existed; either way there is nothing to restore. This also closes the restore-vs-purge race: if a purge commits between the lookup and the write, the update affects zero rows and the call returns 409, never a false success. - A transient database fault during the lookup → 503 (retryable); a failure of the
clear-
deleted_atwrite itself →500 { "error": "internal error", "request_id": "…" }.
On success (200) the response body is { "ok": true }. Restore is audited
(tenant.restored). Note this makes the soft delete
reversible; the purge below is not.
Purging a tenant (irreversible hard delete)
Purge stays platform administrators only: an organisation administrator gets
403for any tenant, managed or native, before the tenant is looked up.Users and their addresses. A purge hard-deletes every user of the tenant, so their email addresses become free too — but irreversibly, together with all of the tenant's data. To free the addresses while keeping the tenant restorable, delete the tenant with
"users": "delete"instead, or move / delete the stranded users individually.
At contract end, DELETE /tenants/{id}/purge permanently and irreversibly erases
all of a tenant's data across every tenant-scoped table — users, conversations,
messages and attachments, projects and knowledge (documents, segments, vector
embeddings), agents and workflows, MCP connectors, gateways, provider keys,
SSO/SAML/SCIM configuration, and the tenant record itself. It writes a
Löschprotokoll (deletion-protocol) audit entry recording the per-category counts.
Billing evidence is kept for 730 days. The rows an auditor needs to see that the service was rendered and paid for are not erased with the tenant; they are kept, keyed by the old tenant id, until they are 730 days old (Art. 17(3)(b) DSGVO):
| Kept | Form |
|---|---|
| Request log | Rows younger than 730 days stay with the personal data reset (user, token label, client IP, user agent, prompt and response, detectors and metadata); provider, model, tokens, cost, status and timing are kept |
Cost legs (request_log_legs) |
Rows younger than 730 days stay, the user reference removed |
| Daily usage | Per-user rows are folded into one anonymous row per day; the sums are kept |
| Spend ledger | The organisation-level rows younger than 730 days |
| Wallet transactions and wallet ledger | Rows younger than 730 days, unchanged |
Tool-access decisions (access_decision) |
Rows younger than 730 days stay with the masked tool arguments (args_masked) erased; the argument hash (args_sha256, which the sealed audit mirror binds), who (owner and acting user, kept as pseudonymous ids), what, when and the decision are kept |
Voucher redemptions (voucher_redemption) |
Rows younger than 730 days stay with the account e-mail address replaced by a non-reversible placeholder; voucher, credit amount, destination and time are kept |
Voucher claims (voucher_claim) |
Rows younger than 730 days stay with the owner reference removed; code, campaign, source and time are kept |
Checkout sessions (checkout_session) |
The tenant's own checkout records younger than 730 days stay unchanged. Sign-up checkouts: completed or duplicate records younger than 730 days are kept, and their scope (derived from the sign-up e-mail address) is replaced by a non-reversible placeholder; open or expired sign-up checkouts are deleted |
Anthropic usage snapshots (anthropic_usage_snapshot) |
Rows younger than 730 days, unchanged |
The request-log row above is the MySQL one. Where the optional ClickHouse analytics copy is enabled, the purge does not reach it (nothing in it is deleted or anonymised): its text expires after 14 days and its other personal fields after 730 days — see ClickHouse analytics sink.
Audit evidence is kept for 730 days as well. These records are not billing evidence; they show who had access to what, and are deleted by the retention sweep at 730 days:
| Kept | Form |
|---|---|
Impersonation sessions (impersonation_session) |
Rows younger than 730 days, unchanged (who impersonated whom, when, and until when). Records of another tenant, or of the platform, that name a purged user stay as that tenant's / the platform's record and are not counted in this purge |
Support access grants (support_access_grant) |
Rows younger than 730 days stay with the free-text reason erased; requester, approver, state and times are kept. Such a grant no longer counts as active access |
Agent review history (agent_review_event) |
Rows younger than 730 days stay with the free-text note and reason erased; the decision, actor, agent id and time are kept. Rows already older than 730 days are deleted by the purge. Deleting a single agent or gateway does not remove its review history either; the hourly sweep deletes such rows at 730 days and writes counts-only Löschprotokoll audit rows tenant.review_history_deleted (one per committed batch) |
Agent delivery approvals (agent_approval) |
Rows younger than 730 days stay unchanged, with their status (pending and approved rows included: nothing is delivered for a purged organisation). Rows already older than 730 days are deleted by the purge. Deleting a single schedule, run, gateway or agent does not remove its approvals either; the hourly sweep deletes such rows at 730 days and writes counts-only Löschprotokoll audit rows tenant.approval_history_deleted (one per committed batch) |
Human reviews (review_item) |
Rows requested less than 730 days ago stay as the review record: kind, status, who requested and decided, and the times. The reviewers' free-text decision notes, the guardrail summary and the held tool call (its exact arguments) are erased; the user ids stay as pseudonymous pointers (who requested, decided, or was the subject), and a user id is cleared only when that user is erased individually; a row that carried nothing to erase stays untouched. Rows already older than 730 days are deleted by the purge. Deleting a single gateway or agent does not remove its reviews either: they are no longer listed and can no longer be decided, the held tool call is erased at once, and the hourly sweep deletes the rows at 730 days and writes a counts-only Löschprotokoll audit row tenant.review_item_history_deleted (one row per committed batch, with batch/truncated). In the deletion protocol, kept rows whose notes, summary or held call were erased count as review_item_anonymized; kept rows that needed no erasure count as review_item_retained (a row is counted once). Until this rule, decided reviews were removed after 90 days and a gateway deletion removed its reviews at once; both no longer apply |
Compliance reports (compliance_report) |
The frozen snapshots younger than 730 days, unchanged |
Sub-processor objections (tenant_subprocessor_objection) |
Rows younger than 730 days, unchanged (which sub-processor the organisation objected to, when, and who recorded it). They contain no personal data of the organisation's users |
Sub-processor notices (subprocessor_notification) |
Rows younger than 730 days, unchanged (when a change was announced, delivered and closed). They contain no e-mail addresses, only a recipient count |
Config approvals (config_approval) |
Rows requested less than 730 days ago stay as the governance record (who requested, approved or denied which change, when, and the outcome). The held change itself (the proposed payload and summary) is erased, and the free-text part of a failure reason is replaced by erased (a fixed reason code stays). A request still pending or applying at the purge is kept too, and its status stays as it was (pending stays pending, applying stays applying). Such a row can never be approved: the organisation is gone, so approve, deny and claim answer 404, and the request is no longer listed or exported; the retention sweep deletes it at 730 days. An approval that is being applied at the moment the purge runs (approved, but its change not yet recorded as applied) stays applying: it is neither completed nor failed, and nothing can finish it afterwards. In the deletion protocol, kept rows that needed no erasure count as config_approval_retained; kept rows whose payload, summary or free-text reason was erased count as config_approval_anonymized (a row is counted once) |
Portal context sessions (context_session) |
Rows opened less than 730 days ago, unchanged (portal actor, identity-session and delegation ids, and times). They are no longer readable through the API |
Everything older than 730 days is deleted by the purge itself. The kept rows are not shown in any platform-wide
list or report (request log, cost per model and per organisation, usage statistics, the redemptions of a voucher); they are not reachable through
the purged organisation, which no longer exists, and a new organisation that reuses the old slug gets a new id and
sees none of them. The hourly retention sweep deletes the rest once each row passes 730 days and writes counts-only
tenant.billing_evidence_deleted audit rows for each purged organisation. Each such row is written in the same transaction as the deletion it records (one row per committed batch, with a 1-based batch and truncated set only on the last batch; a row that cannot be written rolls the batch back and the next hourly sweep retries). Once everything is deleted, removing the organisation from the purge registry writes its own row (registry_cleared: true); the registry entry is kept while a sweep faulted.
curl -X DELETE https://<your-gateway-host>/admin/v1/tenants/{id}/purge \
-H 'Content-Type: application/json' \
-d '{"confirm": "<tenant-slug>"}'
This is a destructive-action endpoint, guarded fail-closed:
- Platform administrators only (permission
TENANT_PURGE, a platform-class permission that only the platformadminrole holds). Atenant_admin,ki_manager, or member → 403; unauthenticated → 401. (Strictly higher than the soft delete, which atenant_adminmay perform.) - The acting administrator must not be a member of the target tenant (external actor). Purging a tenant you belong to → 409. This guarantees an administrator can never lock themselves — or the platform — out.
- The tenant must already be soft-deleted (
deleted_atset). A live tenant → 409 "tenant must be soft-deleted before it can be purged". Purge operates on a decommissioned tenant, and because soft-delete disables all authentication/routing for that tenant (see above), no in-flight traffic can write new rows mid-purge — the premise the purge relies on is now enforced, not merely assumed. - Confirmation token. The request body must contain
{"confirm": "<tenant slug>"}matching the tenant's own slug exactly (a "type the name to confirm" guard). A missing / non-string / empty / whitespace-only / mismatched value → 400, and nothing is deleted. (The id is already in the URL, so the id is not accepted as confirmation.) - An unknown or already-purged tenant → 404.
- The purge acts on the organization's stored id, whatever letter case the URL uses. If the stored organization record carries no usable id, it answers a 500 server error (not retryable: the record must be repaired) and nothing is deleted.
- The tenant's users authored knowledge documents inside projects or conversations of other
tenants: the purge deletes those documents (the same rule as erasing a single user), so nothing is
handed to the acting administrator. Organisation-library documents are kept with the author cleared.
The deletion record counts them as
foreign_knowledge_deletedandforeign_knowledge_anonymized. The automatic retention purge completes such purges without an operator. Deletion protocols written before this behaviour may still listforeign_rows_reassigned(documents that were handed to the purging administrator); new purges no longer report it. - The tenant's users created schedules on other tenants' workflows or agents. The purge keeps a
workflow schedule (its enabled setting is unchanged; it keeps firing as the workflow's owner) and clears the
creator reference. It deletes the agent and prompt-task schedules (every schedule without a workflow) that a purged user created in another tenant.
A purged user's id as the hand-over origin on another tenant's schedule is set to NULL. The deletion record counts
these as
foreign_schedule_creator_cleared,foreign_schedule_handover_clearedandforeign_agent_schedule_deleted. - A purged user's id recorded as the author or last editor on platform-wide records is set to NULL, as a single-user
erasure does: vouchers and voucher series (creator), managed-model grants, gateway-local model blocks, sub-processor
events, providers and objections (creator), plan configuration, settings and the product catalog (last editor) and
tenant entitlements (granter). The records themselves stay. The deletion record counts these as
platform_ref_voucher_cleared,platform_ref_voucher_series_cleared,platform_ref_managed_model_grant_cleared,platform_ref_local_model_block_cleared,platform_ref_subprocessor_event_cleared,platform_ref_subprocessor_provider_cleared,platform_ref_subprocessor_objection_cleared,platform_ref_plan_config_cleared,platform_ref_settings_cleared,platform_ref_product_catalog_clearedandplatform_ref_tenant_entitlement_cleared. - A purged user's id on the surviving tenants' rows is removed as well: the content-report triager is set to NULL,
a live chat session the user started is deleted, and the live-session driver, the "deleted by" reference and the
manager reference on other users are set to NULL (the rows themselves stay). The project-member "invited by"
reference is cleared by the database when the user row goes. The deletion record counts these as
survivor_ref_content_report_triager_cleared,survivor_ref_live_session_started_deleted,survivor_ref_live_session_driver_cleared,survivor_ref_user_deleted_by_clearedandsurvivor_ref_user_manager_cleared. - A purged user's authorship on other tenants' agents gets the same treatment as a single-user erasure: the creator and saver of an agent version, the agent and webhook-trigger hand-over reference and the agent reviewer are set to NULL (rows stay); on an agent review decision the actor is set to NULL and the note and reason are erased; a webhook trigger the user created is deleted, with its pending agent and workflow runs cancelled and their payload cleared. Review decisions of the purged tenant itself are not touched here (they keep a pseudonymous actor for 730 days, see above). The deletion record counts these as
survivor_ref_agent_version_creator_cleared,survivor_ref_agent_version_saver_cleared,survivor_ref_agent_handover_cleared,survivor_ref_agent_reviewer_cleared,survivor_ref_webhook_trigger_handover_cleared,survivor_ref_agent_review_event_text_erased,survivor_ref_agent_review_event_actor_cleared,survivor_ref_agent_run_trigger_cancelled,survivor_ref_workflow_run_trigger_cancelledandsurvivor_ref_webhook_trigger_deleted. - A purged user's authorship on other tenants' workflows gets the same treatment: the workflow owner, the publisher of a workflow version, the creator of a workflow form, an email trigger and a governance template, the creator, decider (with the approver's display name) and user approver of a workflow run are set to NULL (rows stay, the run's trigger payload is cleared); the user's pending runs are cancelled with
owner_unavailableand the artifacts of the user's runs are deleted. A workflow left without an owner does not run automatically. The deletion record counts these assurvivor_ref_workflow_owner_cleared,survivor_ref_workflow_artifact_deleted,survivor_ref_workflow_run_creator_cancelled,survivor_ref_workflow_run_creator_cleared,survivor_ref_workflow_version_publisher_cleared,survivor_ref_workflow_form_creator_cleared,survivor_ref_workflow_email_trigger_creator_cleared,survivor_ref_governance_template_creator_cleared,survivor_ref_workflow_run_decider_clearedandsurvivor_ref_workflow_run_approver_cleared. Because the user's pending runs on a workflow the user owns are cancelled first,survivor_ref_workflow_run_trigger_cancelledthen counts only the remaining pending webhook runs of workflows whose webhook trigger the user created. - The acting administrator's own account no longer exists → 409.
The checks run in this order: tenant exists, tenant is soft-deleted, actor is not a member, confirmation token.
On success (200) the response body is { "ok": true, "purged": { <table>: <count>, … } }.
The chat_project_knowledge count (and its chat_project_knowledge_blob / knowledge_ingest_event counts)
covers project, conversation and organisation-library documents; library documents are deleted as the
tenant's own data, never reassigned to the purging admin, so an unattended retention purge of a tenant with an
organisation library completes.
Projects of other organisations. A user of the purged tenant may have created a project that belongs to
another organisation. The purge never hands such a project to an administrator from outside that
organisation. A project that another member of its own organisation still shares (directly, or through
a group, department or organisation share) is kept and passes to a new owner taken from that organisation
only, in this order: the purging administrator, if they are a live user of that organisation; otherwise its
oldest live tenant administrator, otherwise its oldest live administrator; otherwise a live and then a disabled member of the project; otherwise a live and
then a disabled person who can already use it through a group, department or organisation share. The new
owner becomes the project's creator and gets an owner membership. A direct member or owner who is
himself a user of the purged tenant does not make a project "shared"; a grant to a group or department of the
project's organisation, or the organisation-wide grant, does keep it, even when that group has no remaining member
(the same rule as for the erasure of a single user). A project nobody else uses, or whose
organisation has nobody left who could take it, is erased together with its members, grants, knowledge
documents and project memories. Conversations
that other people held in an erased project survive, detached from the project. A project of another
organisation that a user of the purged tenant only co-owned (someone else created it) keeps its creator; when no
other effective owner of the project remains, an owner membership goes to the purging administrator if they are a
live user of that organisation, otherwise to its oldest live tenant administrator, otherwise to its oldest live
administrator. If nobody qualifies, the project is kept without an owner membership. This applies only when the creator is not a
user of the purged tenant: a project whose creator and co-owner are both users of the purged tenant is decided by the
creator's rule above (kept with a new owner only if someone of its own organisation still has access, otherwise erased), and
no owner membership is granted for it, whatever the order the users are processed in. The counts
foreign_project_reassigned, foreign_project_owner_granted, foreign_project_deleted and
foreign_project_memory in the deletion protocol report what happened.
Spend-ledger rows and budget holds are erased by the tenant's own ids only, so this step never waits on another tenant's in-flight writes.
The purge runs as one transaction. If it hits a transient database serialization
conflict (a concurrent write racing the purge), the conflicting statement is first
re-read and re-applied in place (bounded, inside the same transaction), and if the
conflict still persists the whole transaction is automatically rolled back and
retried with a short bounded backoff (up to three additional attempts); the caller
sees the eventual success. If the conflict persists across every attempt, the purge
returns 503 { "error": "temporarily unavailable; retry later" } — the same answer when no database connection could be obtained (the purge never started)
(the one admin retry body — the conflicting step is logged, never returned):
the transaction was fully rolled back — nothing was deleted, the tenant is still
soft-deleted, and re-issuing the same request is safe and idempotent (it converges once
the write contention subsides). A 500 { "error": "internal error", "request_id": "…" } indicates a non-transient failure, never a
transient race.
⚠️ This cannot be undone. Unlike the soft delete — which a platform admin can restore — the purge is irreversible: there is no restore for purged data. For a reversible removal, use the soft delete above. For a machine-readable copy of the data before erasure, take the exit data export first.
Audit retention. The tenant's audit-log rows are retained but IP-scrubbed (their
actor_ipis nulled) rather than deleted, preserving the Nachvollziehbarkeit (traceability) trail; the shared operationalmodel_errortriage queue rows are anonymized (tenant identifiers and diagnostic content nulled), not removed.
Application logo & favicon (app-chrome branding)
Upload the per-tenant image assets shown in the application chrome and login page in place of the platform-default marks. Three assets share one route shape, differing only by path suffix:
| Asset | Path suffix | Shown |
|---|---|---|
| Dark-theme logo | /logo |
artwork for dark surfaces: app chrome in the dark UI theme, the login card's navy chip |
| Light-theme logo | /logo-light |
artwork for light surfaces: app chrome in the light UI theme, PDF/Word/PowerPoint exports, public forms |
| Favicon | /favicon |
the browser tab icon |
Each upload is untrusted input, validated at the trust boundary; when an asset is unset
the surface falls back to the platform default. The logo pair mirrors the platform's own
/logo.svg (dark) and /logo-light.svg (light) marks. A surface shows the logo made for
its background; when only the other one exists, that one is shown on a plaque of its
own background colour — the dark-theme logo on a dark-blue plaque on a light surface, the
light-theme logo on a light plaque on a dark surface — so a tenant that sets only one logo
is still branded (and legible) everywhere. With a logo, the collapsed sidebar and the chat
start screen show the tenant's logo instead of the platform mark. An asset that fails to
load or decode counts as unset (the other logo, else the platform default, stands in). The
full matrix is in Tenants → Fallback and plaque.
# Upload / replace (base64-encoded PNG or JPEG in a JSON body). Same shape for
# /logo, /logo-light, and /favicon.
curl -X POST https://<your-gateway-host>/admin/v1/tenants/{id}/logo \
-H "Content-Type: application/json" \
-d '{"data": "<base64 image bytes>"}'
# → { "ok": true, "mime": "image/png", "version": "<content-hash>" }
# Fetch (returns the bytes base64-encoded, for rendering as a data: URL)
curl https://<your-gateway-host>/admin/v1/tenants/{id}/logo-light
# → { "mime": "image/png", "version": "<content-hash>", "data": "<base64>" }
# → { "mime": null, "version": null, "data": null } when the slot is unset
# Remove (the surface reverts to its fallback / the platform default)
curl -X DELETE https://<your-gateway-host>/admin/v1/tenants/{id}/favicon
Accepted input (validated by magic bytes — never the client-declared type — with everything else rejected, fail-closed; nothing is stored on any rejection). All three assets use the same validator, so a favicon is a PNG or JPEG (not .ico; SVG is rejected as script-capable), and the size/dimension caps are a deliberately generous upper bound rather than favicon-tuned:
| Rule | Accepted | Rejected → status |
|---|---|---|
| Format | PNG or JPEG only, identified by leading magic bytes | SVG (script-capable), GIF, BMP, WEBP, TIFF, PDF, .ico, or any other/spoofed type → 415 |
| Size | ≤ 512 KB decoded | larger → 413. A Content-Length-bearing upload is rejected at the boundary before the body is read, so it always returns a clean 413 Payload Too Large rather than a server error, regardless of buffering; a chunked upload (no Content-Length) falls back to the same 413 after decode. |
| Decodability | header parses to real pixel dimensions | truncated file, or magic bytes glued onto non-image data → 400 |
| Dimensions | each side 1–4000 px and ≤ 4,000,000 px total | a "decompression bomb" (a tiny file declaring a huge canvas) or an over-4000 px side → 400 |
| Encoding | valid base64 (an optional data:<mime>;base64, prefix is tolerated) |
non-base64 or empty → 400 |
Authorization (fail-closed). POST / DELETE require the TENANT_SETTINGS_MANAGE permission (held by admin and tenant_admin, and grantable through a custom role), and the caller must own the tenant (a tenant_admin of another tenant → 404, like an unknown tenant; a plain member 403; unauthenticated → 401). GET requires only tenant membership (any member may render their own tenant's asset; a member of another tenant → 404, like an unknown tenant), so the chrome can display it for every user. GET on a tenant with no such asset (the slot is unset) returns 200 with all three fields null — { "mime": null, "version": null, "data": null } — because "no logo" is a normal state, not an error; an unknown tenant is still 404 (checked before the asset is read). A stored image whose type is not PNG/JPEG (a corrupt row) returns 404 rather than being served. A transient database error returns 503 (retryable) so the chrome degrades to the default rather than caching a miss. A stored asset is served with Cache-Control: private, no-cache and an ETag equal to its version; a GET with a matching If-None-Match returns 304 without a body.
The three assets are stored on the one tenant branding row (storage.get_tenant_asset); the logo pair is additionally reused by document-export branding — one upload, not a second store. In a PDF, Word or PowerPoint export the logo is re-encoded to PNG (a JPEG upload included) and embedded as a regular image/png image part (in Word: word/media/<name>.png, declared image/png in [Content_Types].xml).
Exit data export (JSON + CSV)
Produce a complete, machine-readable handover of a tenant's data at contract end — configurations (agents, workflows/agent schedules, policies, MCP connectors, interfaces, roles), conversations, statistics, and logs — in both JSON and CSV, delivered as one ZIP package.
The export acts on the organization's stored id, whatever letter case the URL uses. If the stored organization record carries no usable id, the export answers a 500 server error (not retryable: the record must be repaired) and nothing is exported.
# Default: a ZIP containing manifest.json + one .csv per table
curl -OJ https://<your-gateway-host>/admin/v1/tenants/{id}/export
# → tenant-<slug>-export.zip
# Just the JSON manifest (programmatic use)
curl 'https://<your-gateway-host>/admin/v1/tenants/{id}/export?format=json'
Authorization (fail-closed). Requires the TENANT_SETTINGS_MANAGE permission (held by admin and tenant_admin, and grantable through a custom role), and the caller must own the requested tenant: a platform admin may export any tenant, everyone else only their own. A plain member / ki_manager without that permission receives 403; a tenant_admin requesting a different tenant, or an unknown tenant, receives 404; an unauthenticated caller 401. A read failure on any primary section (interfaces, agents, agent schedules, MCP connectors, workflows, workflow versions, workflow runs, workflow step runs, users, conversations, messages, memories, knowledge files, tenant prompts, tenant prompt versions, config approvals, request logs, audit logs) fails the whole export with 503 { "error": "temporarily unavailable; retry later" } (retry) — those sections are never a silently-incomplete "complete copy". The groups and projects sections are best-effort and bracketed by a database-liveness check. The statistics section's usage totals and activity counters fail the export with the same 503 on a database fault rather than shipping zeros presented as complete.
Package contents. manifest.json carries the full nested export; each *.csv is a flat table of the same data (spreadsheet-openable, with CSV formula-injection neutralized per CWE-1236):
| File | Contents |
|---|---|
manifest.json |
Everything below, nested, plus caps/truncated/omitted metadata |
tenant.csv |
Tenant config & policy — every stored tenant configuration column: plan, budget & period, org system instruction, all feature switches (agents/workflows/scheduled-tasks/playground/request-logging/…), retention days, trial end, code-interpreter limit, cloud regions (Bedrock/Vertex), web-search provider, TTS engine/voice, white-label branding (product name, home greeting, chat disclaimer, colour, font), and finance settings. Structured values (slash commands, prompt examples, sidebar links) are in the JSON manifest's tenant object |
interfaces.csv |
Gateways (interfaces); routing/guardrail config is in the JSON manifest |
agents.csv |
Saved agents (name, model, provider, instructions, purpose and purpose_status — confirmed or unconfirmed; an agent with no purpose recorded exports unconfirmed with an empty purpose, and a stored value outside that set reads unreadable) |
agent_schedules.csv |
Agent-level schedules (name, cadence, prompt) — the output_action target is JSON-only, reduced to its kind. created_by is the creator's id while that account exists and erased once it has been erased |
mcp_connectors.csv |
MCP tool-server registrations (name, server URL, auth type, scope) |
workflows.csv |
Visual Workflow Baukasten definitions (name, status, published version, budget) — the graph is JSON-only |
workflow_versions.csv |
Published immutable workflow versions (semver, publisher) — the graph snapshot is JSON-only |
workflow_runs.csv |
Workflow run history (status, cost per run, named approver „freigegeben von …") — the restored run state is JSON-only |
workflow_step_runs.csv |
Per-step execution records (step, node type, status, cost, duration) |
workflow_artifacts.csv |
Workflow run artifacts — metadata only (filename, MIME type, size); the bytes are excluded |
departments.csv |
Departments (name, description, default gateway); allowed gateways and members are JSON-only |
reactivation_events.csv, least_privilege_digests.csv |
Lifecycle-mail send log and weekly least-privilege digest sent-markers (scalar columns) |
webhook_triggers.csv, workflow_email_triggers.csv |
Inbound trigger bindings: which agent/workflow an inbound webhook or email fires, plus the enable toggle. The webhook token is the URL path (no secret); the email binding carries no mailbox/IMAP routing (that is Myra-mail-infrastructure-internal) |
groups.csv, group_members.csv |
User groups and membership (role assignments) |
roles.csv, role_permissions.csv, role_assignments.csv |
Tenant custom RBAC roles (admin-authored, origin='user'): each role's name/description, its permission grants (perm_key), and which users hold it. Platform-defined system roles are excluded (not tenant data) |
projects.csv |
Projects and their instructions |
users.csv |
Users and their roles (+ per-user retention Löschfrist) |
conversations.csv, messages.csv |
Conversation history (all tenant users) |
memories.csv |
User memories (content, type, source, owner) |
knowledge_files.csv |
Knowledge / context layer: parsed document text (extracted_text), per file |
tenant_prompts.csv, tenant_prompt_versions.csv |
The tenant prompt library ("tenant-specific model adaptations") + its version history |
config_approvals.csv |
Four-eyes config-approval history: who requested / approved / denied which config change, when, and its status (the proposed payload is JSON-only, in manifest.config_approvals[].payload). Requester, impersonator and decider are rendered by the actor rendering table |
agent_consent_snapshots.csv |
The grandfather snapshot of each agent that existed when per-tool approval was introduced: agent_id, the frozen tool_config text exactly as it was stored (tool_config), and snapshot_at. It is distinct from the live agents[].tool_config and never changes after it was taken. Each agents[] object also carries starters, the decoded list of conversation starters (an array, [] when none; JSON manifest only, not in agents.csv). Capped like the agents section, with a truncated flag |
statistics.csv, top_models.csv |
Usage aggregates. statistics.csv lists one metric,value row per figure: totals.<window>_<metric> for the today, yesterday and last_7d windows (last_7d = the rolling 7 × 24 hours before the export; for example totals.last_7d_requests, totals.today_cost_usd) and activity.<counter> for the activity counters. |
request_logs.csv |
Request metadata (no message bodies, no end-user IPs), including the caller's own correlation id (client_request_id) |
audit_logs.csv |
Control-plane audit trail (an SSO row carries the IdP entityID / issuer in idp_entity_id; the tenant is in entity_id). Actors are rendered by the actor rendering table, including the actor_id of an erased account and the withheld IP of an erased impersonator. Tool-access decision seal-mirror rows (entity_type = 'access_decision') are excluded; see Tool-access decisions and erasure |
Exit-handover data domains. The exit handover explicitly carries, in open formats, the tenant's memories (memories), the knowledge / context layer as parsed document text (knowledge_files[].extracted_text — project, conversation and organisation-library documents, exactly the set a purge erases), and the tenant-specific model adaptations — the admin-curated tenant prompt library and its version history (tenant_prompts, tenant_prompt_versions, live prompts only; soft-deleted prompts are excluded, like soft-deleted conversations). The per-tenant/user/project retention Löschfrist config is included on the tenant/users/projects objects. The four-eyes config-approval history (config_approvals) carries every requested/approved/denied config change with its status, approver, and the proposed payload (all statuses). Staff and erased ids inside payload, summary and apply_error are rewritten as described under actor rendering. Secret-named keys in the payload are scrubbed, and a payload past an internal per-export byte budget is dropped per row — flagged payload_omitted and counted in config_approval_payload_omitted_count. The inbound trigger bindings are carried as siblings: webhook_triggers (which agent/workflow an inbound webhook fires, with the URL token — no secret) and workflow_email_triggers (which workflow an inbound email fires, plus the enable toggle). The email binding is the pure workflow-to-email link only: it exports no mailbox host, IMAP user, or password — that routing lives with the mail-ingest infrastructure (Myra-internal), not the tenant's portable config, so nothing infrastructure-internal leaves in the handover. The grandfather snapshots (agent_consent_snapshots) carry, per agent, the tool_config text frozen when per-tool approval was introduced (see Grandfathered consent), capped with caps.agent_consent_snapshots and flagged by truncated.agent_consent_snapshots. manifest.schema_version is 4 (3 added the config-approval history; 2 carried the LB 2.8 sections without it). Actors in audit_logs and config_approvals are rendered by the actor rendering table, the same as in the tenant audit log. In audit_logs each row carries actor_kind (user, system or staff); a staff row has actor_label (Myra staff) and a staff_id of the form stf_<16 hex> (omitted, an empty CSV cell, when no pseudonym key is available or the impersonation context cannot be read) and omits actor_id, actor_ip and actor_type. On any other row actor_ip is the stored value: an address, or the literal invalid when the forwarded address was not IP-shaped; it is omitted (an empty CSV cell) when none is stored and on a row whose impersonator was erased. Historical rows are exported as stored, except that an actor id of an erased account reads erased.
Excluded (by design). Vector/embedding indexes (derived, rebuildable) and the original binary knowledge files (a separate blob store — the parsed extracted_text is included), encrypted provider API keys (including any embedded in gateway/interface config), MCP connector credentials (OAuth access/refresh tokens and bearer secrets — a separate store), SIEM credentials, request/response message bodies and end-user IP addresses in request logs, audit before/after diffs, and per-gateway managed-model enablement grants (Myra-pool routing intent, no key material). An agent schedule's output_action is reduced to its kind (its webhook URL / channel target is credential-equivalent and withheld), and an MCP server_url has any embedded basic-auth userinfo stripped. Workflow run resume tokens (single-use approval tokens) and any secret column are never selected. Request logs, audit logs, agent schedules, MCP connectors, workflows, workflow runs, projects, memories, knowledge files and tenant prompts are capped, and agents are limited to 500 per interface (see the manifest's caps and truncated fields); truncated: true for a section means it hit its cap. Knowledge extracted_text (which can be very large) is additionally bounded by a cumulative byte budget (caps.knowledge_text_budget_bytes): once exhausted, further knowledge rows are emitted metadata-only with extracted_text_omitted: true, and the count of such skipped rows is reported in knowledge_text_omitted_count (conservative — it may include rows that were genuinely empty, and never under-counts a real omission) — a signal distinct from a whole-row cap. Conversations and messages are complete (not capped). excluded from the tenant section specifically: the SIEM ingest credential (siem_config, secret), the internal optimistic-concurrency token (row_version), the logo cache-bust flag (brand_logo_version — the logo image is out of the data-export's scope), the deferred-voucher fields (pending_voucher_code and the frozen signup address pending_voucher_email, an internal anti-abuse dedup key rather than tenant configuration — the voucher bonus itself re-homed into the prepaid wallet, which is not exported, and the former bonus_credit_usd/bonus_credit_expires_at columns were dropped in the wallet money-model rework), and the platform-admin-set funding ceiling (platform_cap_usd, a Myra governance value rather than the tenant's own portable configuration). Every other tenant column is exported; a drift guard (test_tenant_export_completeness) fails the build if a new tenant column is added without an explicit export-or-exclude decision.
Policies & roles. These are already in the package: the tenant's org policy / system instruction is in tenant.csv, and slash commands and prompt examples are in the tenant object of the JSON manifest (structured values are JSON-only, not in the CSV); project role assignments are in groups.csv + group_members.csv (group grants) and per-user platform roles in users.csv. The tenant's custom RBAC roles (admin-authored, origin='user') are exported in their own roles domain — each role with its permission grants and the users it is assigned to (roles.csv / role_permissions.csv / role_assignments.csv). The 7 platform-defined system roles are not tenant data and are excluded (the export getter fences origin='user').
Delivery (bounded memory). The ZIP download adapts to tenant size so a very large tenant cannot exhaust worker memory or hit a proxy timeout. A small tenant is assembled in memory and sent as a single ZIP (unchanged; any read fault is reported as a clean 503 { "error": "temporarily unavailable; retry later" } before a byte is sent). A large tenant — one whose message corpus exceeds an internal memory budget — is streamed: the conversation/message corpus is keyset-paginated and written incrementally into a data-descriptor ZIP, so peak memory stays bounded to roughly one page regardless of tenant size. The package is complete either way — the streamed path paginates, it never caps or drops the corpus (conversations and messages remain uncapped). Because a streamed response has already begun with 200 OK, a read fault that occurs mid-stream cannot be turned into an error status; instead the archive is deliberately left without a central directory, so unzip, Python zipfile, macOS Finder and Windows Explorer all reject it as corrupt rather than presenting a truncated download as a complete handover — re-run the export. The streamed and in-memory packages carry identical content. ?format=json always returns the full manifest assembled in memory (a single JSON body cannot be split like a ZIP); prefer the default ZIP download for a very large tenant. Like the in-memory build, the export is a point-in-time snapshot taken across many queries (not a single serialisable transaction), so a write that lands while the export is running may or may not be captured — exit exports are taken at contract end when the tenant is winding down. (The streamed archive is ZIP64-aware: a package that crosses the 4 GiB / 32-bit-offset ceiling automatically emits 64-bit offsets plus a ZIP64 end-of-central-directory, so a very large tenant export completes and still opens in unzip, Python zipfile, macOS Finder and Windows Explorer.)
Reactivation metrics
The counters behind the Member reactivation card on the tenant Analytics page
(Lifecycle e-mails).
Authorization: TENANT_SETTINGS_MANAGE (admin | tenant_admin) and access to the tenant —
the same gate as /tenants/{id}/analytics, because per-member states in a small tenant identify
people; a role without TENANT_SETTINGS_MANAGE (e.g. ki_manager) is 403.
Response. enabled_effective (0|1 — what the tri-state resolves to right now),
mails_sent_7d, mails_sent_30d, reactivated_7d (members who became active within 7 days of a
mail sent in the last 30 days), opt_outs_total, opt_outs_30d, and states —
{ never_activated, lapsed, dormant, active, excluded, total } counting the tenant's live members
by the same classification the sweep uses. states is computed live and cached for 5 minutes
per tenant; the other fields are always live. A database fault is 503 (never an all-zero body).
Deletion protocol (Löschprotokoll)
After a tenant has been purged, retrieve the machine-produced deletion protocol — an open, machine-readable JSON record of what was deleted and when. The tenant purge writes the counts as a tamper-evident tenant.purged audit entry that survives the tenant's deletion; this endpoint renders that entry as the deliverable the departing customer is owed (within four weeks of contract end).
Authorization (fail-closed). Platform admin only (401 unauthenticated, 403 otherwise). There is deliberately no tenant-ownership gate — the tenant no longer exists after a purge, and the tenant's own admins are gone, so an operator retrieves the protocol and hands it to the customer. Because the tenant's users are erased, this is not a self-service endpoint.
Ordering. Run the exit data export before the purge (data is unexportable after erasure); the deletion protocol is available after the purge.
Responses.
200— the deletion-protocol document (below).404— this tenant has not been purged (notenant.purgedrecord).503 { "error": "temporarily unavailable; retry later" }— the audit record could not be read (retry).500 { "error": "internal error", "request_id": "…" }— a corrupt audit payload: adeleted_countsthat is missing, empty, or not a table-name → count map, or any count that is not a non-negative whole number (fail-closed; nothing is guessed — a malformed count is never read as 0).
Document shape (counts only — no deleted content). The protocol reproduces per-table row counts and timestamps, never the deleted rows' content (re-persisting erased PII would defeat the very erasure it attests):
| Field | Meaning |
|---|---|
artifact_kind |
"tenant_deletion_protocol" |
tenant_id, purged_at |
The purged tenant and the erasure time (unix seconds) |
actor |
{ id, type } of the admin (or system reaper) who ran the purge |
reason |
e.g. contract_end_offboarding |
total_rows_deleted |
Sum of genuinely deleted rows only |
rows_scrubbed, rows_reassigned, rows_anonymized |
Rows that were retained and PII-cleared / re-owned (reported separately, never counted as deletions) |
rows_retained |
Rows kept whole for a statutory retention period — AVV consent evidence, and the organisation-level spend_ledger_retained, wallet_transaction_retained and wallet_ledger_retained billing rows. Retained, not deleted, and reported separately from the scrub/reassign/anonymize counts |
schema_version, generated_at |
The protocol schema version (1) and the generation time (unix seconds) |
table_coverage |
[{ table_name, count, op }] — op is delete / scrub / reassign / anonymize / stamp (stamp = retained whole, counted in rows_retained). The request log, cost legs and daily usage appear as request_log_anonymized, request_log_legs_anonymized and usage_daily_anonymized (anonymize: retained with the personal data reset, counted in rows_anonymized). Tool-access decisions appear as access_decision (delete: older than 730 days) and access_decision_anonymized (anonymize: decisions younger than 730 days kept with the arguments erased, counted in rows_anonymized) |
deleted_counts |
The raw per-table counts, verbatim |
note |
A fixed explanation of what the counts mean |
audit_evidence |
The tamper-evident audit-chain anchor: audit_log_id, audit_chain_enabled, sealed, seal_seq, chain_hash, prev_hash, plus an explanatory note. Verify the deletion's integrity against this anchor via the audit-chain verify surface. sealed: false means the record was not yet sealed by the asynchronous sealer, or the hash-chain is not enabled in this environment (audit_chain_enabled: false). audit_chain_enabled is null when the chain state could not be determined right now (the key could not be read) — treat that as unknown, never as "not enabled". |
billing_evidence |
{ retained_until, legal_basis, billing_evidence_days }: the billing evidence kept past the purge (see above), retained_until is the UTC date (YYYY-MM-DD) until which the evidence is kept, at most 730 days after the purge; legal_basis is Art. 17(3)(b) DSGVO |
retention_evidence |
(present for an unattended self-serve retention purge) non-PII proof the warning ladder preceded erasure |
OIDC SSO configuration
Configure a tenant's OpenID Connect provider so its users can sign in via SSO (see Admin API authentication → Single sign-on). Create, update, and delete require the SSO_MANAGE permission (held by the admin and tenant_admin roles only; it cannot be granted to a custom role); a read (GET) requires tenant access. A step-by-step provider walkthrough is in Administration → Security → Single sign-on.
curl -X PUT https://<your-gateway-host>/admin/v1/tenants/{id}/sso-config \
-H "Content-Type: application/json" \
-d '{
"issuer": "https://login.microsoftonline.com/<dir>/v2.0",
"client_id": "00000000-0000-0000-0000-000000000000",
"client_secret": "•••",
"subject_claim": "oid",
"allowed_email_domains": "corp.example, sub.corp.example",
"entra_tenant_id": "11111111-1111-1111-1111-111111111111",
"allow_guest_signin": false,
"enabled": true
}'
Accepted input (validated at the trust boundary; rejected with 400 otherwise):
| Field | Rule |
|---|---|
issuer |
Required. Must be an https:// URL and must resolve OIDC discovery. |
client_id |
Required, non-empty. |
client_secret |
Required on first config; on update, omit to keep the stored secret or send a new one to replace it. Required again whenever the issuer changes (see below). Must be a string (any other type is 400). Stored encrypted; never returned. |
subject_claim |
sub or oid only (a mutable claim like email is rejected — it would allow recycled-identifier takeover). Default sub when absent or null; an empty string or a non-string is 400. The oid lookup against the SCIM external_id runs only for a Microsoft Entra configuration (tenant-id set); there, an e-mail-matched account whose SCIM external_id is a different oid is refused (link_conflict). Switching subject_claim on a live configuration changes every user's subject: already-linked users are refused (link_conflict) unless (Entra mode) SCIM has filled external_id; an administrator unlinks each stale link (SSO links) so the next sign-in links the new subject. Outside Entra mode the first link resolves an account by the email claim only; preferred_username/upn are never used (the IdP user can edit them). |
scopes |
Optional string. Space-separated OAuth scope tokens (RFC 6749 §3.3) requested at the IdP; must contain openid. Whitespace is normalized to single spaces; the normalized value is at most 255 characters (the raw input at most 1024 bytes). Absent or null → default openid email profile. A non-string, an empty/blank value, a list without openid, or a token with illegal characters is 400. A stored value that does not meet this rule must be corrected via the API before the next save. |
allowed_email_domains |
Required, non-empty. Separated by comma, semicolon or newline (whitespace is not a separator); normalized to a lowercase, de-duplicated comma list. This is the allowed-domain list — the tenant's IdP may only sign in users at these domains. It is not ownership-verified (there is no DNS proof): the first organisation to configure an unused domain holds it. Each entry must be a plain hostname of letters, digits, hyphens and dots with at least two labels (labels 1-63 bytes, entry at most 253 bytes, no leading or trailing hyphen or dot, last label not all digits); at most 100 entries, at most 16384 bytes submitted and at most 8192 bytes once normalized (larger lists are rejected with the same 400 invalid_email_domain); a wildcard, port, @, space inside an entry, non-ASCII character or IP literal is rejected with 400 { "error": ..., "code": "invalid_email_domain", "field": "allowed_email_domains" }. A public e-mail provider (for example gmail.com; exact match, so mail.gmail.com is accepted) is rejected with 400 freemail_domain_not_allowed; an absent, null, non-string or blank value is 400 invalid_request. One domain, one organisation: a domain already allow-listed by an enabled OIDC or SAML configuration of another (non-deleted) organisation (a disabled configuration of another organisation does not block; only this organisation's own stored rows are grandfathered whether enabled or disabled) is rejected with 409 { "error": "allowed_email_domains already in use by another organisation", "code": "sso_domain_conflict" }; so is a newly added domain on which accounts outside this organisation exist (a live user of another organisation or without an organisation, or a paid sign-up in flight for less than 3 days; soft-deleted users do not count) — the response is byte-identical and never names the other organisation. A domain already stored in this organisation's OIDC or SAML configuration is never re-checked for accounts, so a re-save keeps working; a stored legacy value is not rewritten, but a re-save must pass the format rules. The same tenant may use one domain for both OIDC and SAML. A concurrent save by two organisations can still race (no database-level uniqueness). If a conflict check itself cannot run the save fails closed with 503. |
entra_tenant_id |
Optional. The customer's Microsoft Entra directory GUID (8-4-4-4-12 hex). When set, this enables Entra mode: an id_token whose tid claim does not match this directory is rejected at login (a token from a different Entra directory can't sign in even if iss/aud line up). Normalized to lowercase. Omit / null for generic OIDC / ADFS (backward-compatible). A malformed value is rejected (never silently dropped to non-Entra mode). |
allow_guest_signin |
Optional boolean or 0/1 (default false/0 — members-only). When false, an Entra B2B guest identity (a #EXT# marker in the upn/preferred_username claim) is rejected at login (403, audited). Set true to permit guests (still subject to the domain allowlist and link rules). Any other shape is rejected. |
idp_emails_trusted |
Optional boolean or 0/1 (default false/0). Enable only when the identity provider's users cannot change their own e-mail address. Off: the first link (and just-in-time creation) requires email_verified to be the JSON boolean true; an absent email_verified is refused. On: an absent email_verified is accepted too; an explicit false, or any non-boolean value, is still refused. It governs first link only, has no effect in Entra mode (always trusted) and does not apply to SAML. Any other shape is 400. Existing configurations default to off, so a tenant whose IdP omits email_verified (including tenants with just-in-time provisioning) cannot first-link or JIT-create until an administrator enables it. |
group_attribute / group_mapping |
Optional. The claim name and a JSON allow-list mapping its values to internal group ids — the same validator as for SAML. A value may also be a role target { "kind": "role", "id" } (details; changing one needs the tenant admin role). Absent → the stored mapping is left unchanged. |
required_authn_context |
Optional string (1-512 printable ASCII characters, no whitespace or <>&"'). Requires MFA through the IdP: the verified id_token must carry this value as its acr claim or as an entry of its amr array (exact, case-sensitive match). Otherwise the login is refused (403, audited as sso.mfa.login_denied) and the user lands on /login?error=sso_mfa_required. This governs sign-ins through this identity provider only; it does not apply to email one-time-code sign-in or to Entra access tokens used by the Microsoft 365 integration. The key is absent from GET when no requirement is set. Omitted or null on PUT means no requirement. A malformed value is rejected with 400 and nothing is saved. |
enabled |
Optional boolean or 0/1. Absent or null = default true; any other shape is 400. When false, SSO is off and the tenant is not discoverable by email domain. |
At login the identity is resolved from the token. In Entra mode (entra_tenant_id set) the claim precedence is email → preferred_username → upn (Entra frequently omits email). Otherwise only the email claim is used; when it is absent the sign-in is refused. A first link whose e-mail is not verified (see idp_emails_trusted) is refused with 403 and the login slug sso_email_unverified, before any account lookup; nothing is created or linked.
PUT is a full replacement: an omitted entra_tenant_id / allow_guest_signin / idp_emails_trusted resets to its default, so send the complete config. GET returns the config without the secret (a has_secret boolean instead) — including entra_tenant_id, allow_guest_signin and idp_emails_trusted so a client round-trips them. DELETE removes it. GET and DELETE on a tenant without an OIDC config → 404 { "error": "no SSO config for this tenant" }. An issuer whose OIDC discovery fails → 400 naming the discovery error.
Changing the issuer requires a new client_secret. A stored secret belongs to the identity provider it was issued by, so it is never carried over to a different one. A PUT whose issuer differs from the stored one and that carries no (or a null / empty) client_secret is refused with 400 { "error": "changing the issuer requires re-entering client_secret", "code": "client_secret_required_on_issuer_change" }. Nothing is stored and no OIDC discovery request is made. One trailing / is ignored when comparing (https://idp.example and https://idp.example/ are the same issuer); any other difference, including letter case, counts as a change. A client_secret that is not a string is still the 400 above. Changing only client_id or entra_tenant_id does not require a new secret, and a first-time configuration is unchanged (the secret is required anyway). Send the secret together with the new issuer in the same request.
required_authn_context follows the same full-replacement rule on both the OIDC and SAML configs: omitting it clears the requirement.
Interactive OIDC login uses PKCE (RFC 7636, S256) end-to-end: the /start redirect carries code_challenge + code_challenge_method=S256, and the token exchange sends the matching code_verifier. This is required for SPA / public Entra app registrations and harmless for confidential apps.
Sign-in mapping table (sso-mapping)
GET /admin/v1/tenants/{id}/sso-mapping returns the tenant's attribute mapping (the group_mapping shared by SAML, OIDC and SCIM) as table rows, in one call. Needs SSO_MANAGE and access to the tenant (a foreign tenant answers 404). It takes no query parameters: any parameter, including tenant, answers 400 bad_param.
{ "tenant": "…", "mapping_status": "ok", "people_basis": "idp_assigned_target_members",
"rows": [
{ "idp_value": "Legal", "kind": "department", "target_id": "…", "target_label": "Legal", "people": 63, "status": "ok" },
{ "idp_value": "ai-admins", "kind": "role", "target_id": "tenant_admin", "target_label": "tenant_admin", "people": 4, "status": "ok" },
{ "idp_value": "legal-contract-review", "kind": "group", "target_id": "…", "target_label": "Contract reviewers", "people": 11, "status": "ok" }
] }
rowsare sorted byidp_value(byte order); an empty mapping is[].kindisgroup(a plain group-id value),departmentorrole.target_idis the id as stored in the mapping.people(people_basis: "idp_assigned_target_members"): the gateway does not record which IdP value produced a membership, so this is the number of active users of this tenant whom the identity provider put on the target: group members added by SCIM or a SAML/OIDC claim (not manual ones), users whose department was set by the IdP, users holding the role through an IdP role grant. Two values mapping to the same target show the same number.status:ok;missing_targetwhen the target no longer exists or does not belong to this tenant (target_labelandpeoplearenull, nothing of another tenant is returned);malformedfor a stored value the save validator would refuse (kind,target_id,target_label,peoplearenull).mapping_status:nonewhen no mapping is stored,okfor a JSON-object mapping,corruptwhen the stored value is not a JSON object (rows[], logged as an error).noneandcorruptare different answers.- A storage fault answers
503, never an empty table.
SAML 2.0 SSO configuration
Configure a tenant's SAML identity provider (see Admin API authentication → Single sign-on (SAML 2.0)). Create, update, and delete require the SSO_MANAGE permission (held by the admin and tenant_admin roles only; it cannot be granted to a custom role); a read (GET) requires tenant access. Unlike OIDC there is no client secret — a SAML IdP signing certificate is public, so it is stored and returned in full.
curl -X PUT https://<your-gateway-host>/admin/v1/tenants/{id}/saml-config \
-H "Content-Type: application/json" \
-d '{
"idp_entity_id": "https://sts.windows.net/<dir>/",
"idp_sso_url": "https://login.microsoftonline.com/<dir>/saml2",
"idp_signing_cert": "-----BEGIN CERTIFICATE-----\n…",
"nameid_format": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
"allowed_email_domains": "corp.example",
"idp_slo_url": "https://login.microsoftonline.com/<dir>/saml2",
"sign_authn_requests": false,
"enabled": true
}'
Accepted input (validated at the trust boundary; rejected with 400 otherwise):
| Field | Rule |
|---|---|
idp_entity_id |
Required, non-empty. |
idp_sso_url |
Required. Must be an https:// URL. |
idp_signing_cert |
Required. PEM or base64 X.509. Public; returned in full on GET. Validated at save time: the certificate is X.509-parsed and its key-strength checked (RSA ≥ 2048-bit, EC ≥ 256-bit) by the same authoritative gate the login path uses — a malformed or key-weak cert is rejected with a precise 400 rather than 502-ing every future login. If that gate cannot be reached the save fails closed with 503. |
idp_signing_cert_next |
Optional string (PEM or base64). Absent, null or empty = no rollover cert; any other type is 400. A second cert to support rollover (both are accepted during the overlap). Validated at save time exactly like idp_signing_cert — a bad rollover cert is rejected at 400 instead of breaking all current logins the moment it is staged. |
nameid_format |
Absent or null → default; an empty or non-string value is 400. Must be an accepted format (persistent / emailAddress / X509SubjectName / kerberos / WindowsDomainQualifiedName / unspecified). transient and entity are rejected — the NameID is the identity key. unspecified is accepted (Microsoft Entra's common default). Default persistent. |
allowed_email_domains |
Required, non-empty. The allowed-domain list (as for OIDC): same separators, format rules, size limits (100 entries), 400 codes (invalid_email_domain, freemail_domain_not_allowed, invalid_request) and 409 sso_domain_conflict rules. |
group_attribute / group_mapping |
Optional. The assertion attribute name and a JSON allow-list mapping its values to internal group ids. Only listed values grant membership; mapping is tenant-scoped and never writes cross-tenant. An IdP value is matched against the keys exactly as stored first; only when no key matches is its whitespace-trimmed form tried (for every group_attribute, as for SCIM department), so " Sales " maps like "Sales". Stored keys are never rewritten, and a value that is blank after trimming never takes that fallback. |
idp_slo_url |
Optional string. Absent, null or empty = no Single Logout; otherwise https:// (any non-string type is 400). The IdP SingleLogoutService URL; empty means Single Logout is not offered (sign-out is local only). |
sign_authn_requests |
Optional boolean or 0/1. Absent or null = default false; any other shape is 400. When true, the gateway signs the AuthnRequest/LogoutRequest with the gateway-wide SP key provisioned by your operator; fails closed if no key is provisioned. |
required_authn_context |
Optional absolute URI (an AuthnContextClassRef, at most 512 characters, no whitespace or <>&"'). Sent in the AuthnRequest as RequestedAuthnContext Comparison="exact", and the signed assertion's AuthnContextClassRef must equal it. Otherwise the login is refused (403, audited as saml.mfa.login_denied) and the user lands on /login?error=sso_mfa_required. This governs sign-ins through this identity provider only; it does not apply to email one-time-code sign-in or to Entra access tokens used by the Microsoft 365 integration. The key is absent from GET when no requirement is set. Omitted or null on PUT means no requirement. A malformed value is rejected with 400 and nothing is saved. |
department_attribute |
Optional string (at most 255 characters, no control or zero-width characters). The name of the assertion attribute whose value is the user's Department name (for example department). Empty or absent attribute in the assertion changes nothing. Unset (default) disables the feature. Unlike the other fields it is not part of the full replacement: omitting the key on PUT keeps the stored value; null or "" clears it; any other non-string or invalid value answers 400 and nothing is saved. Set through this API only (there is no UI field). |
idp_metadata_url |
Optional https:// URL (at most 2048 bytes, no whitespace or control characters) of the IdP's SAML metadata document. When set, the gateway re-reads it once a day and keeps the IdP entity ID, SSO URL, signing certificates and Single Logout URL current (see below). A non-https URL, or one that resolves to a private or internal address, is 400 and nothing is saved, unless the tenant lists that exact host:port in its connector egress hosts (a listed private host:port is accepted). Only the tenant's own list decides; the deployment-wide AIG_SSRF_ALLOW is not consulted, an unreadable or malformed list refuses (fail closed), and the daily refresh applies the same rule. Part of the full replacement: absent, null or "" clears it and stops the refresh. |
enabled |
Optional boolean or 0/1. Absent or null = default true; any other shape is 400. |
required_authn_context is part of the full replacement: omitting it on PUT clears the requirement.
Certificate metadata (certs). GET and the PUT response include certs, a read-only array describing the stored signing certificates, computed from the stored cert on every read (nothing extra is stored). Entries come in the order active (idp_signing_cert) then next (idp_signing_cert_next); a slot with no cert is omitted, and no certs at all gives [].
| Field | Description |
|---|---|
slot |
active or next. |
not_after |
The certificate's expiry as a unix timestamp in seconds; null when the entry has an error. An already-expired certificate reports its past date and no error (expiry is not enforced here). |
subject |
The subject distinguished name (RFC 4514 text, at most 256 bytes) or null if it is unavailable. |
error |
Only present on a failed entry: invalid (the stored cert cannot be parsed or is too weak) or unavailable (the gateway-wide validator could not be reached). Never fails the request: GET stays 200. |
Metadata import and daily refresh. POST /tenants/{id}/saml-config/metadata-import with {"metadata_url": "https://…"} fetches the document and returns the parsed fields (idp_entity_id, idp_sso_url, idp_signing_cert, idp_signing_cert_next, idp_slo_url) for review. It is preview-only: nothing is stored until you send the values through PUT, which is also where idp_metadata_url is saved. The fields pass the same validation as a PUT. Errors: a missing, non-string, non-https or over-long URL, a private or internal address that the tenant did not list in its connector egress hosts (including a redirect to one; a listed private host:port is accepted, AIG_SSRF_ALLOW is never consulted), or a document that is not acceptable (unsigned-trust parse failure, no SAML 2.0 IdP SSO descriptor, no usable signing certificate) → 400; the metadata host cannot be fetched → 502; the gateway-wide validator is unavailable → 503.
GET additionally returns idp_metadata_url, idp_metadata_checked_at, idp_metadata_refreshed_at (unix seconds) and idp_metadata_last_error (short plain text, null when the last check succeeded). The daily refresh only replaces the IdP fields when the document is valid and its entity ID still equals the stored one; a failed or mismatching check leaves the stored configuration unchanged and records the reason in idp_metadata_last_error. A refresh that changes something is audited as saml_config.metadata_refreshed, a failed one as saml_config.metadata_refresh_failed (see Audit log).
Mapping sources. PUT /tenants/{id}/mapping-sources with {"department_attribute": "department"} writes only the SAML department attribute, which the Mapping card's Department comes from select uses. The body must be a JSON object with exactly that one key; null or a blank string clears it (SCIM-only), a string is trimmed and validated like the same field on PUT /saml-config. Requires SSO_MANAGE and access to the tenant; when the stored mapping holds role targets, changing the value also needs the tenant admin or platform admin role, as for saml-config (403 otherwise). Responses: 200 {"department_attribute": <value|null>}; 400 for a non-object or empty body, an unknown or missing key, or an invalid value (nothing is stored); 409 saml_not_configured when the tenant has no SAML configuration; 503/5xx when storage fails. Each successful write records the audit action saml_config.mapping_sources_updated.
Department sync on SAML login. When department_attribute is set, each successful SAML login reads that attribute from the signed assertion and assigns the user to the tenant Department of that name (marked department_source = idp), using the same matching, unknown-name and department_source_precedence rules as SCIM Department assignment. A multi-valued attribute, a non-string value, invalid UTF-8, a name longer than 255 characters or a value with nothing visible is ignored (a warning is logged, the login still succeeds). An absent attribute, or an empty one ("" or ASCII whitespace only), leaves the current Department untouched; this differs from SCIM, where an absent department clears an assignment the identity provider made earlier. SCIM and SAML are last-writer-wins: the most recent sync decides. Exception: a group mapping with department targets. When the SAML group mapping of the tenant holds any department target (matched or not, or the stored mapping is unreadable), the mapping is the only identity-provider source of the Department: department_attribute is not applied at sign-in, and the one Department write of a login is the mapped one (only when the group values map to exactly one Department; otherwise nothing is written). Without department targets, department_attribute behaves as described above. Changes are audited as saml.user_department_changed.
The PUT performs two writes (the config, then department_attribute). If the second fails the request answers 5xx after the first was saved; retrying the same PUT converges.
Gateway grants. A group named in group_mapping may carry gateway grants; claim sync (saml_claim) then widens a user's gateways without passing the admin delegate rules. Control who can set the claim in the IdP.
GET returns the full config (the cert is public); DELETE removes it. Both answer 404 { "error": "no SAML config for this tenant" } when the tenant has no SAML config. An absent group_mapping leaves the stored mapping unchanged.
Provider profiles (what each IdP must release). The gateway reads the same attributes whatever the provider; these are the ones it recognises. The email used to link a first-time SAML user is the NameID when it contains @, otherwise the first of these attributes that is present: email, mail, urn:oid:0.9.2342.19200300.100.1.3, http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress, User.email (OneLogin). The user principal name (upn) is never used as an email: it is a logon name, not a verified mailbox.
| Provider | Release this for first link |
|---|---|
| Okta, Google Workspace, Keycloak, JumpCloud, PingOne, generic | email (or an emailAddress NameID) |
| Microsoft Entra ID | the .../claims/emailaddress claim |
| OneLogin | User.email (or email) |
| Auth0 | the .../claims/emailaddress claim. Auth0's default entity ID is a urn:auth0:<tenant>:<connection> URN: copy it exactly into idp_entity_id |
| AD FS | the E-Mail-Addresses claim (.../claims/emailaddress) must be added to the claim rules. AD FS by default releases only upn and a DOMAIN\user NameID; a first sign-in with only those is refused with 403 (/login?error=sso_denied), audited as login_denied, and creates neither a link nor a user. Already-linked users are not affected |
Display name. A user created just-in-time by SAML or OIDC gets the name the IdP sends: SAML displayName (.../claims/displayname, urn:oid:2.16.840.1.113730.3.1.241), otherwise givenName + surname; OIDC name, otherwise given_name + family_name. preferred_username, upn, email and the SAML .../claims/name claim are never used as a display name. The name is sanitised before it is stored: control, bidirectional and zero-width characters are removed, runs of whitespace collapse to one space, and a name that is not valid UTF-8, is empty afterwards, or is longer than 255 characters is ignored (never truncated), leaving the name unset. HTML is stored literally and escaped when shown. The name the IdP last sent is recorded on the identity link. On each later login the user's name follows the IdP only while it is still exactly the name the IdP sent before; a name the user or an administrator has edited is kept, and users that existed before this feature are never renamed.
SCIM credential
Generate the bearer token the tenant's identity provider uses to drive SCIM provisioning. POST and DELETE require the SSO_MANAGE permission (held by admin/tenant_admin only; not grantable to a custom role); GET requires SSO_MANAGE too (a foreign tenant answers 404). The plaintext is returned once on generation (only the SHA-256 hash is stored). A new POST rotates the credential: the previous token stops working.
curl -X POST https://<your-gateway-host>/admin/v1/tenants/{id}/scim-credential
# → { "token": "scim_…", "base_url": "https://<your-gateway-host>/scim/v2", "tenant": "…" } (copy the token now)
curl https://<your-gateway-host>/admin/v1/tenants/{id}/scim-credential
# → { "configured": true, "created_at": 1760000000, "base_url": "…/scim/v2", "tenant": "…",
# "created_by": { "kind": "user", "id": "…", "name": "…", "email": "…" } } (never the token)
curl -X DELETE https://<your-gateway-host>/admin/v1/tenants/{id}/scim-credential
# → { "ok": true } (SCIM provisioning stops until a new token is generated)
A platform admin who is impersonating a user cannot generate a SCIM token: the mint is refused with 403 { "error": "impersonation_forbidden", "code": "impersonation_forbidden" }. Generating and deleting are audited (scim_credential.rotated, scim_credential.deleted). created_by is null when there is no credential, the creator was erased or no longer exists; a creator who is a platform admin (also when the account additionally holds a workspace role such as tenant admin) is shown as { "kind": "staff", "label": "Myra staff", "staff_id": "<pseudonym>" } (never the real identity), and a creator from another tenant as { "kind": "user", "id": "…" } only. A same-tenant creator who was later removed (soft-deleted, not erased) is still shown with name and email, as removed users are in user management. A database fault on GET → 503.
Atomic writes and audit rows (SSO, SAML, SCIM credential). Every mutation on sso-config, saml-config (including PUT /mapping-sources and the daily metadata refresh) and scim-credential commits the change and its audit row in a single database transaction: either both are stored or neither is. The audit row records the acting user (actor_id). A PUT /saml-config is one write — the configuration, the group mapping and the department attribute are stored together, and a failure leaves the previous configuration untouched. Failure answers: 503 (retryable) means nothing was written, for example a lock wait or a database outage, so the request is safe to repeat. A sanitised 500 means a permanent error or an unknown outcome (for example the connection was lost at COMMIT, so the write may have been stored); do not assume nothing happened, re-read the configuration before repeating. A 500 on POST /scim-credential can leave the new credential stored with no token returned: rotate again to obtain a working token. A 503 there leaves the old credential working. Under SSO enforcement, a save that newly covers email domains revokes the sessions of those domains as its own step; that revoke stands even when the configuration save itself is then refused with 503 or 500. DELETE /scim-credential with no credential present is 200 and records nothing. A PUT /sso-config or PUT /saml-config that races with a concurrent delete of the tenant or of the configuration answers 404 (tenant gone) or 409 config_changed_concurrently and stores nothing. DELETE /sso-config and DELETE /saml-config answer 404 when the configuration is already gone, including when they lose a race with another delete (nothing is recorded). PUT /mapping-sources answers 409 saml_not_configured when no IdP is configured or when the SAML configuration or the tenant is deleted during the save; 404 only when the tenant was already gone at the access check. The daily SAML metadata refresh uses the same unit; a refused refresh leaves the stored configuration and the last-checked stamp unchanged and is retried at the next sweep. A change of the OIDC "IdP-asserted emails are trusted" switch records its own audit row in the same unit as the save.
SSO preview (check a user)
POST /admin/v1/tenants/{id}/sso-preview (permission SSO_MANAGE, tenant access required) is a read-only dry run of what an SSO sign-in would produce. It issues only reads: no account, membership, role, department or audit row is created or changed.
Request body (max 64 KiB; unknown keys rejected):
| Field | Meaning |
|---|---|
email |
Existing-user mode: the user's current state. Unknown, foreign, deleted and disabled users all answer 404 {"error":"user not found"}. |
values |
Array of at most 200 strings (256 bytes each): the IdP group values for a "what if". Without email it simulates a first sign-in (JIT). |
source |
oidc or saml. Absent: oidc when the tenant's OIDC SSO is enabled, else saml. |
jit_email |
First-sign-in mode by address: the address of a person who is not a member yet. Trimmed and lowercased; it must be ASCII with exactly one @ and a valid address shape, otherwise 400 with field: "jit_email" (null, a non-string and "" are rejected too, never treated as absent). It cannot be combined with email (400, field: "jit_email"). Its domain is checked against the allowed email domains of the lane's IdP configuration (OIDC or SAML, per source), in the sign-in's order: unverified email, then domain, then the first-sign-in switch. A domain not on the list answers denied with slug email_domain_not_allowed; with no IdP configuration saved for the lane the answer is also email_domain_not_allowed (fail closed). jit_email is not looked up: an address that already belongs to a member is answered as a first sign-in (jit_created, or no_account when creating people on their first sign-in is off), although a real sign-in would link that member; email_reuse stays in unchecked to say so. |
email_verified |
Boolean, JIT mode only, i.e. without email (with email it is rejected). |
Either email, values or jit_email is required. Validation failures answer 400 {"error", "field"}; an oversized body answers 413 {"error":"body_too_large"} (also for a chunked body without Content-Length). A database fault during any read (tenant, SSO config, user, department, groups, gateway names) answers the sanitised 503 {"error":"temporarily unavailable; retry later"} and never a guessed result. A stored user without a readable role is a data defect, not a transient fault: it answers the generic 500 (retrying does not help). A department value that is present but not a valid id is treated like a missing department row (gateways restricted/malformed), never as "no department".
The response carries outcome (signed_in, jit_created or denied with a slug such as sso_email_unverified or no_account), mapping (ok, unconfigured, invalid), idp_values (supplied or not_stored), the resulting role (including refused_last_admin), custom_roles, department, groups, budget and gateways. In JIT mode unchecked lists the checks the preview does not evaluate (email_domain, seat_cap, email_reuse; with jit_email the domain is checked, so only seat_cap and email_reuse); in existing-user mode link_check is not_evaluated.
gateways.items[] carry id, name (the gateway's slug), via (department, group or department+group) and, for a group grant, group_name; default_gateway_id names the department's default. The admin UI's Check a user line (Sign-in & provisioning › Mapping) reads this answer fail-closed: a body that is not this shape is shown as a failed check, never as a partial result.
department.id is the user's effective department: an existing user pinned to no department stays without one (the tenant default does not apply). If the effective department no longer resolves to a live department of the tenant, gateways answers {"restricted": true, "reason": "malformed", "items": []}, matching the real sign-in, which then denies every gateway.
Known limits: the SAML department_attribute is not modelled, and the custom-role result is an approximation.
Per-tenant subprocessor objections (deactivation)
When a customer exercises its Art. 28 Abs. 6 DSGVO right to object to a new or changed
sub-processor, Myra Ops records the objection here. Recording it deactivates that sub-processor's
LLM provider(s) for that one tenant only — routing never selects a deactivated provider (primary,
fallback, failover, tool-loop, and the observed LiteLLM-overflow leg all refuse it with
provider_objected / 403), and its models stop being offered in that tenant's
model pickers. No other tenant is affected, and the tenant keeps a working service on the remaining
providers. This is an operator capability (SUBPROCESSORS_MANAGE, platform admin) — a legal
objection recorded by Myra, not a tenant self-service toggle. The set of providers a key
deactivates comes from the subprocessor → provider mapping.
Creating or withdrawing an objection and its audit entry are one transaction: the audit entry is written just before the commit, so a change is never stored without its entry, and an entry is never stored for a change that failed. If the audit entry cannot be written, the change is rolled back and the answer is 503 (nothing stored, retry the request) or 500 (not retryable: nothing is stored, except when the commit itself failed, then the change may or may not be stored: reload before retrying). Withdrawing an objection that does not exist answers 404 and writes no audit entry.
| Method & path | Purpose |
|---|---|
GET /admin/v1/tenants/{id}/subprocessor-objections |
list this tenant's active objections (array; [] when none) |
POST /admin/v1/tenants/{id}/subprocessor-objections |
record one — body { "subprocessor_key": "anthropic" } |
DELETE /admin/v1/tenants/{id}/subprocessor-objections/{key} |
withdraw one (re-enables the provider) |
Presence of a row is the active state — withdrawal is a row delete, so there is no active flag
to keep in sync. Every route also enforces require_tenant_access (tenant scoping). Validation
(fail-closed):
{key}— a register slug that is a current or upcoming sub-processor (a removed key →404 subprocessor_key_unknown); in thePOSTbody an absent or empty key →400 subprocessor_key_required; malformed (wrong type,null, bad charset) →400 invalid_subprocessor_key; over 64 characters →400 subprocessor_key_too_long(all formerlysubprocessor_key_invalid; theerrortext is unchanged). A malformed{key}in theDELETEpath →400 invalid_subprocessor_key(over 64 characters:subprocessor_key_too_long).POSTrequires the key to have ≥ 1 provider mapping — else400 no_mapping(an objection must deactivate at least one concrete provider; it is never a silent no-op). Idempotent on(tenant, key).DELETEof an objection that does not exist →404 not_found.
Recording/withdrawing an objection audit-logs the change and flushes the tenant's gateway config
cache, so the (de)activation takes effect on the next request. Recording or withdrawing an objection for an unknown or soft-deleted organisation is refused with 404 not found (no code); for an organisation that is purged while the request runs it is refused with 404 tenant_not_found; the objection rows of a purged organisation are kept for 730 days (see the deletion protocol above) and are not listed anywhere. (The notification e-mail and
30-day objection window) will drive this same API automatically when its window closes.
Error codes
Every 4xx from the tenant routes carries a sibling top-level code next to the unchanged error sentence; branch on code. A refusal about one request field also carries field. The shared definitions are in Error codes.
| Status | code |
Meaning |
|---|---|---|
| 400 | malformed_body |
The body is valid JSON but not an object (an array, a string, a number, true or null), is not valid JSON, or holds a non-finite number (see Request body shape). Only an absent or blank body is read as {} (tenant PATCH: a 200 that changes no field; row_version still advances). |
| 400 | invalid_field |
A field is missing or wrongly typed; field names it. |
| 400 | unknown_field / read_only_field |
PATCH key not accepted / read-only value changed; field is the key (capped at 64 bytes). |
| 400 | field_retired |
The field was retired. |
| 400 | no_fields |
A PATCH with nothing to change. |
| 400 | unknown_plan, invalid_users_option, confirmation_required, confirmation_mismatch, tenant_key_provider_not_allowed |
See Error codes. |
| 400 | invalid_source_policy_floor |
source_policy_floor is not a valid floor; see Minimum for every source. |
| 400 | invalid_delivery_channel_class |
delivery_channel_class is not a valid channel class object; see Delivery channel class. |
| 403 | platform_admin_only, tenant_admin_only, tenant_editor_only |
The caller's role may not change that field; field names it. |
| 404 | tenant_not_found, asset_not_found, not_found |
Unknown tenant / no stored asset / unknown sub-resource. |
| 409 | stale |
Lost a concurrent-write race; re-read and retry. |
| 409 | tenant_not_restorable, tenant_not_soft_deleted, purge_own_tenant, actor_unknown, trial_plan_locked, protected_user_in_tenant, platform_user_in_tenant, actor_in_tenant, portal_managed |
Lifecycle and plan refusals. |
| 413 / 415 | image_too_large / unsupported_image_format |
Logo or favicon upload. |
| 500 / 503 | wallet_credit_failed / paid_signup_state_unavailable |
Wallet credit failed / signup setting unreadable (retry). |
Not coded: a storage fault (503, or 500 with a request_id), the audited 404 { "error": "not found" } for a tenant the caller may not see, and the auth-gate 401 / 403 forbidden of the session check keep their plain shape.
Gateways
Listing every gateway you can reach
One request for all the gateways the signed-in caller can reach — what the admin console's gateway pickers (a user's New token dialog, Profile → New token, the Open-Xchange connect page, Continue on a shared conversation) read, instead of one per-tenant listing per tenant.
Response (a JSON array; empty: []):
[
{
"id": "gw_xyz789",
"slug": "production",
"tenant_id": "ten_abc123",
"tenant_slug": "myapp",
"purpose": "production",
"created_at": 1742551200,
"routable": true
}
]
- Scope — from your session only. A platform
admingets the gateways of every live (not soft-deleted) tenant; every other role gets its own tenant's gateways; a user without a tenant who is not a platform admin gets[]. There is no tenant or scope parameter: unknown query parameters (tenant_id,scope, …) are ignored and can never widen what you see. - Fields. Only the fields a gateway picker needs — no
config, no provider or offer profile (read those per tenant withGET /tenants/{id}/gatewaysor per gateway withGET /gateways/{id}).routableis the same per-caller department verdict as on the per-tenant list. - Order. Tenants newest first, and within a tenant its gateways newest first.
include_test. Same rule as the per-tenant list (one shared implementation):include_test=1orinclude_test=truealso returnstest,benchmarkandarchivedgateways and test-fixture slugs; absent — or any other value, including an empty?include_test— hides them. A repeated parameter is read by its first value (the same as on every admin list). Accounts on a test e-mail domain always see them.- Errors.
503when the gateway list or your department policy cannot be read (retry);422 { "code": "gateway_list_too_large" }when there are more than 20,000 gateways — never a silently truncated list.
Listing gateways for a tenant
Response:
[
{
"id": "gw_xyz789",
"tenant_id": "ten_abc123",
"slug": "production",
"config": { "auth_required": true, "cache_ttl": 300 },
"purpose": "production",
"configured_providers": ["openai", "anthropic"],
"offer_restricted": false,
"offerable_providers": [],
"residency_enforced": false,
"provider_zones": { "anthropic": "non_eu", "openai": "non_eu", "myra": "eu" },
"managed_models": { "anthropic": { "claude-opus-4-6": true } },
"managed_key_source": { "anthropic": { "claude-opus-4-6": "platform" } },
"web_search_configured": true,
"web_search_setup_pending": false,
"video_available": false,
"remove_background_available": false,
"created_at": 1742551200
}
]
💡 Note: By default this listing returns only
productiongateways. Pass?include_test=1to also includetest,benchmark, andarchivedgateways (used by the admin Gateways page that manages fixtures). Each returned row carries itspurposefield and aconfigured_providersarray listing the providers that have a key configured on the gateway.💡 Myra-provided models (
managed_models). A row carriesmanaged_models— the Myra-provided keyless model grants on the gateway, as{ provider: { model: true } }— only with entries that would actually route: the gateway has the grant and the tenant is wallet-governed (since the wallet money-model rework every real tenant has a prepaid wallet, so this check is fail-closed on a missing/malformed folded config rather than abudget_usdcap that no longer exists) and the model is still in the server SUPPORTED allowlist with a live (non-deprecated) price row and the provider survives the gateway's residency/allowlist gates and the gateway does not send that provider to a custom base URL (provider_base_urls) — Myra's managed key is never sent there. Anything else — a grant whose folded gateway config is absent or malformed (fail-closed) — is omitted (the key is absent when nothing qualifies), because since the fix the model pickers fold these entries into the offered model set (a gateway with only grants and no stored provider key now offers exactly its granted models), and offering a non-routable grant would fail on pick. Grants that don't qualify are still visible raw viaGET /gateways/{id}/managed-models(the Add-Model modal reads that). Unless the gateway's owndefaultkey serves it (seemanaged_key_sourcebelow), usage of a granted model is served on Myra's managed key and billed to the tenant's prepaid wallet, and can then hitquota_exceeded/spend_unverifiedwhen the wallet is empty/frozen or its spend cannot be read, unlike a BYOK model of the same provider — the/easypicker badges such rows "Included / billed to wallet" when the Myra key serves them. The map is folded server-side from themanaged_model_granttable (never from the tenant-editableconfigJSON, so it is not a smuggle vector) on the gateway's resolved config.💡 Own-key policy (
own_keys_allowed). Each gateway row carriesown_keys_allowed(boolean):truewhen the tenant's plan may hold its own provider keys, or when the gateway is the Myra pool gateway.falseon self-serve plans (self_serve_*, trials included), wherePOSTof a provider key answers400own_key_not_available_on_plan, and also when the stored plan is absent or malformed (fail closed). The SPA reads this flag becauseplanis redacted for non-editors; clients must treat anything other than the literaltrue(absent,null, other types) as not allowed.💡 Key source of managed models (
managed_key_source). Next tomanaged_models, a row carriesmanaged_key_source—{ provider: { model: "own" | "platform" | "unknown" } }for the same (provider, model) entries — saying which key serves it:own(the gateway's owndefaultkey for the provider; the provider bills the tenant directly),platform(the Myra key, charged to the wallet) orunknown(the server could not decide). It is computed by the same key resolver that routes the request (a key stored only under a non-default alias does not make a modelown), is absent whenevermanaged_modelsis absent, and carries presence only — never key material. Clients must treat an absent or unrecognised value asunknown, notplatform.💡 Model-offer profile (
offer_restricted,offerable_providers). Each row also carries the effective model-offer profile the chat model picker uses so it never surfaces a model that would then be blocked at dispatch.offer_restrictedistruewhen a dispatch gate is armed on the gateway's resolved config (tenant-floor-folded): EU data-residency (eu_region_routing), the provider allowlist (provider_allowlist_enforced), and/or a per-tenant subprocessor objection. Whentrue,offerable_providerslists the only provider names the picker may offer — the subset (of the gateway's configured providers plus the keyless EU fleetmyra, plus the provider of any routable managed grant per themanaged_modelsnote above) that survives all the armed gates (EU-hosted, on the allowlist, and not objected to). Whenoffer_restrictedisfalse,offerable_providersis an empty array and the picker offers every configured provider unchanged. The values are computed by a single backend authority (reusing the same EU-residency and provider-allowlist predicates the upstream dispatch chokepoint enforces) — so the offered set can never drift from what will actually route. Fail-closed: if the resolved config cannot be loaded, the row is returned withoffer_restricted: trueand an emptyofferable_providers(offer nothing extra) rather than falling back to the un-folded stored config.💡 Residency profile (
residency_enforced,provider_zones). The chat uses these two fields to warn before a send moves a conversation to a less private model.residency_enforcedistruewhen EU data residency is enforced on the gateway's resolved config (the gateway flag, the tenant floor or the deployment setting) — every provider that can then run there is EU-hosted.provider_zonesmaps every provider configured on the gateway or offered there through a routable managed grant or the self-serve pool and the Myra fleet that every gateway offers (myra:"eu", or"unknown"when the gateway sends Myra models to a host of its own via a custom base URL) to its residency zone, from the same check the dispatch gate enforces with:"eu"(provably EU-hosted),"non_eu"(provably not) or"unknown"(cannot be proven either way — for example Amazon Bedrock, whose residency depends on the concrete model id, a provider with a custom base URL on the gateway, OpenAI sent to the gateway's own Azure endpoint, or Azure without a configured region). The chat never reads"unknown", or a provider missing from the map, as either EU or non-EU: it then says it cannot verify the change. Both fields come from the same backend authority as the dispatch gate; neither is a separate setting. Unknown is not "off": if the resolved config cannot be loaded, both fields are omitted from the row (notfalse/{}), and the chat treats the gateway's residency as unknown.💡 Department routing (
routable). Each row carriesroutable— may the signed-in caller route through this gateway per their department?truefor a user without a department (unrestricted) and for every gateway in the caller's department's allowed set;falseotherwise (and for every gateway when the caller's department no longer exists or allows nothing). The chat model picker hidesfalserows. It is a display mirror — the inference gate refuses a forbidden route regardless. A department read that fails with no recent answer makes the listing answer503(never "everything routable").💡 Web-search capability (
web_search_configured). Each row of this listing and the single-gatewayGET /gateways/{id}carries a computed booleanweb_search_configured— the server's OWN web-search availability verdict for the gateway (search.gateway_configured: theconfig.web_searchblock is present,enabledis the JSON booleantrue, ANDapi_keyis a non-empty string), the exact predicate the dispatch path enforces on. It is computed on the raw config and present for every reader (including one whoseweb_search.api_keyis redacted per the credential-scoping rule above). The/easycomposer's Web search switch (in the + menu) and the model-picker "Web research" capability tag read this boolean so they reflect real capability without the client reading the providerapi_key; on a gateway where it isfalsethe switch is shown disabled-with-reason and no model is tagged "Web research", and a turn that still requests search (x-aig-web-search) is skipped server-side and logged (operator WARN) rather than silently answering ungrounded. Absent from an older backend ⇒ the client treats the gateway as not search-capable.💡 Web-search setup-pending (
web_search_setup_pending). A companion boolean on the same two read routes, computed bysearch.search_setup_pendingon the gateway's resolved config: it istruewhen web search is enabled on the gateway (theconfig.web_searchblock is present andenabledis the JSON booleantrue) but there is no usableapi_keyyet — the "enabled, not set up" state, distinct fromweb_search_configured: falsemeaning search is simply not enabled. This is the exact state every newly created production gateway (any plan) sits in while the platform Linkup key (the DBsettingsrowtrial_linkup_api_key, super-admin-set in the admin console → Feature Flags) is unset:core.gateway_defaults.seed_web_searchseeds a keyless Linkup block at creation, andcore.config._apply_platform_web_search_keyinjects nothing until the setting is filled (the Health dashboard then reportsweb_search_platform_key_missing: true). The two booleans are mutually exclusive — the server derives pending asnot web_search_configured and search_setup_pending, so a gateway is never both — giving the client a tri-state:configured(the switch works),pending(the switch disabled + a visible "not set up" notice in the/easycomposer), or neither (search not enabled — the switch disabled, no notice). Same raw-default-then-refine-on-resolved computation asweb_search_configured, so a gateway whose resolved config is not found (or, in the list, corrupt) still reportspendingon a trial keyless row (the informative notice) rather than the silent not-configured state. A database fault while resolving the config (or reading the tenant) answers both read routes with503 { "error": "temporarily unavailable; retry later" }— never a200built from partly unresolved rows; a config stored corrupt makes the single-gatewayGETthe sanitised500 { "error": "internal error", "request_id": "…" }. A non-booleanenableddegrades to not pending (the silent state), never to a spurious notice; a JSONnullreads as absent / off. Absent from an older backend ⇒ the client treats the gateway as not pending (no notice).💡 Unsupported search provider (
web_search_provider_invalid). A third boolean on the same two read routes:truewhen the gateway'sweb_search.provideris set to a value that is not a supported provider (anything butbraveorlinkup). Such a gateway has web search disabled (except under an armed EU data-residency tenant, where the stored provider is clamped to the tenant's EU default and search stays enabled) — it reportsweb_search_configured: falseandweb_search_setup_pending: false, the tool is not offered to the model, and no search request leaves the gateway. An absent ornullprovider is not invalid (it inherits the tenant default, elsebrave). The value is evaluated on the resolved config, so a blank provider that the tenant default fills is not flagged.💡 Keyless web search hint (
web_search_tenant_provider,web_search_platform_key_set). For a caller withGATEWAYS_MANAGEonly, the same two read routes also carry the two inputs the gateway form needs to tell whether web search can be turned on without an API key of the gateway's own:web_search_tenant_provideris the organisation's web-search default ("brave","linkup", ornullwhen none is set — a gateway whoseweb_search.provideris absent inherits it, and with no default it resolves to Brave), andweb_search_platform_key_setsays whether the platform's Linkup key is configured. A gateway whose web search is enabled with noapi_keyand whose provider resolves tolinkupuses the platform key when it is set; any other keyless gateway stays "enabled, not set up" (web_search_setup_pending: true). The key itself is never returned. Both fields are absent for a reader withoutGATEWAYS_MANAGE.💡 Note: In addition to the
purposefilter, the default listing rejects rows whose slug matches a known test-fixture naming heuristic (prefixes such ase2e-,test-,sim-, or slugs embedding a millisecond timestamp). This second layer exists because some fixtures must bepurpose: "production"to act as routing targets and would otherwise leak into user-facing pickers. Accounts whose e-mail address ends in a test TLD (.test,.local, …) — and any caller passing?include_test=1(ortrue) — bypass both filters and see every gateway. Any otherinclude_testvalue (0, a typo, an empty?include_test) keeps the filters on (a repeated parameter counts by its first value) — the same rule asGET /gateways.
Creating a gateway
Accepted keys and refusals. The body accepts exactly four top-level keys:
slug,config,purposeandcreate_only. Any other key (a misspeltpurpse, a field from another route) is refused with400{ "error": "unknown_field", "code": "unknown_field", "field": "<key>" }, and nothing is created or changed, also when theslugalready exists (the upsert). Thefieldnames the first unknown key in sorted order, with control characters and invalid UTF-8 bytes replaced by?and capped at 64 bytes. The key check runs after the permission, tenant-access and trial-lock checks and before theslug,configandpurposechecks; keys insideconfigare checked by theconfigrules. Other refusals are400withinvalid_field(withfield: "slug") for a missing or non-stringslug(absent and malformed alike) andinvalid_configfor a badconfigvalue. Earlier versions ignored unknown keys and answered201. See Error codes.
curl -X POST https://<your-gateway-host>/admin/v1/tenants/{tenant_id}/gateways \
-H "Content-Type: application/json" \
-d '{
"slug": "production",
"config": {
"auth_required": true,
"cache_ttl": 300,
"retry_count": 2,
"timeout_ms": 30000,
"log_payloads": true,
"budget_usd": 500.00,
"rate_limit": {"requests": 100, "window_sec": 60}
}
}'
| Field | Type | Required | Description |
|---|---|---|---|
slug |
string | Yes | URL-safe identifier unique within the tenant. Must be a non-empty string of at most 255 bytes — a null, a number, a boolean or an object is rejected 400 and nothing is persisted. Posting an existing slug updates that gateway (upsert); "existing" is matched case-, accent- and padding-insensitively (ACME, acmé and "acme " (trailing space) all find the gateway acme). Only the gateway's stored spelling routes on /v1 — see slug matching. |
config |
object | No | Gateway configuration. Omitted or null on an existing gateway leaves the stored config untouched (see the note above); on a new gateway it starts as {} — plus, for a new production gateway, the seeded web-search default (see the note below). When supplied, it replaces the stored config — with one platform-admin-only exception: config.test_headers_allowed. On a write by any actor below platform admin its submitted value is ignored and the stored value is carried into the replaced config (so a scripted upsert that omits it does not disarm a gateway, and one that sends it does not arm it); the 201 then carries "ignored_fields": ["test_headers_allowed"] when the dropped value differed. This field is strip-and-carry rather than the 403-on-change rule the tenant's platform-admin-only fields use precisely because this route replaces the whole config: an omitted key here is a change, and a 403 would refuse every upsert that does not echo the flag. A platform admin's non-boolean value that differs from the stored one is 400. A transient fault on the read of the existing gateway's config returns 503 ({ "error": "temporarily unavailable; retry later" }) and writes nothing — the write depends on that read. |
purpose |
string | No | Visibility tier: "production", "test", "benchmark", "archived" or "disabled". Omitting it leaves an existing gateway's purpose untouched and defaults a new one to "production". An unrecognised value is rejected 400 (it used to be silently ignored, which turned a typo such as "archive" into a gateway that routes production traffic). Only "production" gateways appear in user-facing routing and the default tenant listing. "disabled" is the kill switch (see Switching a gateway off). |
create_only |
boolean | No | Declares create-intent. With true, posting an existing slug is refused 409 { "error": "…", "code": "slug_taken" } and nothing is written — the stored config (guardrails included) is left exactly as it is; no id is echoed on the refusal. Omitted, null or false keeps the documented upsert for scripted callers. A non-boolean value ("true", 1, an object) is rejected 400 — a string "false" must never be read as a flag. The dashboard's Create gateway dialog always sends true: a dialog titled Create cannot act as an overwrite of a gateway the operator believes they are creating. A concurrent create that loses the race on the slug's unique key is reported as the same 409, never a 500. |
Response: { "id": "...", "slug": "...", "purpose": "production" } — slug is the gateway's stored spelling, which may differ from the one you posted (a case or accent variant of an existing slug updates that gateway and echoes its stored slug); only that exact spelling routes on /v1. purpose is the value the gateway now has, which for an upsert that did not set one is the purpose it already carried. An optional "ignored_fields": ["test_headers_allowed"] is present only when a non-platform-admin's differing value for that field was dropped (see the config row).
🌐 Web search is seeded on every new production gateway. When the slug is new and the effective
purposeisproduction(given or defaulted), the stored config additionally receivesweb_search: { "enabled": true, "provider": "linkup", "max_results": 5 }— a keyless Linkup block — only if the suppliedconfighas noweb_searchkey at all. A suppliedweb_search(your ownapi_key, another provider such asbrave, an explicit{ "enabled": false }, or even JSONnull) is written verbatim — BYOK always takes precedence and is never overwritten. Newtest/benchmark/archivedgateways are not seeded (a new gateway createddisabledis seeded, so re-enabling it later needs no further setup) (their config is stored exactly as posted). The block carries no key: the Myra platform Linkup key (thetrial_linkup_api_keysetting — all plans) is injected at read time by the inference path, so theGET/list responses and the tenant export show the block without anapi_keyfor every caller, includingGATEWAYS_MANAGE, whileweb_search_configuredreportstrueonce the platform key is set.image_generationis not seeded on this path (self-signup only). The upsert of an existing slug never seeds anything. Seeding happens inside the single storage writer, so no create request can bypass it.🔒 Gateway budget shape. When
config.budget_usdis set, it must be a non-negative number — a negative /NaN/+inf/ non-number value is rejected400("budget_usd must be a non-negative number") and nothing is persisted, at both the create route and thePATCH /gateways/{id}route (thePATCHre-validates the merged value when the body touches the cap —budget_usdorbudget_period— so a legacy row carrying a pre-validation malformed budget is caught rather than silently re-persisted; an edit that touches neither is not blocked). A malformed budget would otherwise brick the gateway (a negative cap blocks its first request) or silently make it unlimited (NaNreads as no cap) at runtime. Likewiseconfig.budget_period, when present and notnull, must be exactly"daily","weekly","monthly"or"total"— any other value is rejected400("budget_period must be one of: daily, weekly, monthly, total") on create and on aPATCHthat touches the budget; the runtime would otherwise treat it as"monthly"(a lifetime cap silently resetting every month).0is a legitimate hard-freeze; empty/nullis unlimited. A gateway budget above a tenant-level limit is not rejected (the former over-cap400was removed — PO decision 2026-09-25; and since the wallet money-model rework there is notenant.budget_usdto compare against — tenant enforcement is the wallet balance plus the optionalspend_cap_usd): a gateway cap is accepted as-is.middleware/quotaenforces the wallet, the tenant spend cap, and the per-gateway cap independently, so a larger gateway sub-cap is harmless — the tighter of the tenant-level bounds still binds first; the value is a display concern, not a spend risk.💡 Note:
purposeclassifies a gateway's visibility tier (migration 0048). Onlyproductiongateways take part in user-facing routing and appear in the defaultGET /tenants/{id}/gatewayslisting.testandbenchmarkgateways (E2E fixtures and benchmark rigs) andarchivedgateways are hidden from that listing unless the caller passes?include_test=1; they are never offered to the chat composer.archivedmarks a soft-retired gateway kept for historical conversation attribution but never routed to.
Switching a gateway off
Setting purpose to "disabled" (POST /tenants/{id}/gateways upsert or PATCH /gateways/{id}) switches the gateway off at once; setting it back to "production" switches it on again. Nothing else about the gateway is changed or deleted, so keys, rules and configuration survive a disable and re-enable.
- Effect. Every request that resolves to the gateway is refused with
403gateway_disabled: inference, MCP proxy, compat, chat attachment and OCR, the sales-knowledge search, and the side calls that bill to the gateway. A dispatch re-target, fallback or failover onto a disabled gateway is refused too, and the refusal ends the failover chain rather than trying the next entry. An unrecognised or malformed stored purpose is treated as disabled (fail closed). - Propagation. The change reaches every node within about 5 seconds (the gateway-config cache lifetime).
- Still visible. A disabled gateway stays in the admin Gateways list (it is not hidden like
test/archived) so it can be re-enabled, and it keeps its place in an existing department or project allow-list: re-saving a set that already contains it is accepted, while adding a non-production gateway to a set is still refused with422. - Exempt. Platform-internal jobs that do not serve a caller (
tts_precompute,tts_normalize_llm,ingest_api,rag_embed) are not gated. - Audit. A change of
purposeon an existing gateway writesgateway.purpose_changedwithbeforeandafter(see Audit log). Creating a gateway writes no such row, and re-sending the stored value is a no-op.
Rejected on a free-trial workspace:
403 { "error": "…", "code": "trial_gateway_locked" }for the whole path (a trial's two gateways are fixed; see the Free-trial gateways are locked note near the top of this page). A caller withoutGATEWAYS_MANAGEreceives a plain403 forbidden.
Getting a gateway
The response carries the gateway row, including purpose (it was previously
omitted here and available only from the tenant listing). purpose is the routing authority:
only production gateways route, so a client that must know whether a gateway can serve a
conversation reads this field rather than guessing from the slug.
Numbers in config are returned exactly as stored. GET /admin/v1/gateways/{id} and the
GET /admin/v1/tenants/{id}/gateways listing write every number in
config with all its digits: a stored 9007199254740991 reads back as 9007199254740991 (not
9007199254741000), and a fraction such as 0.30000000000000004 keeps its precision. Writes keep the
digits too, so a PATCH of an unrelated key never re-rounds a number that is already stored.
Another tenant's gateway looks exactly like a missing one. Every route under
/admin/v1/gateways/{id}/…(and/admin/v1/gateways/{id}itself) answers a gateway id that belongs to another tenant with the same404 { "error": "not found" }as an id that does not exist — same status, same body — so a caller cannot probe which gateway ids exist in other tenants. (Platform admins reach every tenant's gateways and are unaffected.) A caller in the right tenant who lacks the permission for an action still gets403— that refusal does not depend on the id. The probe — like a probe for an unknown id — is still recorded as anaccess.deniedsecurity event with status404; the requested id is visible in the logged request path (stored decoded; see audit path), never as the event's entity.Another tenant's tenant id looks exactly like a missing one. Every route under
/admin/v1/tenants/{id}…answers a tenant id that is not your own tenant with the same404 { "error": "not found" }as an unknown id (platform admins unaffected); a missing permission still gets403. See cross-tenant tenant ids.🔒 Guardrail term/pattern lists are scoped to
GATEWAYS_MANAGE.GET /gateways/{id}and theGET /tenants/{id}/gatewayslisting are gated by gateway/tenant access (any member of the tenant), but the returnedconfig.guardrails(and the legacyconfig.detectorsarray and everyrole_policies[*].guardrails) can hold admin-authored term/pattern lists — acustom_pii/keyword/jailbreakdetector'skeywords, and aregexdetector'scustom_patterns— which may encode sensitive client codenames or an evasion-worthy block list. These value lists are returned in full only to a caller holdingGATEWAYS_MANAGE. A caller with access but notGATEWAYS_MANAGEreceives each detector with itskeywords/custom_patternsreplaced by an empty array (the detector'stype/name/action/target/enabledstay visible, matchingGET /gateways/{id}/detectors). This is a server-side projection — the stored config is unchanged, and the write path (PATCH /gateways/{id}) already requiresGATEWAYS_MANAGE. Masking exemption lists (presidio/pii_protectorallow_list), ajson_schemaschema, and aprompt_guardcontext_promptare a lower-risk class and remain visible.🎬 Video hint (
video_available). On the list route (GET /admin/v1/tenants/<TID>/gateways) only, each row carries a booleanvideo_available:truewhen the gateway'sconfig.video_generation.enabledis exactlytrue(a boolean —"true",1,nullor an absent block count as off, the same test thecreate_videooffer gate uses) and the platform side is ready (thevideo_generation_availablesetting is on, the blob store and the video backend are configured). It is a hint for the web app's Animate button; whethercreate_videois offered on a turn is still decided at dispatch (project tier, the conversation, the client header — see Video generation). Absent from an older backend ⇒false.✂️ Background-removal hint (
remove_background_available). On the same list route only, each row also carries a booleanremove_background_available:truewhen the gateway'sconfig.image_generation.enabledis exactlytrue(the same test theremove_backgroundoffer gate uses) and the platform side is ready (thebackground_removal_availablesetting is on and the background-removal backend is configured). It is a hint for the web app's Remove background button; whetherremove_backgroundis offered on a turn is still decided at dispatch (project tier, the client header — see Image generation). Absent from an older backend ⇒false.🛠️ Agent Builder hint (
can_build). On the same list route only, each row also carries a booleancan_build:truewhen the gateway's resolved configuration lets the model the Agent Builder runs on (Myra's own internal model) be dispatched, using the same dispatch check as the plan, purpose and instruction-tidy routes. It isfalsewhen that check refuses it (for example a provider allowlist withoutmyra, a disabled gateway, a suspended tenant (tenancy switch on), or a plan without the internal model) and also when the gateway's configuration cannot be resolved. The web app's Build tab lists only the access tiers wherecan_buildistrue. It is a hint: the routes themselves still answer403on a blocked tier. Absent from an older backend ⇒ the client treats the tier as not buildable.🔐 Stored form of the secret leaves. The gateway runtime reads
web_search.api_key,semantic_cache.embedding_api_key,webhooks.secret,siemcredentials andtracing.headersin either stored form: plaintext or master-key ciphertext. A leaf that is shaped like a ciphertext but cannot be decrypted is never used as a literal credential and disables only the feature that needs it (web search and the semantic-cache embedder switch off, webhooks and SIEM export stop, tracing loses its headers and OTLP endpoint); the cause is logged without the value, and the playground answers503"the stored web search key could not be read" for web search. Re-save the value to repair it. A secret leaf that is not a string at all (for example a number or object stored aswebhooks.secret) is dropped as malformed and the feature is disabled the same way: it fails closed and is never used as a credential.🔑 Third-party credential leaves are scoped to
GATEWAYS_MANAGE. On the same two access-gated read routes,configalso embeds live secrets. A caller with access but notGATEWAYS_MANAGE(a plain member, aviewer, or the no-logindemouser) receives the config with these withheld:web_search.api_key,semantic_cache.embedding_api_key,webhooks.secret, the entiresiemblock (Splunk HEC token / Basic credentials), andtracing.headers(OTLP auth headers). These are examples of a name-convention rule, not a fixed list: the shared scrubber (utils.secret_keys, the same one the tenant export uses) drops any key — at any nesting depth — named exactlyapi_key/apikey/secret/token/password/passwd/credential/credentials/authorization/bearer, or ending_key/_apikey/_secret/_token/_password/_passwd/_credential, plus the wholesiemandheadersblocks regardless of their inner key names. A newly-added secret-named config field is therefore withheld automatically. The six named leaves are no longer returned to anyone (see the write-only note below); other secret-named fields are still returned in full only to a caller holdingGATEWAYS_MANAGE. Non-secret siblings stay visible (web_search.provider/enabled,webhooks.url,semantic_cache.embedding_url,tracing.otlp_endpoint), and the derivedweb_search_configuredandweb_search_setup_pendingbooleans (below) remain present and correct for every reader (both are computed before this redaction), so a lower-privileged UI still shows whether search is configured — or set up but not yet available — without reading the key. This is a server-side projection — the stored config is unchanged. 🔒 Gateway config secrets are write-only. The six secret leaves of a gatewayconfig—web_search.api_key,semantic_cache.embedding_api_key,webhooks.secret,siem.token/siem.passwordandtracing.headers— are never returned by any read, to any caller, including one holdingGATEWAYS_MANAGE: a boolean<leaf>_settakes their place onGET /admin/v1/gateways/{id}and on the tenant gateways listing (api_key_set,embedding_api_key_set,secret_set,token_set,password_set,headers_set). NoPATCH/POSTresponse and no approval-inbox entry contains the config or any secret (the inbox lists the changed key names only). OnPATCH /gateways/{id}: a leaf that is absent keeps the stored value;""ornullclears it; a non-empty string (fortracing.headers, a non-empty object) replaces it. Fortracing.headers,{}is a clear like""andnull: the headers are removed and nothing is recorded as a secret change when neither the stored nor the sent side held any. Any othertracing.headersvalue (a string, an array, an object with a bad header) is always validated and answers400invalid_tracing_headers, whatever is stored. Whitespace-only is400invalid_config, a non-string leaf is400invalid_config, and a<leaf>_setflag must be a boolean (it is read-only and ignored). The two SIEM leaves answer the SIEM code family on this route too, the same codes as the tenantsiemwrite: a badsiem.token/siem.passwordorsiem.*_setvalue is400invalid_siem(notinvalid_config), withfieldnaming it. A kept leaf stays bound to its target: changingweb_search.provider,semantic_cache.embedding_url,webhooks.url,tracing.otlp_endpointorsiem.url(same type) while omitting the leaf is400config_credential_required(siem_credential_requiredfor the SIEM leaves) withfieldnaming<section>.<leaf>; re-enter the secret or send""to store none. Changingsiem.typekeeps nothing (the stored secret is not carried to the new type).POST /tenants/{id}/gatewaysreplaces the whole config and never keeps: a leaf you do not send is stored empty, and<leaf>_set: truewithout the leaf is400. A change held for four-eyes approval carries only the delta; kept leaves are resolved when it is applied. Staleness: the kept bytes come from the config read at the start of thePATCH; concurrent writers are not merged, the last writer wins. A change applied through approval records secret changes by presence and bytes only: a held identical re-send of a secret is not named as a rotation. The six secret leaves are encrypted at rest: every write path (PATCH,POST, an applied approval, the portal settings) seals a new value before it is stored, andtracing.headersis stored as one encrypted value.tracing.headersis capped at 8192 bytes of JSON; a larger object is400invalid_tracing_headers. A value that was saved before encryption was introduced stays readable and is encrypted the next time it is replaced.
Updating gateway config
The PATCH body carries a config key (an absent or null config is a harmless no-op that returns 200 { "ok": true }). The config is merged at the top level — only fields you include are changed. Nested objects (rate_limit) are replaced in full. The merge is made on the configuration as it is stored at the moment of the write (the gateway is locked for it), so a field another administrator changed while your request was on its way is kept, not overwritten with the value you read before. Under config approval the guardrail keys (guardrails, detectors, role_policies, pii_thresholds, egress_guard, eu_region_routing, provider_allowlist_enforced, provider_allowlist) and provider_base_urls are checked again at that moment: when your body names one of them with the value you read, but another change (for example an approved request) set a different value in between, your save would change it back without an approval. The PATCH then answers 409 { "error": "the gateway's settings changed meanwhile; reload them and save again", "code": "config_changed", "field": "config.guardrails" } (field names the first such key) and nothing is written; reload the gateway and save again. This applies only when your change would have been held for approval (four-eyes on and you hold GATEWAYS_MANAGE); a platform administrator, or any administrator while config approval is off, gets the merge described above. To decide this, a PATCH from anyone but a platform administrator whose body names one of these keys reads your permissions and the organisation's config-approval switch; when either cannot be read it answers 503 { "error": "approval gate unavailable" } and nothing is written (send it again).
web_search.provider is validated on create and on PATCH. When the body carries a config.web_search object with a provider, it must be exactly "brave" or "linkup" (case-insensitive; the stored value is lower-case). Anything else — an unknown provider ("google"), a value with surrounding whitespace, an empty string, a number, boolean, object or array — is rejected with HTTP 400 { "error": "web_search.provider must be one of: brave, linkup", "code": "web_search_provider_unknown", "allowed": ["brave", "linkup"] } and nothing is written. Omit provider (or send JSON null) to inherit the tenant default, else brave. This applies to POST /tenants/{id}/gateways as well.
web_search.enabled and web_search.mode are validated too. enabled must be a JSON boolean when present: true or false, with null or absent accepted and stored as sent. A string ("0", "1", "true"), a number, an object or an array is rejected with HTTP 400 { "error": "web_search.enabled must be true or false", "code": "invalid_web_search", "field": "web_search.enabled" }. mode must be exactly "opt-in" or "always" (case-sensitive; null or absent accepted): anything else, including "ALWAYS", a number, boolean, object or array, is rejected with 400 { "error": "web_search.mode must be one of: opt-in, always", "code": "invalid_web_search", "field": "web_search.mode", "allowed": ["opt-in", "always"] }. When both are malformed, enabled is reported first. Nothing is written on a refusal, on POST /tenants/{id}/gateways and on PATCH /gateways/{id} alike. On the read side only a stored enabled: true switches web search on; a legacy stored non-boolean enabled reads as off (web_search_configured and web_search_setup_pending are both false) and the gateway logs a warning, and a stored unrecognised mode behaves as "opt-in".
web_search itself must be an object. A config.web_search that is present, not JSON null, and not an object — an array ([], ["x"]), string, number or boolean — is rejected with HTTP 400 { "error": "web_search must be an object", "code": "invalid_web_search" } (formerly web_search_invalid) on create and PATCH, and nothing is written (it would otherwise be stored and read as "no web search block"). Send null to clear the block.
test_headers_allowed is platform-admin-only. On a PATCH by any actor below platform admin (a tenant admin, or a custom role holding GATEWAYS_MANAGE) the submitted value is ignored and the stored value kept — a tenant admin can neither arm nor disarm the gateway — and the 200 body is { "ok": true, "ignored_fields": ["test_headers_allowed"] } when the dropped value differed from the stored one; omitting the field or re-sending the stored value is a plain { "ok": true }. A platform admin's value is applied; a platform admin's non-boolean value that differs from the stored one is 400. See the field's row in the config reference.
laya_routing is platform-admin-only. config.laya_routing selects the per-gateway complexity-routing mode for Auto turns: off, shadow (the verdict is only logged) or live (a hard turn is upgraded to a frontier model, see x-aig-auto-complexity). It follows the same rule as test_headers_allowed, on create/replace and on PATCH: a value from an actor below platform admin is ignored, the stored value is kept, and ignored_fields contains "laya_routing" when the dropped value differed. A platform admin may send one of the three strings, or null to clear it (= off). Any other value that differs from the stored one is 400 { "error": "laya_routing must be one of: off, shadow, live" }, and nothing is written.
curl -X PATCH https://<your-gateway-host>/admin/v1/gateways/{id} \
-H "Content-Type: application/json" \
-d '{
"config": {
"retry_count": 3,
"timeout_ms": 45000
}
}'
To override provider base URLs:
curl -X PATCH https://<your-gateway-host>/admin/v1/gateways/{id} \
-H "Content-Type: application/json" \
-d '{
"config": {
"provider_base_urls": {
"openai": "https://my-openai-proxy.internal"
}
}
}'
Accepted / rejected shape. provider_base_urls is validated at the write
boundary on both POST and PATCH:
- Accepted: an object mapping supported provider slugs to non-empty
http://orhttps://URLs (a base only — the provider path is appended; trailing/characters on the base are ignored).null(or an object with no entries) is accepted and clears the override. - Rejected with
400: a non-object (scalar / array); an unsupported provider key — one that is not a provider the gateway can route to (… is not a supported provider), or a legacy alias such asvllm, which is rejected with a message naming its canonical id (provider_base_urls['vllm'] is a legacy alias; use 'myra'); a non-string or empty-string value; a URL that is nothttp(s)://…; a URL carrying userinfo (https://user@host/); or a URL containing whitespace or control bytes. A malformed value is rejected, never silently treated as absent — so a broken override can no longer be saved and then silently fail to route. (An override keyed by a provider the gateway does not route to is dead config: it is looked up at request time by the exact provider name, so an unknown key never routes — hence the rejection. Note:provider_allowlistaccepts thevllmalias and folds it tomyra; the base-URL map does not, because its key is looked up verbatim.)
The same shape rule applies to azure_endpoint and hf_endpoint (the tenant-chosen Azure OpenAI /
Hugging Face endpoint URLs): absent or null is accepted (no custom endpoint); any other value must
be a non-empty http(s):// URL without userinfo, whitespace or control bytes — otherwise 400
(azure_endpoint must …). At request time a null endpoint means the provider's default endpoint;
a malformed stored one fails the request with configuration_error instead of falling back.
azure_resource (a bare resource name; accepted when absent / null at save, but required for provider azure: absent / null / "" at request time answers configuration_error and nothing is sent upstream), azure_deployment (absent / null, or a
single path segment) and azure_api_version (absent / null,
or a version token of letters, digits, . and -, at most 32 characters) are checked on save with
the same rules the request path applies; anything else is a 400. The azure_endpoint and
hf_endpoint URLs are dialled through the SSRF guard (resolved once, dial pinned, private/internal addresses refused) on every
path, including the conversation-summary route.
Where an override applies. provider_base_urls is read by every outbound leg for that provider: inference turns, the Files API upload (POST /chat/files, provider_base_urls.anthropic) and the conversation summary (POST /conversations/{id}/summarize). The override swaps the host and keeps the provider's own path. On a gateway with eu_region_routing enforced, an anthropic override does not make Anthropic EU-vouched: the Files API upload and the summary are refused with 403 data_residency_blocked, as an inference turn is, before anything is dialled. Each leg dials it through the same SSRF guard, and a malformed or private-resolving override answers configuration_error instead of falling back to the default host: 500 on an inference turn, 502 on the Files API upload and the summary.
Credentials sent to an override. A request routed through any of these overrides carries only
the API key stored on this gateway for that provider. Platform credentials are never sent there:
a myra override receives requests with no Authorization header (the fleet's shared token
goes only to Myra's own fleet endpoint; an override equal to the fleet's origin is the fleet itself), and a gateway that overrides anthropic cannot use
Myra-provided (Platform Key) models — they are not offered, and a direct request without an own
key is refused (424) without Myra's key ever being read. Every change of provider_base_urls, azure_endpoint, azure_resource or hf_endpoint is audited (gateway.endpoint_config_changed,
origin-only — see Audit log).
This is a shape check only. The full SSRF/security check (host resolution + dial-IP pinning)
runs at request time: a saved override that resolves to a private/internal address is still
blocked when traffic is sent (configuration_error). Use
Test a provider base URL as the pre-save reachability check.
💡 Note: The
configmerge is shallow. To clear a nested object (e.g. to remove a rate limit or the base-URL overrides), set the field tonullexplicitly:"rate_limit": null,"provider_base_urls": null.
Built-in sources (source_policy)
config.source_policy sets the source policy of the gateway's three built-in sources: web_search (the web search tool), web_pages (fetch_url and the agentic reader agentic_fetch) and knowledge_files (search_knowledge and read_file). Each has a trust class and optional cell overrides, as a connector does:
{ "config": { "source_policy": { "builtins": {
"web_search": { "trust": "external" },
"web_pages": { "trust": "external", "pii": { "delivery": "approval_1" } },
"knowledge_files": { "trust": "internal" } } } } }
- Default. A group the gateway does not set is
external(mask both ways, personal data stays off external channels), which is what every gateway did before. - Accepted shape.
source_policy(an object, never an array) has onlybuiltins(an object); its keys are the three groups; each value hastrust(internal,externaloruntrusted; absent =external),piiand / orkeywordswith the source levels.nullclears it. - Rejected (
400 invalid_config,field: "source_policy"). An unknown key, group, trust class or level;web_searchorweb_pageswithtrust: "internal"(the web is never an internal system). An explicit cell below the organisation's minimum for every source →400 source_policy_below_floornaming the cell (config.source_policy.builtins.web_pages.pii.delivery) and the floor. - Lowering needs approval. A
PATCHthat makes any cell looser than stored (for exampleweb_pagesfrom Internal channels only to Deliver everywhere, orknowledge_filesfromexternaltointernal) is held for a second person under config approval even when your organisation has not turned config approval on:202 { "status": "pending_approval", "approval_id", "cause": "source_policy_lowered", "field": "config.source_policy.builtins.web_pages.pii.delivery" }, and the stored setting stays in force until approved. The approval re-checks the held value against the current floor. A tightening saves at once. The check is made again on the stored setting at the moment of the write: when another change saved in between turns your body into a lowering (for example someone tightenedweb_pagesto Block while your tightening to Approval by one person was on its way), thePATCHanswers409 { "code": "source_policy_changed", "field": "config.source_policy.builtins.web_pages.pii.delivery" }and nothing is written; reload the gateway and save again. A platform administrator applies a lowering directly. When the approval is applied, the gateway's built-in sources must still be the ones the request was made against, otherwise it endsapply_failedwith reasonsource_policy_stale(submit a new request).POST /admin/v1/tenants/{id}/gateways(create or replace) with a lowering answers409 source_policy_needs_approval; change it withPATCH. A replace whoseconfigleavessource_policyout deletes the stored one, so it counts as a lowering too. - Audit. Every change is part of the
gateway.config_changedrow (source_policybefore and after). - Enforcement.
pii.deliverydecides the delivery disposition of a run that took personal data from that source.pii.inputapplies to theweb_searchquery and theweb_pagesaddress (allow: masked values restored, the protected-identifier refusal skipped, read asmaskunder a PII mandate;mask: unchanged;block: a query or address carrying personal data is refused on every gateway,guardrail_input:pii);knowledge_filessends nothing out, so itspii.inputandkeywords.inputhave no effect.pii.result: allowskips the PII maskers on that source's results, never under a PII mandate (a pageagentic_fetchreads in windows is always masked). The gateway's own keyword / regex detectors give the default of the keyword cells (block → block / withhold; scrub or flag → flag); a stricter cell refuses or withholds every match (guardrail_input:keywords),flaglogs a blocking detector's match,allowskips the detectors. A gateway configuration that cannot be read holds every source to its strictest cells. Details: Guardrails — Sources and trust classes.
Gateway config audit
Gateway config writes are audited (see Audit log). POST /tenants/{id}/gateways and PATCH /gateways/{id} write one gateway.config_changed row after the change is stored, when it altered the guardrail-relevant part of the config; the guardrail-config import (POST /gateways/{id}/guardrail-config/import) writes the same diff under the action guardrail_config.import. The entity is the gateway, tenant_id is the gateway's tenant, and gateway_id is set.
before / after contain only the keys that changed, drawn from this view:
log_payloads—"default",trueorfalse.detectors[<key>]— one entry per detector. The key is<carrier>:<percent-escaped name>@<n>(for exampleguardrails:kw@1;@ndisambiguates duplicate names), or<carrier>#<index>for an unnamed detector. The summary is{type, enabled, action, fail_open, target, keyword_count, fields_changed};fail_openistrue,falseor"<absent>". An added detector hasbefore: null, a removed oneafter: null.role_policies[<role>]—{models, detector_count};modelsis the sorted model-id list or"<absent>".source_policy— the built-in sources' policy as stored (trust classes and levels only), ornull.secrets[<section>.<leaf>]— one entry per write-only secret leaf (web_search.api_key,semantic_cache.embedding_api_key,webhooks.secret,siem.token,siem.password,tracing.headers; see the write-only note above the PATCH route). The value is never recorded, only a marker:"(previous value)"inbeforeand"(new value)"inafter, andnullon the side where the leaf was unset. A change to a secret alone (nothing else in this view) still writes agateway.config_changedrow. A leaf that is supplied counts as changed even when it is identical to the stored one, because that is a rotation; a kept (omitted) leaf is not a change. No value, hash or length is ever written.
Keywords, patterns and regular expressions are never stored: only keyword_count and the names of changed fields (fields_changed). A PATCH that changes nothing in this view writes no row; a guardrail import that changes only keys outside it writes a row whose before / after are empty. A change made while impersonating a user is attributed to the impersonator (after.impersonated_user_id).
Webhook destination policy
config.webhooks (see config reference › webhooks) tells the gateway where to
POST its event webhooks. Because the gateway itself makes that request, the destination is checked on save
(POST /tenants/{id}/gateways and PATCH /gateways/{id}) and again on every send — a host name can point
somewhere else after it was saved.
Accepted webhooks value. Absent (no change), null (clears the webhook), or an object whose url is a
string (or absent / null / "" = no webhook), secret a string (or absent / null), events an array (or
absent / null). Re-sending the unchanged stored value is always accepted without any check, so saving an
unrelated setting never fails because of an older stored webhook (the send-time check below still applies to it).
Accepted url:
- at most 2048 bytes, no whitespace, no control characters, and no
#or\anywhere; - starts with exactly
https://(lower-case); - the host is a public DNS name: at least two labels of letters, digits and
-(no leading or trailing-, no_), each at most 63 characters, at most 253 in total; the last label is not all digits; notlocalhostor*.localhost; compared case-insensitively; - an optional port:
443, or1024–65535, written without a leading zero (no port =443); - any path and query.
Rejected on save:
| Answer | code |
When |
|---|---|---|
400 |
invalid_webhooks (formerly webhook_config_invalid) |
webhooks is not an object (a string, number, boolean or array); url or secret is not a string; events is not an array. Checked for every field, whether or not url is set. |
400 |
webhook_url_rejected |
The URL breaks the shape above: http:// or any other scheme; user name / password (https://user@host/); an IP address as host in any spelling — https://127.0.0.1/, https://[::1]/, https://[::ffff:127.0.0.1]/, decimal https://2130706433/, octal https://0177.0.0.1/, hex https://0x7f000001/, short https://127.1/; localhost; a single-label host; a trailing dot; a port below 1024 other than 443 (22, 25, 80 …), 0, above 65535, with a leading zero or not a number; #, \, whitespace or control characters. The error text names the rule. |
400 |
webhook_url_not_public |
The host does not resolve to a public address: any of its IPv4/IPv6 addresses is internal (below), or the name does not exist. One fixed message for both cases. |
503 |
webhook_url_unverifiable |
The name could not be looked up right now (DNS timeout or server failure), or the platform's egress settings could not be read. Nothing was saved — try again. |
Internal addresses (never a webhook destination): 0.0.0.0/8, loopback 127.0.0.0/8, RFC 1918
(10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), CGNAT 100.64.0.0/10, link-local incl. cloud metadata
169.254.0.0/16 (169.254.169.254), multicast / reserved / broadcast 224.0.0.0–255.255.255.255; IPv6
::, ::1 and the whole ::/96, unique-local fc00::/7, link-local fe80::/10, site-local fec0::/10, multicast
ff00::/8, local-use NAT64 64:ff9b:1::/48; the special-purpose IPv4 ranges 192.0.0.0/24, 192.88.99.0/24 and
198.18.0.0/15; IPv4 addresses wrapped in IPv6 — IPv4-mapped ::ffff:a.b.c.d, SIIT ::ffff:0:a.b.c.d, NAT64
64:ff9b::a.b.c.d, 6to4 2002:aabb:ccdd:: — are judged by the IPv4 address they carry; plus every range in the
operator's egress denylist (platform setting siem_egress_deny_cidrs, shared with SIEM targets). If
one address of a name is internal, the whole name is refused (no picking the public one). (The full list of refused ranges — including documentation, benchmarking, AS112/AMT, cloud-metadata and everything outside global unicast 2000::/3 — is in Outbound address validation. The operator denylist holds IPv4 ranges only.)
On every send. The gateway resolves the host again, applies the same rules to every address, and connects to
the one address it checked (TLS certificate and Host header still use the host name — no second lookup). It does
not follow redirects: a 3xx answer counts as a failed delivery. The POST is bounded: 5 seconds per connect / send /
read step and 10 seconds overall for the answer (the name lookup before it can add a few seconds on a slow resolver);
the answer body is read up to 64 KiB (only the status counts). A stored URL that fails the shape
rules, resolves to an internal address, does not resolve, or cannot be looked up is not sent: the gateway logs
a warning naming the gateway and tenant (webhook: destination refused … gateway=<id> tenant=<id>, the tenant is -
for circuit_open) and records it in the delivery-fault triage queue (error_class egress_refused, or
egress_unverifiable for a failed lookup). Such an event is not retried.
Testing against a local receiver (development only). The platform setting
webhook_allow_loopback_receiver lets a development deployment deliver to
http://127.0.0.1:<1024–65535> (or https://). It cannot be switched on anywhere else (409), and it is ignored
outside development even if the database row exists. It relaxes nothing else.
Trace-export destination (tracing.otlp_endpoint)
config.tracing.otlp_endpoint follows the same destination policy as the webhook URL above: a public https:// host name, the same internal-address list, the same resolve-and-pin on every send (the gateway also appends /v1/traces, so the full URL is what is checked; a query or fragment is refused). Verified addresses are cached for 30 seconds per worker. Refused sends are logged and recorded in the delivery-fault triage queue at most once per minute per gateway. An unchanged stored value is accepted on an unrelated save; null and "" clear it. Details: Tracing.
Rejected on save (POST /tenants/{id}/gateways, PATCH /gateways/{id}):
| Answer | code |
When |
|---|---|---|
400 |
invalid_tracing (formerly tracing_config_invalid) |
tracing is not an object (a string, number, boolean or array). |
400 |
invalid_tracing_headers (formerly tracing_headers_invalid) |
tracing.headers is not an object, has more than 32 entries, a name that is not an HTTP header name, or a value that is not a string, is longer than 4096 bytes, or contains control characters, or a name the gateway controls (Host, Content-Length, Transfer-Encoding, Connection, Content-Type, User-Agent; any letter case). |
400 |
otlp_endpoint_rejected |
otlp_endpoint is not a string, or breaks the URL shape rules (not https://, an IP address as host, localhost, a single-label host, user name / password, a query or fragment, a bad port, control characters, or longer than the limit). The error text names the rule. |
400 |
otlp_endpoint_not_public |
The host does not resolve to a public address, or the name does not exist. One fixed message for both. |
503 |
otlp_endpoint_unverifiable |
The name could not be looked up right now. Nothing was saved. Try again. |
Test a provider base URL
The pre-save reachability check behind the Test button in Gateway settings › General.
Requires GATEWAYS_MANAGE. Rate-limited per actor (20 requests / 60s; over the limit → 429)
and audited (provider_base_url.test). The gateway resolves the URL through the same SSRF guard
applied to every override at request time — the dial IP is pinned, SNI + Host stay the URL
hostname — then makes one short GET and reports the outcome.
curl -X POST https://<your-gateway-host>/admin/v1/providers/test-base-url \
-H "Content-Type: application/json" \
-d '{ "provider": "openai", "url": "https://my-openai-proxy.internal" }'
400— theurlis not a well-formedhttp(s)://base URL (same shape rules as the save boundary above). Nothing is dialed.200 { "ok": true, "status": <http-status>, "latency_ms": <n> }— the endpoint answered (any HTTP status, e.g.401/404from a base path, counts as reachable + TLS-valid).200 { "ok": false, "reason": "blocked", "detail": "…" }— the URL resolves to a private/internal address or could not be resolved (it would be blocked at request time too).200 { "ok": false, "reason": "unreachable", "latency_ms": <n>, "detail": "…" }— the connection failed (connect/read error).
🔒
config.siem— the second SIEM write door. A gateway'sconfig.siemis an egress target resolved in preference to the tenant'ssiem. It is tenant-admin-settable (atenant_adminwithGATEWAYS_MANAGE) on bothPATCH /gateways/{id}andPOST /tenants/{id}/gateways, and is validated against the same schema and egress rules assiem(malformed, a malformed host name or a denied egress target →400invalid_siem, before any DNS query). The SSRF control is the egress validator (fail-closed + Myra denylist), not an admin wall. An unchanged echo of the storedconfig.siem(what aGATEWAYS_MANAGESPA re-sends on a shallow-merge save) is a200no-op.
EU data-residency config (input validation)
eu_region_routing also has a direct toggle in the admin UI — see
Gateway settings › EU routing — in addition to the
guardrail-template Target Controls path (which was moved out of being template-only).
Both paths write the same field; the floor semantics below apply identically either way.
The residency fields are validated at the trust boundary and fail closed:
eu_region_routing— a JSON boolean (true/false). Absent ornullis accepted and means "inherit". Any other present value ("true",1, an object, a string) is rejected onPOST /tenants/{id}/gateways,PATCH /gateways/{id}and the guardrail-config import with400and an error that names the field (the offending value is not echoed). A legacy value stored before this check is folded three ways at config load: recognized-ON (true,1,"true","yes","on") → enforced; recognized-OFF (false,0,"false","no","off") → off; unrecognized → off plus a logged warning (the stored value is escaped in the log) — unless the tenant floor forces it on. An unchanged legacy value echoed back onPOST /tenants/{id}/gateways(existing slug),PATCH /gateways/{id}or the guardrail-config import is accepted (grandfathered); only a changed non-boolean is refused. The guardrail-config export writes the effective boolean (unrecognized →false), so an exported file always imports. The tenant export is a snapshot: it keeps the tenant's storedeu_region_routingfloor and the gateway configs exactly as stored. Re-posting a legacy non-boolean gateway flag into a new gateway is therefore rejected with400; re-import a gateway config through the guardrail-config import, which normalises it. On a trial tenant the trial lock / storage error onPATCH /gateways/{id}is answered before the flag shape check, so a locked edit is403even when a residency flag in the same body is malformed.bedrock_region/vertex_region— region tokens are trimmed and must match^[a-z0-9-]+$(≤32 chars); anything with whitespace-in-the-middle, CR/LF, uppercase,/, or control bytes is rejected as unset. They choose the endpoint only: undereu_region_routingBedrock and Vertex are refused in every region (US-owned clouds), as is any provider with aprovider_base_urlsoverride —403 data_residency_blockedbefore any upstream call (see Data residency). Anazure_regionkey is ignored.
Transfer safeguard config (input validation)
transfer_safeguards_required (GDPR Art. 44–46; see Transfer safeguard)
is a residency security flag of the gateway config. Accepted on POST /gateways, PATCH /gateways/{id} and the
guardrail-config import: a JSON boolean, absent, or null. Rejected: any other value ("true", 1, an object) —
400 naming the field, the value is not echoed; an unchanged stored value echoed back is accepted. With the flag
on, a request to a provider that is not EU-owned answers 403 { "code": "transfer_safeguard_required" } while
the gateway has no enabled request-phase general-PII scrubber (pii_protector, presidio scrub/block), or when
that scrubber could not run on the request; the model-offer profile (offer_restricted,
offerable_providers) drops those providers in the same state. Changing it is four-eyes gated like the other
residency flags.
Provider allowlist (no silent fallback)
An explicit per-gateway list of approved model providers. It is orthogonal to data residency: residency asks "is this provider EU-owned?"; the allowlist asks "did the operator approve this provider at all?" — a provider can be EU-hosted yet still not approved for a given gateway. Enforced at the single upstream dispatch chokepoint, so no attempt — primary, fallback, tool-loop leg, summarization, or agentic fetch — can silently route to a provider outside the list.
provider_allowlist_enforced— a JSON boolean. Likeeu_region_routing, it is a security control: absent ornullis accepted, any other non-boolean is rejected with400naming the field on POST, PATCH and import. A legacy stored value folds the same three ways aseu_region_routing(recognized-ON → enforced, recognized-OFF → off, unrecognized → off plus a logged warning, unless the tenant floor forces it on); an unchanged echo is accepted and the export writes the effective boolean. Default off — every existing gateway is unaffected. Enforcement can also be turned on deployment-wide by your operator (the sovereign-stack backstop): when it is, every gateway must carry a valid allowlist or its inference fails closed, regardless of per-gateway configuration.-
provider_allowlist— a JSON array of provider names (e.g.["myra", "mistral"]). Names are matched case-insensitively after trimming surrounding whitespace, andvllmfolds tomyra. Accepted: a non-empty array of strings; a requested model whose resolved provider is a member is dispatched. Rejected (fails closed —403 provider_not_allowed, before any upstream call): a resolved provider not in the array; and, when enforcement is on, a missing / empty ([]) / malformed (non-array) list denies every provider (a forgotten or typo'd list can never silently fall back to allow-all). Non-string array elements (numbers,null, nested objects) are ignored and can never widen the set; a near-miss or substring of an approved name ("open"foropenai) never matches. When enforcement is off the list is not consulted.Validated on write. The same rules as the tenant list apply (an array of at most 64 non-empty strings, each a registered provider; duplicates are accepted). They are checked on
PATCH /admin/v1/gateways/{id},POST /admin/v1/tenants/{id}/gateways, the guardrail-config import and dry-run, and when a four-eyes approval applies a storedPATCHor import. A bad value is refused with400 { "error": "…", "code": "invalid_config", "field": "provider_allowlist" }(import and dry-run:400 { "error": "…" }); the error text never echoes the submitted value beyond a short, printable-ASCII excerpt, and nothing is persisted.nullclears the gateway's own list. OnPATCHan absent key leaves it unchanged, while on import and onPOST(both declarative replaces) an absent key removes it.[]is accepted (deny all while enforcement is on). A value identical to what the gateway already stores is accepted unchanged, so an export re-imported verbatim never fails on a legacy list. The "non-string elements are ignored" rule above therefore only matters for legacy values stored before this validation existed.
Scope: the allowlist governs routed chat/inference dispatch. Fixed EU-infrastructure services that call the Myra on-prem fleet directly — embeddings (RAG), image generation/editing, transcription, and vision image-analysis — always use that sovereign fleet and are not routable providers, so they are not gated by this list.
Tenant-level residency default (inherited by every gateway)
eu_region_routing, provider_allowlist_enforced, and provider_allowlist can also be
set once at the tenant level so that every gateway under the tenant — including a
newly created gateway with an empty config — inherits the control, fail-closed.
eu_region_routing is accepted on PATCH /admin/v1/tenants/{id}:
| Field | Shape | Notes |
|---|---|---|
eu_region_routing |
0 \| 1 \| null |
The organisation-wide EU-routing floor. 1 arms it (every gateway of this organisation is EU-only regardless of its own setting); 0 records an explicit "not enforced"; null clears the column back to "no organisation default", which is a distinct third state. An opt-in, off by default: null and 0 both leave every configured provider usable. Settable by a platform admin and by the organisation's own tenant admin; any other caller that tries to change it (e.g. a custom-role holder of TENANT_SETTINGS_MANAGE) gets 403 { "error": "eu_region_routing can be changed only by a tenant admin or a platform admin", "code": "tenant_admin_only", "field": "eu_region_routing" } — also when its value is malformed (the refusal comes before the format check); its unchanged echo is a 200 no-op. A tenant admin's change is four-eyes-tracked: with config approval on, it is held (202 pending_approval) and applied when a second administrator approves; a platform admin's change applies at once. Strictly typed: only a real JSON number 0/1 or null is accepted; a string ("1"), boolean, any other number, an empty string or an object is refused 400 { "error": "eu_region_routing must be 0, 1 or null", "code": "invalid_field", "field": "eu_region_routing" } rather than coerced, and nothing is written or held. Re-sending the stored value (including null while nothing is stored) is a 200 no-op: no write, no audit row, no approval. Audited as tenant.eu_region_routing_changed (before/after; an unset floor is absent from the object), and the gateway-config cache is flushed for every gateway of the tenant so the change takes effect immediately rather than after the cache TTL. |
| how a sovereign tenant gets "EU-region routing default ON" on a shared stack without | ||
| a deployment-wide setting (which would affect every tenant). See | ||
| Tenant-level residency default. |
- DB/migration only: the tenant defaults live in tenant columns and are not
exposed as an admin API / PATCH field — set them via a migration or a
db.shUPDATE. When writingtenant.provider_allowlist, mind the quoting: the value must be SQLNULLor a valid JSON array ('["myra","mistral"]'— the entry quotes are part of the stored bytes). The database rejects anything else (CHECKconstraintchk_tenant_provider_allowlist_json, migration 0190): a mis-quoted bare-token'[myra,mistral]', a JSON object/scalar, or a literal'null'all fail the write instead of silently bricking the tenant (a malformed stored list fails closed — deny-all — while enforced). A pre-constraint row that still carries a non-array value is treated as absent and logged at ERROR level with the tenant slug. - Precedence — a FLOOR: when a tenant enables a residency enforcement control
(
eu_region_routing/provider_allowlist_enforced) it is a floor — a gateway can only raise it, never lower it. A gatewayfalse/0/"off"under a EU-only tenant is still enforced (it cannot opt a sovereign tenant out of EU-only routing). The gateway may be stricter, and a gateway's own value governs only when the tenant default is a recognized OFF. A garbage tenant value fails closed to ENFORCED. For a residency control an absent/nullper-gateway value resolves to the tenant default (the safe ON under a floor). The tenantprovider_allowlistis a contents floor too: a gateway without its own list inherits it, and a gateway's own list under an armed tenant is intersected with the tenant list (it can only narrow it; a missing/malformed tenant list intersects to empty → deny all). - Admin view caveat: gateway GET/PATCH returns the raw per-gateway config, so an inheriting gateway shows these keys absent even though enforcement is active at runtime — read the tenant default to know the effective policy.
Deleting a gateway
Refused with 409 gateway_in_use_by_department (body lists departments and projects) while a department allows the gateway or uses it as its default, or a project is locked to it — remove it there first (a silent delete would shrink a department's set, possibly to "allows nothing", or brick a locked project).
Response 200 { "ok": true }. The delete is one transaction: the gateway row goes and
the database cascade takes what hangs off it — API keys and their revocation tombstones,
provider keys, routing rules, conversations, agents, schedules, workflows — and the gateway's
own spend ledger rows (the gateway scope and its current API keys' token scope, all
periods) are swept in the same transaction. The gateway's human-review records (review_item) are not removed: they are decision evidence and are kept 730 days (see Purging a tenant); the held tool call they carry (its exact arguments) is erased in the same transaction, and the rows are no longer listed and can no longer be decided. A key deleted or revoked before the gateway
leaves its own token-scope rows behind (the key's id is gone from the table by then) — the boot
pass below reaps those. The tenant's and its users' spend rows are
untouched. The delete locks the gateway row before it reads the key ids, so a key minted
on this site while the delete runs is either swept with the rest or refused (its insert waits
for the lock and fails once the gateway is gone) — never cascaded and left in the ledger. Rows
can still appear afterwards: a request that was still running when the
gateway was deleted books its cost after it finishes, and on a multi-site deployment a
sibling site keeps accepting the gateway's API keys for its configuration / key cache lifetime
(minutes) and books those requests too. Those rows are reporting noise, never an enforcement
input. At every boot the gateway reaps ledger rows whose gateway or API key no longer exists
— the rows stranded by deletes that ran before this behaviour, and the late rows above — in
bounded batches on one worker, off the request path (the log line
[ledger_orphan_sweep] pass done gateway_rows=N token_rows=M; a healthy fleet reads 0 0).
The delete itself does not depend on the boot pass.
Stored replay records. After the delete is committed, the gateway also removes the gateway's stored turn-replay records, outside the delete transaction and in at most 4 bounded batches. If this purge is cut short or fails, the hourly replay reaper removes the remaining records later; a purge fault never changes the 200 answer. The delete is audited as gateway.deleted, with replay_records_deleted, replay_purge_truncated and replay_purge_failed in the record.
Requires the GATEWAYS_MANAGE permission (held by a tenant admin by default, and any custom role granted it) plus ownership of the gateway.
Rejected: 403 forbidden (missing GATEWAYS_MANAGE); 403 { "error": "…", "code": "trial_gateway_locked" } (the tenant is on the free-trial plan — the two fixed trial gateways cannot be deleted until you upgrade to a paid plan; see the Free-trial gateways are locked note near the top of this page); 404 not found (no such gateway, or a gateway of another tenant — indistinguishable by design — also
when it vanished between the access check and the delete: nothing changed); 503 temporarily
unavailable; retry later when the delete kept colliding with a concurrent change to the same
API keys (a revoke, an edit, a new key) after its retries, or at once when another writer has
held a row the delete needs for the database's lock-wait timeout (another delete of the same
gateway in progress — the retry then finds a 404; a request still persisting a turn on this
gateway) — nothing changed, retry; 500 internal error on any other database fault, rolled
back — the gateway and its ledger rows stay together, and the gateway log carries the cause
(if the COMMIT's answer was lost on the wire the delete may have landed; a retry then answers
404).
Bounds. The delete runs under a 120 s statement timeout (not the 10 s the rest of the API
uses) because the cascade of a busy chat gateway can take a while; a cascade that outlasts even
that is rolled back and answered 500 — nothing is half-deleted; contact support for a gateway
that large. A client that disconnects while the delete runs does not interrupt it: the delete
completes and only the response is lost (the next GET answers 404).
Ledger sweeps never wait on another tenant's spend. Both ledger sweeps — the delete's token
scope and the boot pass — remove the rows one key at a time, one point statement per key id, which
lock only that key's own rows (and the gap after them), so they never wait on another tenant's in-flight (uncommitted)
spend write, which a single multi-key statement could (it can scan the whole ledger on a small
table and stall into the database's lock-wait timeout, answered 503). The cost is one small
statement per key — a gateway with N keys issues N, and a boot-pass batch of up to 500 orphan
ids issues up to 500 — and it must not be re-batched into a multi-key statement.
Resetting the gateway budget counter
Clears the accumulated spend counter. Requests blocked by quota_exceeded are allowed again (up to the configured budget_usd). The optional ?period= query parameter scopes the reset to one period; without it, every period is reset. A repeated ?period= (a ?period=a&period=b) is rejected 400 — it is not coerced.
🔒 Platform-admin only. Because zeroing the ledger re-opens the per-gateway cap (and, via the tenant reset, the platform-set
platform_cap_usdceiling), only a platform admin may reset spend — atenant_admin, or a member holding a custom role that grantsGATEWAYS_MANAGE/TENANT_SETTINGS_MANAGE, receives403 Forbidden(the ledger is untouched). This subsumes the earlier free-trial-only lock. Every successful reset writes an audit record (gateway.budget_reset) carrying the actor and the pre-reset per-periodamount_micro; a storage fault that wrote nothing (a transient conflict, no database connection) returns503 { "error": "temporarily unavailable; retry later" }(retry), any other the sanitised500 { "error": "internal error", "request_id": "…" }(re-read the spend before repeating) — never a silent200.
curl -X DELETE https://<your-gateway-host>/admin/v1/gateways/{id}/budget
curl -X DELETE 'https://<your-gateway-host>/admin/v1/gateways/{id}/budget?period=2026-05'
⚠️ Caution: Budget resets are immediate and irreversible. Automate monthly resets with a cron job rather than resetting manually.
Reading gateway spend history
Returns the most recent limit rows (default 12, capped at 120; anything but a plain integer ≥ 1 is 400 {"code": "invalid_limit"}) of recorded spend, with amount_micro (raw integer micro-USD) and amount_usd (decimal) per period.
Reading gateway budget status
Returns the budget-focus data for the gateway's current period (the period type is the gateway's own budget_period, default monthly):
{
"cap_usd": 500.0,
"spent_usd": 342.15,
"period": "2026-08",
"period_type": "monthly",
"by_model": [
{ "provider": "openai", "model": "gpt-4o", "spent_usd": 210.0, "background_usd": 0.0 },
{ "provider": "anthropic", "model": "claude-sonnet-4-6", "spent_usd": 98.4, "background_usd": 1.25 }
]
}
- Access: the same fail-closed
require_gateway_accessgate asGET /spend—401unauthenticated,404for an unknown id and for a caller outside the gateway's tenant (identical). The only input is the path id; there is no request body. cap_usd: the gateway'sbudget_usdcap.null= uncapped (unlimited);0is a real zero cap (any spend is over budget). The caller computes the percentage and must guard the zero-cap divide.spent_usd: the authoritative current-period spend from the spend ledger (the same number budget enforcement reads). If the spend read — or the per-model breakdown read — fails, the whole request answers503 { "error": "temporarily unavailable; retry later" }(retry); it never returns a partial body with an unknown spend or an empty breakdown.by_model: the per-model breakdown from the cost legs (request_log_legs), priced on the charged amount — the same basis asspent_usd, so a marked-up external model is listed at what it was charged, not at the raw provider cost. One row per provider and model, highest charged amount first (provider, then model, break ties);[]when there is no billable model spend this period. It includes BYOK legs: a model on the customer's own key is listed withspent_usd0(its charged amount, so a BYOK-only gateway answers rows of0, not[]), and excludes non-billable legs (free local models, non-LLM sidecars). The rows add up tospent_usdexcept for spend that cannot be itemised by model (for example after a counter reset or spend booked without a model leg); the console shows that difference as one explicit row, and treats a difference below half a cent (0.005) as equal. The hero total stays authoritative. A price or markup change made after the spend was booked also shows up in that difference row:by_modelis priced at today's price, while the ledger keeps the amount that was debited at the time. Each row is a model this gateway actually called — the legs are booked to the gateway that served them. That includes the chat's background calls made through the gateway: the follow-up suggestions run on the model that answered, while the automatic conversation title prefers a local Myra model the gateway may route — so a Myra-hosted model can appear here although no turn picked it. A gateway whose provider restriction excludes Myra never runs, and so never lists, a Myra model.by_model[].background_usd: the part of that row'sspent_usd(same charged basis) that came from background requests, that is the chat interface's own conversation-title and follow-up-suggestion calls, which mark themselves with thex-aig-legheader (title_generation,followup_suggestions). A number,0when the row has none, never above the row'sspent_usd. It is decided per request: a title call that failed over to another model counts as background as a whole, on every model row it touched. The console shows a note under the model name only when this is above zero. Trust: the header value must be one of that closed list (anything else is dropped), and a caller can only label its own request on its own gateway; the label changes no cost, no cap and no enforcement, only this breakdown. Unrelated to the "Remove background" image tool.
Provider keys (BYOK) on a gateway
# List
curl https://<your-gateway-host>/admin/v1/gateways/{id}/keys
# Store / rotate
curl -X POST https://<your-gateway-host>/admin/v1/gateways/{id}/keys \
-H "Content-Type: application/json" \
-d '{"provider": "openai", "alias": "default", "key": "sk-..."}'
# Delete
curl -X DELETE https://<your-gateway-host>/admin/v1/gateways/{id}/keys/{provider}/{alias}
Accepted / rejected input (POST): provider must be a lowercase provider id (a-z, 0-9,
., _, -; at most 64 characters) and key a string (an empty key is accepted for a keyless
provider); alias may be absent, null or "" — all mean "default" — or letters, digits, .,
_, - (at most 64 characters; no /, spaces or accents, so it is always addressable by the
path-based DELETE). Use one spelling of an alias consistently (store, x-aig-byok-alias,
delete). The x-aig-byok-alias request header follows the same rule: a value that breaks it is 400
byok_alias_invalid, an empty one or any case of default is the default alias. The DELETE path's provider segment is folded to lowercase and must be a provider id (letters,
digits, ., _, -; else 400). Any other type
is rejected with 400 and nothing is stored. Each store and each effective delete is recorded in the
audit log (gateway.provider_key.stored / .deleted) with the provider and alias only — never the
key.
Self-serve plans hold no own provider keys. POST /gateways/{id}/keys and POST /tenants/{id}/keys answer 400 { "error": "…", "code": "own_key_not_available_on_plan", "field": "provider" } when the workspace is on a self-serve plan (self_serve_*); nothing is stored, and no four-eyes approval is held. The plan is read from the database, never from the request. Exemptions: keyless providers (myra, mock) are stored as before, and the Myra platform pool gateway (the gateway named by AIG_SELFSERVE_ANTHROPIC_GATEWAY_ID) is exempt because its keys are Myra's own keys. A plan value that is not a well-formed plan slug (empty, wrong case, whitespace, non-string, over 64 characters) is refused the same way (fail closed). If the workspace record cannot be read, the route answers 503 and stores nothing — retry. A held key change is checked again when it is approved: if the workspace moved onto a self-serve plan in the meantime, the approval ends as apply_failed / own_key_not_available_on_plan (see Config approvals). DELETE and GET are unchanged. Moving a workspace onto a self-serve plan deletes its stored own keys (see Self-serve plan config).
Key value (POST on both the gateway and the tenant key routes). The key is checked before anything is encrypted, held for approval or stored and is never trimmed or coerced; a rejected key answers 400 with code: "invalid_field", field: "key" and one of these error messages, and nothing is written:
| Provider | Accepted | Rejected with |
|---|---|---|
| Any key longer than 8192 bytes | -- | key is too long (at most 8192 bytes) |
Keyless providers (myra, mock) |
"" or a header-safe value |
key must not contain whitespace or control characters |
| Any other provider, empty key | -- | key is required for provider <provider> |
vertex |
a Google service-account JSON (client_email, private_key, an https token_uri; client_email without whitespace or control characters, at most 320 bytes); newlines inside the JSON are fine |
key must be a Google service-account JSON (client_email, private_key, https token_uri) |
bedrock |
ACCESS_KEY_ID:SECRET_ACCESS_KEY or ACCESS_KEY_ID:SECRET_ACCESS_KEY:SESSION_TOKEN; the access key id is 16 to 128 characters of A-Z0-9 |
key must be AWS credentials shaped ACCESS_KEY_ID:SECRET_ACCESS_KEY[:SESSION_TOKEN] |
| every other provider | a value with no whitespace and no control characters (CR, LF, NUL, tab, DEL, space) | key must not contain whitespace or control characters |
POST /gateways/{id}/keys also refuses a provider that is not a known provider id with 400 { "error": "unknown provider: <provider>", "code": "invalid_field", "field": "provider" }. The tenant route keeps its own provider allowlist (anthropic-admin) on POST only.
Keys stored before this validation are checked again every time they are read. A stored key that decrypts to an empty value reads as not configured (a gateway that can use a Myra-provided model then falls back to it; otherwise 424 provider_key_missing). A stored key that contains control characters other than tab (CR, LF, NUL, DEL, …) is refused and never sent upstream: the request answers 424 provider_key_invalid (see Error codes), and the Myra-provided fallback is not used. A malformed platform-pool key is reported as 500 configuration_error instead. The same rule applies to every leg that resolves a key: a same-provider fallback or agent leg whose key is malformed is skipped (logged, never dialled, never switched to the Myra-provided key), and the next fallback target is tried. Store the key again to fix it. A Vertex service-account JSON is exempt from this read check and may contain line breaks.
The alias defaults to "default". Posting again with the same (provider, alias) rotates the stored key; the previous value is replaced. The stored key is never returned by the list endpoint. A rotation takes effect on the next dispatch on the node that served the rotation (the decrypted-key cache is primed on write); any other node picks up the new key within the cache TTL (≤60s). If an invalid key is stored, the upstream provider's 401 is surfaced to the caller verbatim (a typed { "error": … } body with the upstream status), never a 500, and the key value is never echoed back.
Deleting (revoking) a key takes effect symmetrically: the DELETE evicts the decrypted-key cache on the node that served it, so the next dispatch on that node no longer presents the revoked key (any other node stops within the ≤60s TTL). Revoking a key that a gateway still routes on makes that gateway fall back to its remaining configured credential, or return 424 provider_key_missing if none remains.
Myra-provided (keyless) models on a gateway
A gateway can enable a Myra-provided external model — an Anthropic model served on Myra's own managed key, with no tenant API key. Usage is billed to the tenant's wallet (the single tenant spend authority). This is the second path of the "Add model" modal.
# The server-side SUPPORTED allowlist (the only models that may be enabled)
curl https://<your-gateway-host>/admin/v1/managed-models/catalog
# List this gateway's enabled Myra-provided models
curl https://<your-gateway-host>/admin/v1/gateways/{id}/managed-models
# Enable one (no API key). Tenant-admin, own gateway only.
curl -X POST https://<your-gateway-host>/admin/v1/gateways/{id}/managed-models \
-d '{"provider": "anthropic", "model": "claude-sonnet-5"}'
# Disable one
curl -X DELETE https://<your-gateway-host>/admin/v1/gateways/{id}/managed-models/{provider}/{model}
Trust boundary + cost guard (fail-closed):
POSTaccepts only a(provider, model)in the server-side SUPPORTED allowlist (v1: Anthropicclaude-sonnet-5,claude-haiku-4-5); anything else — a different Anthropic model, another provider, or missing fields — is rejected400and nothing is persisted. A tenant can never route an arbitrary model on Myra's key. Enable is idempotent and answers201 { "ok": true, "provider": "…", "model": "…" }.- A grant that could never be offered is refused, with nothing written:
400 { "code": "plan_model_not_allowed" }(the model is not in the tenant's plan);409 { "code": "managed_model_gateway_restricted" }(the gateway's provider allowlist, residency or base-URL override excludes the provider);409 { "code": "managed_model_unavailable" }(the platform model pool is not configured on this deployment, or the model has no billable price);500 { "code": "configuration_error" }(the gateway's stored config cannot be resolved). A malformed model id is400 invalid_model_id(also onDELETE). The gateway'spurposeis not checked: a grant prepared on a test gateway becomes active when the gateway is promoted. GET /managed-models/catalogrequiresGATEWAYS_MANAGE;GET /gateways/{id}/managed-modelsrequires gateway access only. Grants and effective revokes are audited (gateway.managed_model.granted/.revoked).- Authz: the
GATEWAYS_MANAGEpermission (held by a tenant admin by default, and any custom role granted it) + gateway ownership (require_gateway_access) — the caller can only enable models on their own gateway. - Cost guard: a Myra-provided model is offered and routable only while the tenant is wallet-governed — i.e. it has a usable (folded) gateway config and the always-on, fail-closed tenant wallet gate applies. Since every tenant now has a wallet and that gate is always on, an enforceable ceiling always exists for a usable config; the gateway refuses to spend Myra's key only on an unusable config (fail closed).
- Picker visibility: once enabled and the tenant has a dollar cap, the granted model appears in every model picker (
/easy, agents, playground, project/preferences default) at model granularity — enablingclaude-sonnet-5offers exactly that model, never the rest of the provider's catalog — even on a gateway with no stored provider keys. On an EU-residency/allowlist-restricted gateway a (US-hosted) granted model stays hidden and unroutable (offer == route). - On the inference path, if the tenant's spend cannot be verified (an authoritative spend read fails) the request is refused
503 spend_unverified(retryable) rather than routed unmetered; at/over the cap it is429 quota_exceeded. - Cap-overshoot (accepted limitation): the cap check is a soft, per-turn pre-check (the same model the own-key quota uses) — it reads spend once, before the turn, and the ledger is debited after. Concurrent turns (a read-before-any-debit race) or one long tool-loop can therefore overshoot the dollar cap by a bounded amount before the next request is blocked. Every token is still metered to the tenant; the overshoot is a one-burst-per-period overrun, not free spend. For a demo tenant with no payment obligation this is Myra-absorbed loss, and is an accepted risk (decision 2026-08-03); a per-tenant
rate_limitbounds the concurrency that drives it. Hard reservation of the pool-key leg was considered and deferred. - A grant is only offered inside the tenant's plan. For a self-serve tenant the granted model must also be in the plan's model allowlist; a model granted outside the tier is not offered anywhere (it would be refused
403 plan_model_not_allowedat send time). For a manual tenant, which has no per-tier allowlist, this term never applies. - A grant is offered only when its model has a billable price (a non-zero
input_per_1koroutput_per_1k). A live-but-zero-priced catalog row would be served on Myra's key while the usage meters to 0 — the tenant cap would never move — so it is neither offered nor routable, and the inference path refuses it outright. - Grants are for manual/demo tenants. A self-serve tenant needs none: it routes Anthropic on the managed pool automatically (see below). A Myra-provided pick has no cross-vendor failover (the self-serve failover pipeline is self-serve-only); a pool exhaustion surfaces as a provider fault.
Self-serve tenants: the plan's models are routable without a grant
A self-serve tenant (plan = self_serve_*) has no per-gateway provider keys at all — its Anthropic credential is Myra's managed pool key, injected automatically on every request. Its gateways therefore serve the models its plan entitles (plan_config.models_json, surfaced per gateway as the same managed_models field) with no managed_model_grant row and nothing to enable. This applies to the gateway created at signup and to any gateway the tenant creates later.
The offered set is the plan entitlement narrowed by the same terms a grant is narrowed by: the tenant has a dollar cap, the model has a billable price, the managed pool is wired on the deployment, and the gateway's residency/provider-allowlist vouches Anthropic. Those are the same static terms the inference path enforces, so the picker and the Auto pick cannot propose a model that the route side structurally cannot serve. Myra-hosted models in the plan list (for example on the Custom plan) are offered only with the EU-Gov grant, or on the free trial by its plan exemption — see Tenant entitlements › Purchased add-on.
Allowance and subscription state are not part of that set — they are checked per request, at send time, because they change between one turn and the next. A model can therefore be correctly offered and still be refused: 402 wallet_insufficient when the prepaid wallet cannot pay the call (402 trial_budget_exhausted on the free trial; 429 quota_exceeded while the platform wallet is switched off), 402 subscription_inactive when the subscription has lapsed past its grace period, and 503 spend_unverified when the workspace's spend cannot be read and the gateway refuses to route unmetered on Myra's key. A workspace whose budget_usd has been cleared is refused 500 configuration_error — the gateway will not spend Myra's key against an unenforceable cap.
Two consequences worth knowing:
- If a plan's
models_jsonis empty, the tier entitles nothing: the model allowlist is fail-closed, so every model is denied — conversation-create returnsno_runnable_routeand an explicit pick returns403 plan_model_not_allowed. A plan in that state is logged once at boot (ERR,[plan_config_seed] … EMPTY model entitlement). Fix the row viaPUT /admin/v1/plan-config. - A model id that is not servable — a deprecated catalog row, or a dated snapshot such as
claude-haiku-4-5-20251001(which the model list deliberately hides in favour of its bare alias) — routes but never appears in a picker. Entitle the bare alias.
Disabling a Myra-hosted local model on a gateway
The Myra-hosted local fleet (myra provider) is enabled by default on every gateway. A tenant admin can disable individual fleet models per gateway from the same Add-Model modal ("Use Platform Key" › Myra models), or via the API:
# The CHAT-capable fleet with per-gateway enable state (the block is enforced on the
# chat dispatch path, so only chat models are toggleable — never whisper/piper/flux/
# bge rows, whose non-chat endpoints dispatch outside it). Disabled rows stay PRESENT
# with enabled:false (so re-enable is one click, never a hunt through raw API).
curl https://<your-gateway-host>/admin/v1/gateways/{id}/local-models
# → [ { "provider": "myra", "model": "qwen3.8-27b", "enabled": true }, … ]
# Disable (hard block). Tenant-admin (GATEWAYS_MANAGE), own gateway only.
curl -X POST https://<your-gateway-host>/admin/v1/gateways/{id}/local-model-blocks \
-d '{"provider": "myra", "model": "qwen3.8-27b"}'
# Re-enable
curl -X DELETE https://<your-gateway-host>/admin/v1/gateways/{id}/local-model-blocks/myra/qwen3.8-27b
Semantics (hard block, offer == route): a disabled model is neither offered in any model picker nor routable on that gateway. Enforcement is per dispatch attempt (the primary and every fallback/failover re-target, same chokepoint as the deprecation gate), so an operator routing rule or auto-fallback can never carry a turn onto a disabled model — an all-blocked chain returns the typed 403 model_disabled_on_gateway. New agent/project/scheduled-task pins to a disabled model are rejected at save; a pre-existing pin returns the same typed 403 until re-pinned. The attachment auto-upgrade and the 413 switch-model suggestion never name a disabled model. Internal utility legs are governed too (they dispatch through the same chokepoint). A stale SPA that requests a disabled model through server-side route resolution gets the pre-existing generic no-route error (accepted). A sibling gateway without the block still serves the model.
Trust boundary (fail-closed) + storage: POST accepts only a keyless local provider (the vllm alias normalizes to canonical myra — a block under either spelling blocks both) and a model that exists as a live (non-deprecated), chat-capable model_price row; anything else — incl. a non-chat fleet row like whisper-large-v3-turbo — → 400, nothing persisted. DELETE deliberately skips the catalog check (a stale block for a since-deprecated model must stay removable) and is idempotent (200 on an unknown row); POST is idempotent too. Rows live in gateway_local_model_block (cascade-deleted with the gateway); mutations invalidate the gateway config cache, so pickers and routing reflect a toggle immediately. The deny map is surfaced on the tenant-gateways listing as local_model_blocks ({provider: {model: true}}, folded server-side — never from the tenant-editable config JSON).
Fail direction (deliberate asymmetry): on a block-table read error the blocks are treated as absent (fail open — a disabled model transiently reappears rather than the whole local fleet blacking out on a DB blip). The managed-grant fold keeps the opposite, fail-closed direction (a grant spends Myra's real key).
Tenant-wide provider allowlist
A platform admin can set an organisation-wide provider floor with PATCH /admin/v1/tenants/{id}. It is folded into every gateway of the tenant and can only narrow a gateway's own allowlist, never widen it.
curl -X PATCH https://<your-gateway-host>/admin/v1/tenants/{id} \
-d '{"provider_allowlist": ["openai", "anthropic"], "provider_allowlist_enforced": true}'
| Field | Accepted | Rejected (400, nothing written) |
|---|---|---|
provider_allowlist |
An array of at most 64 non-empty strings, each a registered provider (names are trimmed, lower-cased and alias-normalised; duplicates collapse). [] is accepted and means deny all. null clears the floor. |
An object, string, number, boolean, nested array, non-string entry, unknown provider, empty or blank string, or more than 64 entries. |
provider_allowlist_enforced |
0, 1, true, false or null. |
Anything else (for example "1" or 2). |
[] (deny all) and null (no floor) are different states. Both fields are platform-admin-only: a tenant admin that tries to change either gets 403 { "error": "<field> is platform-admin-only and cannot be changed by a tenant admin" }; omitting them or re-sending the stored value is a 200 no-op. GET returns provider_allowlist as an array (or null). A change is audited as tenant.provider_allowlist_changed and takes effect at once on the node that handled it, and on every other node within about 5 seconds.
Blocking a model for the whole tenant
A tenant admin (GATEWAYS_MANAGE, own tenant only) can hard-block any catalog model — any provider, not only the Myra-hosted fleet — for every gateway of the tenant at once:
curl https://<your-gateway-host>/admin/v1/tenants/{id}/model-blocks
# → [ { "provider": "openai", "model": "gpt-4o", "created_at": "…" }, … ]
curl -X POST https://<your-gateway-host>/admin/v1/tenants/{id}/model-blocks \
-d '{"provider": "openai", "model": "gpt-4o"}' # → 201
curl -X DELETE https://<your-gateway-host>/admin/v1/tenants/{id}/model-blocks/openai/gpt-4o # → 200, idempotent
Semantics (offer == enforcement): a blocked model is not offered in any picker and is not routable on any gateway of the tenant — the primary and every fallback/failover re-target. A refused call returns the typed 403 model_disabled_for_tenant (deterministic policy refusal: no retry, no circuit-breaker failure, a healthy fallback still serves). The block is keyed on (canonical provider, model id) — blocking openai/gpt-4o does not block azure/gpt-4o, and the vllm alias normalizes to myra. It composes with the per-gateway block above: a model blocked by either is blocked. A block on a retired model id also stops the automatic successor upgrade for that id (intended). The deny map is surfaced on the tenant-gateways listing as org_model_blocks ({provider: {model: true}}), and GET /gateways/{id}/local-models marks a tenant-blocked row enabled: false with blocked_by: "tenant". This annotation is display-only: if the block list cannot be read the row is shown without it (a WARN is logged), but enforcement is unaffected because the resolved gateway config carries the block.
Trust boundary (fail-closed): POST accepts only a provider/model that exists as a live catalog row and a model id that satisfies the model-id rule (400, invalid_model_id, nothing written); a catalog read failure returns 503 with a retry hint and writes nothing. DELETE skips the catalog check (a stale block stays removable) and is idempotent. GET returns 503 on a read error, never an empty 200. Each mutation is audited (tenant.model_block_added / tenant.model_block_removed) and invalidates the tenant's gateway config cache. If the block table cannot be read while resolving a gateway, the request fails closed rather than serving a possibly-blocked model.
Error codes
The gateway routes, the rules and the token PATCH / DELETE answer a 4xx with a sibling code next to the unchanged error sentence; a refusal about one field also carries field.
| Status | code |
Meaning |
|---|---|---|
| 400 | malformed_body |
The body is valid JSON but not an object (an array, a string, a number, true or null), is not valid JSON, or holds a non-finite number (see Request body shape). Only an absent or blank body is read as {} (gateway PATCH: a 200 no-op that stores nothing). |
| 400 | invalid_field |
A field is missing or wrongly typed (for example rule conditions, actions); field names it. |
| 400 | invalid_config |
config is not an object or a config value fails validation; field names the key when one applies. |
| 400 | unknown_field / read_only_field |
Key not accepted / read-only; field is the key (capped at 64 bytes). |
| 400 | no_fields |
A token PATCH with none of rate_limit / budget_usd / expires_at. |
| 400 | unknown_agent |
agent_id does not exist for this gateway. |
| 400 | invalid_body, provider_and_model_required, unknown_provider, unknown_model |
POST /tenants/{id}/model-blocks: the body is not a JSON object / provider or model is missing or empty / the provider is not known / no live catalog row matches the model. Nothing is written. DELETE /tenants/{id}/model-blocks/{provider}/{model} answers invalid_provider for an empty provider. |
| 403 | service_credential_protected |
An internal service credential cannot be edited or revoked. |
| 403 | trial_gateway_locked |
Free-trial gateway lock. |
| 404 | gateway_not_found, rule_not_found, token_not_found |
Unknown gateway / rule / token. |
| 500 | response_encode_failed |
The response body could not be written as JSON (for example a stored number that is not finite). Nothing in the request is retried or undone; the body is exactly { "error": "internal error", "code": "response_encode_failed" }. Re-read the resource; a persistent failure is a server fault to report. |
Not coded: a storage fault (503), the audited 404 { "error": "not found" }, and the auth-gate 401 / 403 forbidden keep their plain shape. siem, webhook and tracing validation keep their own stable codes.
Tenant analytics, spend, and budget
Per-tenant analytics timeseries
Bucket sizes: 5m, 15m, 30m, 1h, 6h, 1d. The default bucket is 1d; the default n is 30; the maximum n is 168 (a larger value is capped; 0 reads as 1). Returns { "timeseries": [...], "top_models": [...], "read_source": "mysql" | "clickhouse" | "mysql_fallback" }; read_source names the store that answered (mysql_fallback = ClickHouse was selected but the coverage guard or the read failed). A tenant with no request-log rows in the window is also answered from MySQL and labelled mysql_fallback; this is expected, not a ClickHouse error. Top models are grouped by exact model name (case- and trailing-space-sensitive) and ties are ordered deterministically. Requires TENANT_SETTINGS_MANAGE. An unknown bucket, a non-integer n or a malformed since is rejected 400. An explicit since is clamped to the last 400 days (the same floor as /stats/analytics), so since=0 reads the last 400 days, not the whole request log. An optional tz_offset sets viewer-local day boundaries (UTC when absent or invalid).
Tenant spend history
Requires COGS_VIEW. Same limit rule as the gateway spend history: default 12, capped at 120, anything but a plain integer ≥ 1 is 400 {"code": "invalid_limit"}.
Resetting the tenant budget counter
🔒 Platform-admin only. Resetting the tenant spend counter re-opens the platform-set
platform_cap_usdceiling (the quota block reads exactly this ledger), so only a platform admin may do it — atenant_admin(or a member with a custom role grantingTENANT_SETTINGS_MANAGE) receives403 Forbidden, the ledger untouched. Every successful reset is audited (tenant.budget_reset, with the actor and the pre-reset per-periodamount_micro); a storage fault that wrote nothing returns503 { "error": "temporarily unavailable; retry later" }, any other the sanitised500— never a silent200. A repeated?period=is rejected400.
The same transaction also resets the members' personal-budget counters: with ?period= on a manual workspace only that period's member counters, otherwise (no filter, or any self-serve workspace, whose members' counters follow the allowance) every member counter. The free-trial credit counters are never touched. The audit record's before lists the reset member counters under members (user_id, period, amount_micro).
curl -X DELETE https://<your-gateway-host>/admin/v1/tenants/{id}/budget
curl -X DELETE 'https://<your-gateway-host>/admin/v1/tenants/{id}/budget?period=2026-05'
Tenant-scoped provider keys
Tenant-scoped keys serve administrative and usage-synchronisation tasks only; they are not consulted on the inference path (a gateway uses its own provider key). Accordingly, POST accepts only administrative providers — currently anthropic-admin (the key used to pull the Anthropic Admin usage feed). A request for any other (real inference) provider is rejected with 400, because such a key would be stored but never read. Requires the TENANT_SETTINGS_MANAGE permission (held by a tenant admin by default, and any custom role granted it).
# List
curl https://<your-gateway-host>/admin/v1/tenants/{id}/keys
# Store (administrative providers only, e.g. anthropic-admin)
curl -X POST https://<your-gateway-host>/admin/v1/tenants/{id}/keys \
-H "Content-Type: application/json" \
-d '{"provider": "anthropic-admin", "alias": "default", "key": "sk-ant-admin-..."}'
# Delete
curl -X DELETE https://<your-gateway-host>/admin/v1/tenants/{id}/keys/{provider}/{alias}
Accepted body: provider (must be an administrative provider — anthropic-admin), key (required, a string), alias (optional; absent, null or "" mean default). Rejected with 400: a missing or null provider/key, a value of the wrong type, a provider/alias outside the character rules of the gateway key route
below (lowercase provider id; alias of letters, digits, ., _, -; at most 64 characters), or a provider that is not an administrative provider (for example openai, anthropic). A workspace on a self-serve plan is refused with 400 own_key_not_available_on_plan (see the gateway key route). The same validator serves the gateway key route. To give a gateway its own provider key, use the gateway-scoped endpoint above.
Delete. DELETE /tenants/{id}/keys/{provider}/{alias} folds the provider segment to lowercase and refuses one outside the key-store character rules (a-z, 0-9, ., _, -; at most 64 characters) with 400 { "error": "…", "code": "invalid_field", "field": "provider" }. The administrative-provider allowlist applies to POST only: any other valid provider id is accepted, so a legacy row can still be removed. The alias path segment is required and must not be empty. The answer is 200 { "ok": true } even when nothing was stored under that name.
Audit. A successful POST writes a tenant.provider_key.stored event and a DELETE that removed a row writes tenant.provider_key.deleted (a delete that removed nothing writes none). Each carries the provider and alias only, never key material. The key change and its row are one transaction: either both are stored or neither is. A lock held for longer than 5 seconds or a conflict answers 503 { "error": "temporarily unavailable; retry later" } with nothing written (DELETE can now answer 503 too); retry. A refused audit row or an unknown outcome answers a sanitised 500. See the audit log.
Gateway config structure
The complete config object with all defaults (tenant_spend_cap_usd is shown because the effective configuration carries it, but it is derived from the organisation's spend_cap_usd every time the configuration is loaded — a value written into a gateway's own configuration is ignored; set the organisation spend cap with PATCH /admin/v1/tenants/{id}):
{
"auth_required": true,
"budget_usd": null,
"budget_period": "monthly",
"tenant_spend_cap_usd": null,
"cache_ttl": 0,
"retry_count": 2,
"timeout_ms": 60000,
"log_payloads": true,
"rate_limit": null,
"ip_allowlist": [],
"guardrails": [],
"azure_endpoint": null,
"azure_deployment": null,
"azure_api_version": "2024-02-01",
"bedrock_region": "us-east-1",
"vertex_project": null,
"vertex_region": "us-central1",
"provider_base_urls": {},
"provider_allowlist_enforced": false,
"provider_allowlist": []
}
For the full field-by-field reference see Gateway Configuration Reference.
See also
- Gateway Configuration Reference
- Users & Tokens API
- Routing Rules API
- Error Codes
- Budget & Quota Enforcement
Four-eyes (config approval). When the organization requires approval for configuration changes, a gateway
PATCH, a guardrail-config import and the provider-keyPOST/DELETEby a gateway administrator answer202 { "status": "pending_approval", "approval_id" }instead of applying; see Config approvals. Provider keys are held only as ciphertext.