Guardrails

Authentication: JWT | API Key

The policy, screening settings, refusals, declarations, held revisions and team view of a collection's guardrails. What guardrails do is in Guardrails for Collections.


Guardrails Policy

GET /v1/:env/collections/:collection/guardrails-policy/
PUT /v1/:env/collections/:collection/guardrails-policy/

GET needs read access to the collection structure and PUT needs update access. Each change creates a numbered version; the response carries version, body, config_hash, created_at and delivered_by. A PUT identical to the live body changes nothing. A collection without a policy returns version, config_hash and created_at as null, with mode off.

delivered_by lists the Flux APIs of the collection's environment that expose the collection and have trust_delivery other than off, sorted by name. Each entry has api_key, name and trust_delivery. It is an empty array for a caller without read access to Flux APIs.

{
  "mode": "provenance",
  "overrides": { "hidden_markup": "block" },
  "trusted_keys": ["kq3VtB8xLm2P"],
  "acknowledge_agent_trust": true,
  "link_allowlist": ["example.com", "*.example.org"]
}
  • Name
    mode
    Type
    string
    Description

    off, provenance or screened. If omitted, keeps the collection's current mode.

  • Name
    overrides
    Type
    object
    Default
    default:{}
    Description

    Severity per finding kind. See Severities.

  • Name
    trusted_keys
    Type
    array<string>
    Default
    default:[]
    Description

    The key of each Flux API key whose writes are trusted, as the Flux API keys endpoints return it. Each must be a key of the collection's environment. A trusted key that is deleted later stays listed until the policy is changed. Up to 100.

  • Name
    acknowledge_agent_trust
    Type
    boolean
    Default
    default:false
    Description

    Required to be true when trusted_keys is not empty. Makes the listed keys trusted for MCP writes as well.

  • Name
    link_allowlist
    Type
    array<string>
    Default
    default:[]
    Description

    Hosts exempt from external_link and remote_image findings (not from lookalike_host). external_link is reported only when this list is not empty. example.com matches that host only. *.example.com matches its subdomains, not example.com itself. Up to 100.

A policy in screened mode also takes the settings under Screening settings.

Statuserror_codeWhen
409policy_version_limitThe collection holds 10,000 policy versions
409guardrails_not_for_filesThe collection is a files collection
409screening_not_configuredmode is screened on a deployment where screening is not available
422unknown_trusted_keyAn entry of trusted_keys is not a Flux API key of the environment
422acknowledge_requiredtrusted_keys is not empty and acknowledge_agent_trust is not true
422unsupported_in_this_phaseoverrides names link alone or a key not in the severity tables, or a screening setting has a value other than its only accepted one
422override_out_of_rangeA severity outside the range allowed for that kind, or an override of screen_unavailable
422validation_errorThe body has an unknown key, a value of the wrong type or a mode that is not one of the three modes, or max_screened_chars is outside 1 to 200,000

Screening Settings

A policy in screened mode stores these settings next to the ones above:

{
  "mode": "screened",
  "overrides": { "prompt_attack": "block", "pii": "suspicious" },
  "hold": true,
  "suspicious_action": "deliver",
  "screen": "untrusted",
  "max_screened_chars": 50000
}
  • Name
    hold
    Type
    boolean
    Default
    default:true
    Description

    Writes with tainted fields are held until their screening decides them, or until a person releases or rejects them.

  • Name
    suspicious_action
    Type
    string
    Default
    default:deliver
    Description

    What happens to a suspicious revision. deliver publishes it with its reasons.

  • Name
    screen
    Type
    string
    Default
    default:untrusted
    Description

    Which text is screened. untrusted screens tainted fields.

  • Name
    max_screened_chars
    Type
    integer
    Default
    default:200000
    Description

    The most characters one write may send for screening, from 1 to 200,000. See Limits and budgets.

hold, suspicious_action and screen each accept one value, shown as the default; any other value is refused with unsupported_in_this_phase. A max_screened_chars outside 1 to 200,000 is refused with validation_error. A policy in off or provenance mode that names none of these settings stores none of them.


