Redaction and guardrails: set explicit traffic controls
Configure UplinkSwitch organization and key guardrails, understand stricter-wins policy merging, and use redaction with its restoration limits in mind.
Choose traffic controls independently of the model you call. Guardrails are optional checks on your own requests. Redaction replaces detected secrets or personal data before forwarding and restores the originals in the answer. Neither feature is a promise that all unwanted input or sensitive output will be detected.
Read and replace the organization policy
GET /v1/guardrails returns an object requiring data, which is the organization policy or null. PATCH /v1/guardrails accepts a required guardrails member containing a complete policy object, or null to clear the organization default. The operation replaces the policy; it does not merge a partial object into the existing default. Keys pick up a change within a minute.
Both operations declare adminKey. The GET error description also mentions console sessions, and PATCH specifies an owner or admin key. Use an admin key for the explicit API workflow.
Read the policy before preparing a replacement. This illustrative read uses UPLINKSWITCH_ADMIN_KEY:
curl --fail-with-body 'https://api.uplinkswitch.com/v1/guardrails' \
-H "Authorization: Bearer ${UPLINKSWITCH_ADMIN_KEY}"Policy fields and their limits
| Field | Documented behavior |
|---|---|
blocked_patterns | Up to 50 patterns checked against system, user and tool text, excluding earlier assistant turns. |
prompt_injection | off, flag or block; a local heuristic with no model call. |
tool_policy | An object containing tool allow and deny rules, or null. |
A blocked pattern object requires pattern, a JavaScript regular expression of up to 512 characters. Optional flags permits i, m, s and u, with i as the default. Optional action is block by default or flag; optional nullable name labels the match in the error message.
Backreferences, lookaround and repeated groups containing repeats or alternatives are rejected. The description mentions bare-string shorthand, but the typed array items reference an object schema. Use the object form when building from this contract until the published schemas agree.
The injection check recognises specified wording and markers, including instructions inside tool results. Its description explicitly warns that paraphrases, other languages and encoded payloads can pass, while quoted attacks can be flagged. Evaluate it against your own traffic before choosing block mode.
Combine organization and key controls
A key’s guardrails field appears in the key creation and patch schemas. Manage it through POST /v1/keys or PATCH /v1/keys/{key_id} with an admin key. A null key policy adds no key-specific checks; it does not remove the organization policy.
The effective combination is stricter-wins:
- Blocked patterns and tool deny lists accumulate.
- The stricter
prompt_injectionmode applies. - Tool allow lists intersect.
tool_policy.allow accepts an array or null, where null permits tools that are not denied. A trailing * matches a prefix. tool_policy.deny names tools that must not run. Their declarations are removed before forwarding; a forced tool_choice for a denied tool is refused, and a denied tool call in a returned answer is stripped.
A blocking match returns 400 guardrail_blocked before any model is asked and costs nothing. Flag mode lets the request proceed and marks the match in response metadata. Tool-call stripping is likewise signalled in response metadata. The request-level override parameter is defined in the OpenAPI document; use that definition rather than guessing its header name.
Redaction is reversible substitution
Set the key’s redact field during creation or patching:
| Value | Meaning |
|---|---|
off | Default; send message text as written. |
secrets | Replace detected API keys, tokens and private keys with placeholders before forwarding. |
secrets_pii | Also replace detected emails, phone numbers, card numbers, US SSNs and IBANs. |
A placeholder can look like [[SECRET_1]]. The answer receives the original values again. A request-level header can override the key’s redaction mode; use the OpenAPI parameter definition for its exact identifier. A key default therefore does not establish a non-overridable redaction policy.
For detector completeness, ordering relative to retained request bodies, or guardrail coverage on media generation, the OpenAPI document does not say. Keep downstream handling of restored answers explicit. Presets stores request defaults, while these controls belong to the organization or key; SDK setup supplies connection setup.
Management errors
The organization GET declares 401 for invalid access. PATCH declares 400 invalid_request or invalid_regex_pattern, 401 invalid_api_key, and 403 forbidden when the caller cannot change the policy. Both return 200 on success. These management responses are separate from the 400 guardrail_blocked returned by a checked inference request.