Severities

Each finding has one of three severities. The severity decides what the finding does to the write:

SeverityWhat it does
infoThe finding is recorded and shown to the team. It does not change the write or the verdict.
suspiciousThe finding is recorded and the write succeeds. In screened mode, when the revision has no finding at block, it makes the verdict suspicious: the revision is published with the finding among its reasons.
blockA finding from the in-process checks at block under the policy live at write time refuses the write with 422 and content_refused, and nothing is stored. A block finding on a held revision, from the content-safety service or from a policy changed after the write, makes the revision blocked: it is never published and stays in the held list.

Each kind has a default severity. A policy overrides it in overrides, using a kind or kind:sub_kind.

KindDefaultA policy may set
unicode_smugglingsuspiciousinfo, suspicious, block
mixed_scriptinfoinfo, suspicious, block
hidden_markupsuspiciousinfo, suspicious, block
link:script_urlsuspicioussuspicious, block
link:data_url_oversizedsuspiciousinfo, suspicious, block
link:remote_imagesuspiciousinfo, suspicious, block
link:lookalike_hostsuspiciousinfo, suspicious, block
link:external_linkinfoinfo, suspicious, block

Findings below block are recorded and reported; the write succeeds. overrides accepts only the keys in this table and in What the service finds; link alone, or any other key, is refused with unsupported_in_this_phase. A severity outside the allowed range returns override_out_of_range.


What the Service Finds

KindWhat it findsDefaultA policy may set
prompt_attackText that tries to override a model's instructionssuspicioussuspicious, block
sexual_textSexual contentsuspicioussuspicious, block
piiPersonal data. The finding records the entity types, never the matched textinfoinfo, suspicious, block
text_moderation:hateHateful languageinfoinfo, suspicious, block
text_moderation:insultsInsulting languageinfoinfo, suspicious, block
text_moderation:violenceViolent languageinfoinfo, suspicious, block
text_moderation:misconductLanguage about misconductinfoinfo, suspicious, block

A content filter counts as a finding when the service detects it at high or medium confidence. pii counts when any entity is detected. A finding is reported once per top-level field and kind; its detail names the first leaf it was found in, counts the leaves and windows, and carries the highest confidence or the entity types. Overrides use the same overrides object as the in-process kinds.

Long text is screened in windows of 20,000 characters that overlap by 512 characters.


What the Checks Find

The checks read text, Markdown and HTML attributes of the tainted fields.

  • unicode_smuggling: invisible and control characters, bidirectional overrides and other characters that change what a reader sees without showing in the text.
  • mixed_script: words that mix Latin letters with Cyrillic or Greek ones.
  • hidden_markup: comments; text inside template, script, noscript and style; the hidden attribute; aria-hidden="true" elements with text; inline styles that hide text (display:none, zero size or opacity, far off-screen positions). Link titles are reported as hidden_markup too.
  • link: script URLs (javascript:, vbscript:, file:, and data: URLs that are not small images), oversized data: images, remote images, lookalike hosts, and links to hosts outside a non-empty link_allowlist.

Paths in findings and trust metadata are JSON Pointers: /body, /a.b for a key containing a dot, /x~1y for a key containing /.


Refusals

A write whose tainted field carries a block finding is refused with 422, and nothing is stored:

{
  "code": "content_refused",
  "public_reason": "hidden_markup",
  "message": "The content was refused by the collection's guardrails policy",
  "error_code": "content_refused",
  "detail": { "public_reason": "hidden_markup" }
}

public_reason is the kind the policy set to block: unicode_smuggling, mixed_script, hidden_markup or link. The response does not say which field or which characters matched.


Declaring Untrusted Content

A Management API or Flux REST write accepts an optional top-level provenance object next to data:

{
  "data": { "subject": "Refund", "body": "..." },
  "provenance": { "untrusted_fields": ["body"], "source": "support-inbox" }
}
  • Name
    untrusted_fields
    Type
    array<string>
    Description

    Top-level fields of the collection's schema to mark as untrusted.

  • Name
    source
    Type
    string
    Description

    Optional label matching [a-z0-9_-]{1,32}, stored with each field it taints.

A malformed provenance, or a name that is not a top-level field, returns 422 invalid_provenance. MCP create_record and update_record take no provenance argument.


When Screening Cannot Finish

If the service returns a permanent error, fails 12 attempts for the same text, or gives no result within 24 hours, the revision records a screen_unavailable finding and stays held with state: "failed". Attempts the service rejects because of its rate limit are retried and do not count towards the 12. The finding's detail.cause names the reason. screen_unavailable has no policy severity and cannot be overridden; the held list shows it with severity: "held". The held entry has verdict: null and reasons: ["screen_unavailable"]. The revision is published only when a person releases it. It is discarded when a person rejects it, and a newer write on the record supersedes it, after which it cannot be released.


Limits and Budgets

These limits are checked before anything is stored.

StatusCodeWhen
422content_too_large_to_screenThe text to send exceeds the policy's max_screened_chars. Text that is reused (see Screening billing) is not counted.
422too_many_text_targetsThe write has more than 2,000 screening targets. Each 20,000-character window of a string value, and of a json member key, is one target.
429screening_budget_exceededThe writing principal's hourly budget of characters is spent
503screening_unavailableThe budget cannot be checked, so a write with tainted fields in a screened collection is refused
429review_backlog_fullThe collection holds 10,000 retained held revisions, or 1 GiB of their data, that cannot be purged

The hourly budget per principal is 2,000,000 characters for an untrusted writer and 20,000,000 for a trusted one.

The 503 screening_unavailable error refuses a write when it is made, and nothing is stored. It is different from the screen_unavailable finding, which a stored revision records when its screening cannot finish.

A draft revision that is held for screening cannot be edited or published: the attempt returns 409 with revision_held.

Webhook events for a held revision carry references only. An endpoint with the With content payload receives them with "truncated": true. The revision's content is delivered with revision.published once the revision is published. The content of a revision that is never published is never delivered.

A record has at most one live held revision. A newer write on the record replaces it, whatever that write carries: the older held revision is marked superseded and cannot be released. Superseded revisions are retained for 7 days; blocked and rejected ones for 30 days.


Screening Billing

Screening adds 2 write units per started 1,000 characters sent for screening. The units are added to the write's own cost and reported in write_units. A write that is refused or rolled back adds none. A target is not sent again when the same text was screened under the same screening configuration in the revision's own completed screening or, if it has none, in the record's published revision; reused text is not charged. Text seen only in a blocked, rejected or superseded revision is screened and charged again. A write with no tainted text, or whose tainted text is all reused, adds none. The units are charged when the write is accepted and held, and a later screen_unavailable does not undo them.

When FoxNose changes its screening configuration while a revision is held, text the write reused is screened again under the new configuration at no charge. That text counts towards the policy's max_screened_chars and the 2,000-target limit: if the revision would exceed either, nothing is sent and the revision stays held with a screen_unavailable finding whose detail.cause is content_too_large_to_screen or too_many_text_targets.


Screened Write Responses

In a screened collection, a Flux write response carries published and delivery:

{
  "resource_key": "refund-4821",
  "revision_key": "c47a1e",
  "write_units": 5,
  "published": false,
  "delivery": "pending"
}
  • delivery: "delivered" and published: true: the revision is published and revision_key names it.
  • delivery: "pending" and published: false: the revision is held and revision_key names the held revision. The record's published revision is unchanged.

A conditional PUT compares If-Match with the held revision's key when the record has one. A mismatch returns 412 with the error code revision_precondition_failed, and detail.reason is revision_pending_screening:

{
  "message": "The resource's current revision is not the one this write expected. Re-read the record and recompute the update before retrying.",
  "error_code": "revision_precondition_failed",
  "detail": {
    "current_revision": "8f2b1c9d",
    "reason": "revision_pending_screening",
    "pending_revision": "c47a1e"
  }
}

current_revision is the published revision and pending_revision is the held one. To write on top of the held revision, send pending_revision as If-Match.


Reviewing Held Revisions

GET  /v1/:env/collections/:collection/guardrails/held/
POST /v1/:env/collections/:collection/resources/:resource/revisions/:revision/guardrails/release/
POST /v1/:env/collections/:collection/resources/:resource/revisions/:revision/guardrails/reject/

GET requires read access to the collection's items. It lists the collection's retained held revisions, newest first, as count, next, previous and results, with limit and offset parameters (default 50, at most 200). The status parameter narrows the list; any other value returns 400 with validation_error.

statusEntries
needs_reviewreview_state none and state failed or done: waiting for a person
screeningreview_state none and state pending
blockedreview_state blocked
rejectedreview_state rejected
supersededreview_state superseded

Each entry has resource_key, revision_key, number, state (pending, failed or done; a blocked entry is always done), review_state (none, superseded, blocked or rejected), verdict, reasons, reviewed_by (the key of the member or management key that released or rejected it), reviewed_at, review_reason (the reason given on reject, "" if none), release_policy (policy, or clean_only after a re-screen), created_at, writer, tainted, findings and why.

  • writer is the revision's last writer: writer_type, surface and principal_key. It is null for a revision without provenance.
  • tainted lists the revision's tainted fields: path, field_label (the field's name in the schema), writer_type, revision_number (the revision that wrote the content), carried (true when the content comes from an earlier revision than this one) and cause (why the field is untrusted: writer, declared or schema).
  • Each finding has kind, sub_kind, severity, path, detector, detail, policy_version, created_at, and the words described under Team view: title, field_label and summary. A screen_unavailable finding shows severity: "held".
  • why is the list of reasons the revision is or was held, each { "code", "text" }: text is a sentence naming the fields, writers and findings involved. code is one of pending, screen_unavailable, blocked, suspicious, rejected, superseded, released or untrusted_field. The list has one entry for the revision's state and one untrusted_field entry for each entry of tainted.

Review across the environment

GET /v1/:env/guardrails/review/

Lists what the environment holds for a person to review, across its document collections, newest first. It requires read access to resources and to collection items; a collection appears only when the caller can read its items, and a record only when the caller can read it. Files collections are never listed.

  • Name
    kind
    Type
    string
    Default
    default:held
    Description

    held (retained held revisions) or needs_review (records with a tainted field nobody reviewed).

  • Name
    collection
    Type
    string
    Description

    A collection key. One the caller cannot read, or that does not exist, gives an empty page.

  • Name
    status
    Type
    string
    Description

    With kind=held only: a value of the held list above.

  • Name
    limit
    Type
    integer
    Default
    default:50
    Description

    At most 100.

  • Name
    offset
    Type
    integer
    Default
    default:0
    Description

    Page offset.

Any other kind or status, or status with kind=needs_review, returns 400 with validation_error. The response has count, next, previous and results. With kind=held a result is a held-list entry plus collection (its key), collection_name and the record's name. With kind=needs_review a result is a record whose current revision has a tainted field nobody reviewed: collection, collection_name, resource_key, name, guardrails (the record summary under Trust summaries in lists), current_revision (the key of the revision to review), current_revision_published_at and created_at.

release publishes a held revision whose review_state is none. It returns revision_key, published: true, review_state, verdict, reasons and screened. reject marks the revision rejected; it is never published. It accepts an optional JSON body { "reason": "..." }: a string of at most 500 characters after trimming, stored as review_reason. null is the same as no reason. Any other reason that is not a string, or one that is too long, returns 400 with validation_error, and nothing changes. reject returns revision_key, published: false and review_state: "rejected". Both require update access to the record and read access to the collection's items.

StatusCodeWhen
409revision_not_heldThe revision is not a live held revision
409revision_supersededA newer write replaced the revision
409release_blockedrelease only: the live held revision is re-evaluated under the live policy at release and its verdict is blocked. Releasing an entry whose review_state is already blocked returns revision_not_held.
409guardrails_not_for_filesThe collection is a Files collection

Deciding Several Revisions

POST /v1/:env/collections/:collection/guardrails/held/reject/
POST /v1/:env/collections/:collection/guardrails/held/rescreen/

Both take up to 50 held revisions:

{
  "items": [
    { "resource_key": "kq3VtB8xLm2P", "revision_key": "r7HcN2wQe9Ab" }
  ],
  "reason": "Prompt text in the description"
}

items holds 1 to 50 distinct resource_key and revision_key pairs. reason applies to reject only, with the limits of a single reject. A request with an invalid items or reason returns 400 with validation_error before any item is processed. Both require read access to the collection's items; each item additionally requires update access to its record.

Each item is processed on its own and the response reports every outcome in request order, with status 200:

{
  "results": [
    { "resource_key": "kq3VtB8xLm2P", "revision_key": "r7HcN2wQe9Ab", "outcome": "rejected" },
    { "resource_key": "kq3VtB8xLm2P", "revision_key": "x1", "outcome": "error", "code": "revision_not_found" }
  ]
}

outcome is rejected for reject, and queued for rescreen. An item that fails has outcome: "error" and the code of its error, such as revision_not_held, revision_superseded, resource_not_found or revision_not_found; internal_error marks an unexpected failure. A failed item does not affect the others. A Files collection returns 409 with guardrails_not_for_files for the whole call.

rescreen screens each revision again and publishes it only if the resulting verdict is clean. A revision with a suspicious verdict stays held for a person, with release_policy: "clean_only". The revision's state is pending while it is screened. It is not billed, but it reserves the characters to send against the original writer's hourly budget. A revision that is being screened returns screening_in_progress. The size and budget errors under Limits and budgets are reported per item.


Backlog and Budget

GET /v1/:env/collections/:collection/guardrails/usage/

Requires read access to the collection's items. Returns the collection's review backlog against its caps and the current hour's screening budget:

{
  "backlog": { "candidates": 12, "max_candidates": 10000, "bytes": 48213, "max_bytes": 1073741824 },
  "screening_budget": {
    "available": true,
    "hour_ends_at": "2026-11-09T15:00:00+00:00",
    "principals": [
      {
        "principal_key": "kq3VtB8xLm2P",
        "writer_type": "flux_key",
        "trusted": false,
        "used_chars": 410000,
        "limit": 2000000,
        "variants": [{ "writer_type": "flux_key", "trusted": false, "chars": 410000 }]
      }
    ],
    "principals_total": 1
  }
}

backlog counts the retained held revisions and their data against the caps that cause review_backlog_full. screening_budget lists the principals with screening-budget use for the collection in the current hour (a re-screen counts against the original writer), the most used relative to its limit first, up to 50; principals_total counts all of them. used_chars is counted against the hourly limit of the principal's strictest variant; variants shows the characters by writer type and trust. principal_key is null when the writer has no key or its key cannot be resolved. When the budget store cannot be read, available is false, principals is empty and principals_total is absent. A Files collection returns 409 with guardrails_not_for_files. The figures are for information; they do not change what a write is allowed.


Team View

GET /v1/:env/collections/:collection/resources/:resource/revisions/:revision/guardrails/

Requires read access to the record and to the collection's items. Returns review, provenance, findings, why, untrusted_fields and needs_review.

provenance holds writers (each with writer_type, principal_key, and the surface and tool of the write), writers_truncated, declared_fields, origins and tainted_paths. Each entry of origins names its writer the same way. principal_key is the key of the Flux API key or management key that wrote, or of the member; it is null for a writer FoxNose could not identify. A revision keeps its most recent 100 writer entries; writers_truncated counts the older ones dropped. provenance is null for a revision without it.

findings lists each finding's kind, sub_kind, severity, path, detector, detector_version, policy_version, detail and created_at, with three fields in words: title (the name of the finding, such as "Hidden HTML comment"), field_label (the schema name of the top-level field path points into; the field's key or the path itself when the schema has no name for it; null for a finding without a path) and summary (one sentence about what was found in that field). The words come from the catalog.

review is the revision's screening and review state, null for a revision without a screening: state, review_state, verdict, reviewed_by (the key of the member or management key), reviewed_at, reason (the reject reason) and release_policy.

why lists why the revision is or was held, in the shape described under Reviewing held revisions. It is empty for a revision that was not screened and was never reviewed.

untrusted_fields lists the revision's tainted fields: path, field_label, writer_type (unknown when no origin is recorded), cause (writer, declared or schema), reviewed (true after mark as reviewed) and principal_key. needs_review is true when a tainted field has not been reviewed; a later write to the field needs review again.


Marking a Record as Reviewed

POST /v1/:env/collections/:collection/resources/:resource/guardrails/mark-reviewed/

A person vouches for the record's published content. The request has no body. It requires update access to the record and read access to the collection's items, and is refused for an organization whose usage is blocked.

The call creates a revision with the published revision's data and publishes it. Every origin of that revision is the person who made the call, so the fields written by untrusted writers are not tainted in it. A field marked untrusted in the schema is marked reviewed and stays tainted. The previous screening result and findings are copied to it; the content is not screened again. The response has status 201 and holds the created revision's revision_key, number and tainted_paths.

StatusCodeWhen
404resource_not_foundThe record does not exist in the collection
404revision_not_foundThe record has no published revision
409revision_heldA held revision exists for the record
409nothing_to_reviewNo tainted field waits for a review: the record has none, every one is already reviewed, or the collection records no provenance
409screening_in_progressThe published revision has a screening that has not finished
409revision_supersededA newer write replaced the published revision
409guardrails_not_for_filesThe collection is a Files collection

Trust Summaries in Lists

Each record in the collection's record list and detail responses, and each revision in the revision list and detail responses, carries a guardrails object. It is null for a record or revision with no guardrails data, such as one written before the collection was guarded, and for a Files collection.

A record's guardrails describes its current revision: untrusted (the revision has tainted fields), needs_review (a tainted field has not been reviewed), verdict, held (the record has a held revision that is the live screening candidate: being screened, or waiting for a person) and untrusted_fields (path, field_label, writer_type, cause, reviewed, principal_key).

A revision's guardrails has untrusted, needs_review, tainted_paths, state, review_state, verdict, reason (the reject reason), reasons (codes of the verdict's reasons, worded in the catalog), held (the revision was written held for screening; it cannot be changed or published whatever its review state) and untrusted_fields.

The record list takes a guardrails parameter: untrusted returns records whose current revision has tainted fields, needs_review those with a tainted field that has not been reviewed, suspicious those whose current revision has a suspicious verdict, and held those with a held revision that is the live screening candidate. Any other value returns 400 with validation_error.


Catalog

GET /v1/:env/guardrails/catalog/

Returns the wording the API uses, for code that renders findings and states itself. It names nothing of the environment, so any authenticated caller admitted to the environment can read it. The response holds:

  • Name
    kinds
    Type
    object
    Description

    title and description of each finding, keyed by kind or kind:sub_kind.

  • Name
    unicode_classes
    Type
    object
    Description

    title, one and several of each class of hidden or control character a unicode_smuggling finding counts.

  • Name
    severities
    Type
    object
    Description

    What a finding at each policy severity does to a write.

  • Name
    writers
    Type
    object
    Description

    Per writer_type: label, phrase, sentence and named (a sentence with a {name} placeholder).

  • Name
    trust, provenance, verdicts, review_states, screening_states
    Type
    object
    Description

    The label or sentence of each value.

  • Name
    held
    Type
    string
    Description

    The label of a record with a held revision that is the live screening candidate.

  • Name
    causes
    Type
    object
    Description

    One sentence per detail.cause of a screen_unavailable finding.

  • Name
    default_cause
    Type
    string
    Description

    The sentence for a screen_unavailable cause that causes does not list.

Was this page helpful?