Form triggers
A form trigger publishes a public, login-free web page where anyone with the
link can fill in a form and start a workflow run. It is the
business-user counterpart to the webhook trigger: instead of
a server-to-server POST with a secret, a human submits an HTML form.
Each workflow may have one form. It has:
- a unique URL
GET|POST /forms/{token}on the public inference host (https://ai-api.myra.eu), where{token}is a 128-bit random hex string, - an enabled flag and an optional built-in CAPTCHA,
- no secret — the unguessable token is the sole URL guard (the page is meant to be shared). An unknown, disabled, or unpublished form returns a uniform "not available" page, so the token never confirms whether a form exists.
The form fields are derived from the workflow's trigger node schema — the same
input_schema the builder edits and that downstream steps reference as
{{step_0.output.<field>}} (where step_0 is the trigger node's step id). There is
no second schema: the page renders, the server validates, and the graph
references all read the one schema.
The run executes as the workflow's owner (workflow.created_by), with exactly
the tools that owner configured. The submitter supplies only the field values;
the workflow, owner, tenant and gateway are all resolved server-side from the stored
form, so a submitter can never target another workflow, owner or tenant.
A form is public and anonymous
Anyone with the link can start a run that drives the workflow's agents with their full tool access, without signing in. Only enable a form on a workflow you trust with anonymous input. (This is the same posture as a public webhook, but without a shared secret.)
Rendering the form
Returns a self-contained, mobile-responsive HTML page (tenant branding, one input per schema field, an optional CAPTCHA, and a submit button).
The branding header shows the tenant's product name and, on the form page and the
confirmation page, the tenant logo — inlined into the page as a data: image (the page's
Content-Security-Policy allows img-src 'self' data:). The page is white, so the
light-theme logo is used; when the tenant has only the dark-theme logo, it is shown on
a dark-blue plaque. The stored image type is re-checked (PNG/JPEG only); a missing,
malformed or unreadable logo shows the product name only. Error pages (404, 429,
5xx) show the product name only and never read the logo. Query parameter ?lang=de|en
selects the language (otherwise an Accept-Language header starting with de, English fallback).
A method other than GET or POST answers 405 (Allow: GET, POST). The page and the submission share
the same rate limits: 120 requests per minute per IP (IPv6: per /64 — see How the public rate limits behave) and 60 per minute per form (429). The
path token must be 16–64 hex characters; anything else renders the "not available" page.
An unknown, disabled or unpublished form (or a workspace with the workflow feature off) renders the
uniform "form not available" page (404). If the form, the workspace feature, the workflow's current
version or the version row cannot be read (a database error), the page is a retryable error page
with status 503 — never the "not available" page. The same holds for submitting (below) and for
the file upload (503 unavailable).
A form whose workspace is suspended answers exactly like an unpublished one: the same uniform "form not available" page (404, the form's own branding, as for an unpublished workflow, so no new signal appears), nothing is started, and the upload answers 404 not_found. If the workspace's suspension state cannot be read, the answer is the retryable 503 (never the "not available" page, never a started run). Webhook triggers are fenced separately (MAP-4357); the e-mail trigger and the other run sources are stopped at the run claim (MAP-4358). A suspension that lands between the form check and the start of the run leaves one pending run, which is refused at its claim.
The API host is the canonical form origin
The form page is served only by the public inference host
(https://ai-api.myra.eu), which is where the product-generated link points. A link
that instead lands on the app host (https://ai.myra.eu) — mistyped, shortened, or
rewritten by a mail client — is redirected with a method- and body-preserving
307 to the same path on the API host, so it still opens the real form instead of a
blank page. The redirect is intentionally uncacheable, so the canonical origin can be
changed later without stale caches pinning it.
Submitting the form
POST https://ai-api.myra.eu/forms/{token}
Content-Type: application/x-www-form-urlencoded
full_name=Ada&age=42&topic=Sales&__aig_version=<signed>
On success the response is a minimal receipt page — a confirmation and an opaque
reference id (the run id). It never echoes the submitted values and never exposes any
run internals. The submission becomes the run's trigger_input and is available to
the workflow as {{step_0.output.<field>}}.
Accepted request shape
- Method
POST, content typeapplication/x-www-form-urlencodedonly (a JSON or multipart body is rejected). Max body 64 KB. - One parameter per declared field, plus the hidden
__aig_versionbinding token (and, when CAPTCHA is on,__aig_captcha+__aig_captcha_token). - Field values are treated strictly as data — a value containing
{{…}}is stored literally and is never interpreted as a template (single-pass substitution).
What is rejected (fail-closed, 4xx)
| Condition | Status |
|---|---|
| Wrong content type (not urlencoded) | 415 |
| Body over 64 KB / invalid UTF-8 (checked on the whole body however the server buffered it — in memory or spooled to disk) | 413 / 400 |
| The request body was received but could not be read back from the server's temporary file (never treated as an empty submission) | 503 — retry |
| Unknown field (not in the schema) | 400 |
| Missing a required field | 400 |
Wrong type — a number field whose value is not a strict decimal (digits with an optional leading - and an optional decimal point; no exponent, inf, nan, hex, + or whitespace) |
400 |
A select value not in the field's options |
400 |
| A field value over 8 KB, or more than 100 fields | 400 |
| A repeated or valueless parameter (non-string value) | 400 |
| Missing/incorrect CAPTCHA answer (when enabled), or a challenge older than 5 minutes | 400 |
| A CAPTCHA or version token signed by a retired key | accepted while that key is the gateway's secondary master key during a rotation window; afterwards 400 / 409 like any invalid token |
The workflow was re-published since the page loaded (its current version is no longer the one the page was rendered with), or the __aig_version token is missing or not validly signed |
409 — reload the page |
| Unknown/disabled/unpublished form, or the workflow's workspace feature is off, or the workflow's workspace is suspended — also when the form was disabled, its token rotated, or the workflow unpublished between page load and submit | 404 ("form not available" page) |
| Too many submissions (per-IP or per-form rate limit; IPv6: per /64 — see How the public rate limits behave), or 50 or more of the workflow's form runs still in flight | 429 |
The form, the in-flight-run count, the workspace feature, the workflow's current version or the version row could not be read (a database error — never the 404 "not available" page) |
503 — retry |
| The form or workflow row stayed locked past the bound, or no database connection (nothing stored) | 503 — retry |
| Any other database fault | 500 |
| The submitted values cannot be encoded exactly for the run input (nothing is started) | 500 ("something went wrong" page) |
The submission is one transaction: the form must still be enabled and answer to the token
the submitter used, the workflow must still be published, and its current version must be the one
the page was rendered with — all re-checked under locks — and the run is stored together with the
form's last_submitted_at, or neither is.
Per-IP and per-form rate limits plus the in-flight-run cap are the primary anti-abuse controls; the optional CAPTCHA is a lightweight built-in add-on (a visible arithmetic challenge, no third-party service — it deters naive bots, and a solved challenge may be replayed within its short validity window).
The submitted content inherits the platform's PII protection at run execution: values flow through the same guardrails masking on agent-step input, and the workflow delivery egress fence blocks external delivery of a run that touched personal data — exactly like every other trigger kind.
Anonymous file uploads
A form may carry file fields, letting an anonymous submitter attach documents to a run (for example a citizen uploading a form to a public-service workflow). Because the submitter is unauthenticated, uploaded bytes go to a dedicated anonymous store — never the signed-in chat attachment store — with strict, fail-closed limits.
Accepted files. Only this allow-list, and the file's real type is verified from its
magic bytes (not the browser-supplied Content-Type or the filename):
| Type | Accepted as |
|---|---|
application/pdf (%PDF- header) |
|
| PNG | image/png |
| JPEG | image/jpeg |
| WebP | image/webp (RIFF/WEBP header) |
| Plain text | text/plain (valid UTF-8, no control bytes other than tab/newline/carriage-return) |
| Word (.docx) | Office Open XML word document |
| Excel (.xlsx) | Office Open XML spreadsheet |
Rejected (each fails the upload, no bytes stored):
| Rejected input | Why |
|---|---|
Any type not on the allow-list — executables (ELF/PE), scripts, archives, .zip |
Not an accepted type |
A file whose bytes don't match its declared Content-Type or its filename extension |
Spoofed type/extension |
A file part whose declared Content-Type is present but malformed (see Declared file type below) |
Malformed — 400 type_malformed_declared |
Any part with a repeated Content-Type, Content-Disposition or Content-Transfer-Encoding header, or a repeated name/filename disposition parameter |
Malformed — 400 duplicate_header |
A malformed header in any part: a Content-Type or Content-Transfer-Encoding that is present but empty; a header line without :; a header name that is not a plain token (a space or control byte in it, or whitespace before the :); a folded continuation line (starting with a space or tab); a control byte other than tab anywhere in a header line (a bare CR or LF, NUL, DEL); or a Content-Disposition whose parameters are not name=value pairs with a token or one double-quoted value (an unterminated quote, junk after a value) |
Malformed — 400 malformed_header |
| A file over 10 MB | Per-file size cap |
| A submission exceeding 5 files or 25 MB total | Per-submission quota |
A file over the form's x-max-size, or an upload beyond the form's number of file fields |
Schema-bound limit (413 too_large / 409 quota_files) — limits only tighten the store's, never raise them |
| An upload to a form that has no file field, or whose schema is malformed | 400 no_file_field / 400 bad_form_schema |
| An empty file, or a filename that reduces to nothing after sanitizing | Malformed |
| An upload to an unknown, disabled, or decommissioned-tenant form | Fail-closed on the target |
| A file whose bytes are flagged by the malware scanner (when the gateway has opted in) | Infected — 422, nothing stored |
| A file that could not be scanned because the malware scanner is unreachable (when the gateway has opted in) | Fail-closed — 503 + Retry-After, nothing stored |
| The form, its workspace or the whole gateway already holds its live-byte budget of stored anonymous uploads — 500 MB per form, 2 GB per workspace, 20 GB overall (raw file bytes, 1 MB = 1024² bytes; an upload that has expired or been consumed by a submission no longer counts) | 429 upload_budget_exhausted + Retry-After: 600 — nothing stored; retry later |
| The budget or per-submission quota could not be checked (a database error or lock timeout) | 503 quota_check_failed — nothing stored, retry |
The stored content_type is the server-derived type from the magic-byte sniff; the
filename is sanitized (path separators, quotes, control bytes and NUL/CR/LF removed); a
sanitized name longer than 255 bytes is stored as file.<its own extension> (or file) — it is
never cut, because a stored name reaches a workflow agent node and a cut one could carry a fragment
of personal data no masker recognises (the bound is in bytes, so a long name in a
multibyte script no longer fails the submission). The client-declared type and filename are treated
as hostile and used only to reject a mismatch; the extension check reads the sanitized filename
both as sent and exactly as stored, so neither a trailing ;, quote, control byte, dot or ASCII space
can hide a spoofed extension, and the stored name can never create one.
Declared file type. The file part's Content-Type is optional. Its three possible states
are handled differently:
Declared Content-Type |
Result |
|---|---|
Absent (no Content-Type header in the part) |
No constraint — the magic bytes decide the type |
Well-formed — type/subtype (RFC 9110 token characters, at most 255 bytes), optionally followed by ; name=value parameters (value a token or a double-quoted string, e.g. text/plain; charset=utf-8, application/pdf; name="Rechnung; März.pdf"); the whole value at most 1024 bytes; case-insensitive |
Used to detect a spoof: a specific type that differs from the magic-byte type is rejected (415); a generic type (application/octet-stream) or an unknown one imposes no constraint |
Malformed — anything else: no / or an empty side (image/), a second /, a comma list, whitespace inside the type, a parameter without = or with an empty name/value, an unterminated quote, a control byte (NUL, CR, LF, DEL, … — only tab is allowed) anywhere past the surrounding whitespace, non-ASCII outside a quoted value, or an over-long value |
Rejected 400 type_malformed_declared — a garbled type is never treated as absent |
Browsers send the file's type as the operating system reports it, or application/octet-stream;
those are well-formed in practice, so the public form page is not expected to hit this rejection.
A filename may contain ; inside its quoted value (filename="Rechnung; März.pdf") — the whole
quoted value is the filename. Quoting follows the browser (WHATWG) form encoding: a backslash is
an ordinary character (filename="C:\scan\a.pdf" is accepted as sent), and a quoted value ends at
the first ". Browsers percent-encode a " in a filename (%22); a client that instead
backslash-escapes it (filename="a\"b.pdf", as some HTTP libraries do) is rejected
400 malformed_header — send the filename without a literal ".
Malware scanning (fail-closed, opt-in per gateway). Malware scanning is enabled per
gateway (av_scan.enabled in the form's gateway config) and is off by default — a form
whose gateway has not opted in skips this step and the upload proceeds normally. When the
gateway has opted in: after the magic-byte type check and before any bytes are persisted,
the raw file is streamed to a self-hosted ClamAV daemon (clamd, INSTREAM). An infected
verdict rejects the upload (422, signature logged operator-side only — never returned to the
submitter). If clamd cannot be reached, times out, or returns an error, the upload is
rejected, not accepted unscanned — a transient 503 with a short Retry-After so the
widget backs off and re-submits. The virus scanner is configured for your deployment
by Myra and is consulted only for an opted-in gateway.
Configuring a file field (builder)
A form author adds a file field in the workflow builder like any other field. It is
persisted in the same trigger input_schema (there is no second schema) as a string
property carrying a format: "aig-file" sentinel, with optional author narrowing:
"cv": { "type": "string", "title": "CV", "format": "aig-file",
"x-accept": ["application/pdf", "text/plain"], "x-max-size": 2097152 }
x-accept(optional) — the subset of the allow-list above that this field accepts; omitted/empty means every supported type. It is a narrowing on top of the magic-byte allow-list, enforced server-side at submit — never the security boundary.x-max-size(optional) — a per-field byte cap ≤ 10 MB (0/omitted = the store's 10 MB per-file cap). It is enforced at upload time as well as at submit: the public upload endpoint applies the largest cap among the form's file fields (a field without a cap counts as the store's 10 MB), so an oversize file is refused (413too_large) before it is stored. A value that is present but malformed (a string, negative, fractional, boolean,NaN/infinite) is not treated as "no cap": the form's uploads answer400bad_form_schemauntil the schema is fixed.- The form schema gates the upload. The upload endpoint reads the form's current published
schema: a form with no file field accepts no upload (
400no_file_field), and the number of file fields is the file count the submission may hold (so a form with one file field takes one file per submission; more than that is409quota_files). - A form allows at most 5 file fields (the per-submission file quota — the builder blocks a sixth).
- The field's downstream output
{{step_0.output.<key>}}resolves to the file's extracted text (PII-masked on a PII gateway), not the raw bytes — so a file field feeds an agent step exactly like a text field.
Uploading a file
POST https://ai-api.myra.eu/forms/{token}/upload
Content-Type: multipart/form-data; boundary=...
(one file part + an optional submission_token text part)
A file is uploaded to a dedicated endpoint (separate from the form POST above,
which is capped small for its urlencoded body). This endpoint disk-buffers the upload so
it can accept a large body, and applies its own tighter rate limit. The widget on the
form page uploads each attached file here before the form is submitted, then carries
the returned submission_token on the final form POST so the run can claim the files.
Request shape (accepted):
- Method
POST, content typemultipart/form-datawith a boundary. - Exactly one file part — the single part carrying a
filename— per request (upload additional files with additional requests, reusing the samesubmission_token). - An optional
submission_tokentext part. Omit it on the first upload and the server mints one (a 128-bit random value) and returns it; send that same value back on every further upload of the same submission to group the files. - An optional
replacestext part: thefile_idof a file this same submission already holds (and that was uploaded to this same form). That file is retired before the new one is ingested, so changing your mind about a file does not use up the file count (the public form page sends it automatically when a visitor re-picks a file). It requires thesubmission_token; areplacesthat is not a file id is400bad_replaces, one without a token is400bad_request, and an id that is not a live file of this submission and form retires nothing (no error, no oracle for other submissions' ids) and the new file is ingested normally. A repeatedreplacespart is400bad_request. If the new file is then rejected (for example the wrong type), the old file stays retired: the visitor re-uploads, and the form's required-file check catches a submit without one. - Max body 11 MB (server edge cap); the file itself is capped at 10 MB (see the store
limits above). All the file-content, type, quota and form-availability rules from
Accepted files / Rejected above apply here — the file's real type is verified from
its magic bytes and the declared
Content-Type/filename are treated as hostile.
Response (200): a JSON object with the submission_token, the stored file_id, and
the server-derived filename, content_type and size_bytes (the sanitized name and
magic-sniffed type actually persisted):
{ "submission_token": "…", "file_id": "…", "filename": "report.pdf",
"content_type": "application/pdf", "size_bytes": 20481 }
What is rejected (fail-closed, 4xx/5xx, JSON {"error":"<code>"}; every 503 carries Retry-After: 10):
| Condition | Status |
|---|---|
Not POST |
405 method_not_allowed (Allow: POST) |
| Unknown/disabled/unpublished form, or the workflow's workspace feature is off, or the workflow's workspace is suspended, or a malformed path token | 404 not_found (uniform — no oracle) |
Content type not multipart/form-data, or no boundary |
415 unsupported_media_type |
| A file whose magic bytes are not on the allow-list, or don't match the declared type/extension | 415 unrecognized_or_disallowed_type / type_mismatch_declared / type_mismatch_extension |
A malformed declared file-part Content-Type (see Declared file type) |
400 type_malformed_declared |
A repeated Content-Type / Content-Disposition / Content-Transfer-Encoding header (or name/filename parameter) within one part |
400 duplicate_header |
| A malformed part header (see the rejected-input table above) | 400 malformed_header |
Empty body (empty_body), malformed multipart (bad_boundary, no_boundary, malformed, unterminated, header_too_large), no file part (no_file), more than one file part or too many parts (too_many_parts), an empty file (empty), a filename that sanitizes to nothing (bad_filename), a submission_token that is not 32–64 hex characters (bad_submission_token) or a repeated submission_token part (bad_request) |
400 |
| The uploaded body was received but could not be read back from the server's temporary file | 503 unavailable — retry |
File over 10 MB or the field's x-max-size (too_large), or the submission exceeds 25 MB total (quota_bytes) |
413 |
| The submission already holds as many files as the form has file fields (at most 5) | 409 quota_files |
| The form, workspace or gateway live-byte budget is exhausted (500 MB / 2 GB / 20 GB of unexpired, unconsumed uploads) | 429 upload_budget_exhausted with Retry-After: 600 |
| The form has no file field | 400 no_file_field |
The form's x-max-size is malformed |
400 bad_form_schema |
The replaces part is not a file id |
400 bad_replaces |
The retire of the replaces file could not be written (a database error) |
503 retire_failed with a Retry-After header — retry; nothing was stored |
| Malware detected by the scan (when scanning is enabled) | 422 malware_detected |
| The malware scanner is unavailable (fail-closed), or the form's gateway configuration could not be read (so the scan decision cannot be made) | 503 + Retry-After scan_unavailable |
| Too many uploads (dedicated limits: 20 per minute per IP, 20 per minute per form). For IPv6 clients the per-IP limit counts per /64 — see How the public rate limits behave. | 429 rate_limited |
The workflow's availability (workspace feature / suspension state / current version) could not be read (a database error — never the uniform 404) |
503 unavailable — retry |
The form row could not be read (a database error) — before the upload (unavailable) or while storing it (form_unavailable), or the upload quota or budget could not be checked (quota_check_failed) |
503 + Retry-After — retry |
| Server/store fault | 500 store_failed / server_error |
CAPTCHA (forms with the CAPTCHA enabled only). On such a form the upload endpoint checks the CAPTCHA before any file is stored or replaced. A form without the CAPTCHA is unchanged and ignores the three parts below. Send exactly one credential:
- the answered pair: a
captchatext part (the answer) and acaptcha_tokentext part (the token from the form page). The token is valid for 5 minutes and single use per server node: a gateway running several nodes tracks the use on each node separately, so a token can be spent once on every node. The claim is best-effort: under memory pressure on a node an old claim can be evicted, and the 5-minute window and the byte budgets bound that; - or an
upload_prooftext part together with thesubmission_tokenit was issued for.
Every response after a passing check (success or a later error such as quota_files)
carries a fresh upload_proof next to the submission_token. It is valid for 30 minutes,
bound to this form and this submission_token, and lets the same submission upload further
files without answering again. The public form page does all of this automatically: it asks
the visitor to answer the anti-spam question before the first file is sent.
| Condition (CAPTCHA forms) | Status |
|---|---|
| No credential at all | 403 captcha_required |
A wrong answer, a tampered or one-part pair, or an upload_proof that is invalid, expired, belongs to another form/submission, or comes without its submission_token |
403 invalid_captcha |
| A CAPTCHA token older than its 5-minute lifetime | 403 captcha_expired |
| A CAPTCHA token that was already used | 403 captcha_used |
An upload_proof together with a captcha/captcha_token pair, or a repeated one of these parts |
400 bad_request |
The signing key is not available (no master key) — a server misconfiguration: no Retry-After, do not retry |
503 captcha_unavailable |
| The single-use claim could not be written (a store fault) | 503 unavailable with Retry-After: 10 — retry |
The 5-minute CAPTCHA window also bounds the form submit that reuses the same token: a token older than 5 minutes is refused there too, so a visitor who waits longer must reload the page.
The CAPTCHA does not stop a scripted solver: the question is a simple sum. It raises the cost of casual abuse only; the byte budgets below are the hard bound on what an anonymous client can store.
The dedicated per-IP and per-form upload rate limits, the per-submission quota, the
500 MB per-form / 2 GB per-workspace / 20 GB overall live-byte budgets
(429 upload_budget_exhausted, Retry-After: 600), the magic-byte allow-list and the
24-hour retention are the further anti-abuse controls on this leg.
Retention. An uploaded file lives for 24 hours and is then deleted, whether or not it was used. When a run consumes a file it is deleted immediately (single-use, no post-run retention). Deleting the form removes its pending uploads too.
Referencing an uploaded file on submit
The public form page uploads each attached file to the endpoint above before the form
is submitted, then the final urlencoded POST /forms/{token} carries the selection so the
run can claim it:
- each file field carries its returned
file_idas the value under the field's key (<key>=<file_id>); - one hidden
__aig_submissionparameter carries the sharedsubmission_tokenthat claims those files.
The server resolves each file_id against the store from its authoritative stored metadata
and builds the bytes-free file reference. What is rejected at submit (fail-closed, 4xx):
| Condition | Status |
|---|---|
| A required file field with no uploaded file | 400 |
A file_id that is not a live upload under the submitted submission_token (unknown, expired, already-consumed, or forged) |
400 |
A file_id bound to a different form than the one being submitted |
400 |
A missing or malformed __aig_submission token |
400 |
The same file_id reused across two file fields |
400 |
The stored (magic-sniffed) type not in the field's x-accept |
415 |
The stored size over the field's x-max-size |
413 |
These checks re-enforce the field's x-accept/x-max-size narrowing on the authoritative
server-derived type and size (the browser's client-side check is only a convenience
mirror, never the authz boundary), and bind each file to the form it was uploaded to —
so a file uploaded to one form can never be referenced into another form's run (which would
otherwise resolve the live PII fence against the wrong gateway).
PII. Uploaded content inherits the platform's PII protection at run execution — identical to the form's text fields: when the run feeds a file's content to an agent step, the guardrail masking runs live against the form's gateway before anything reaches a model, and the workflow delivery egress fence blocks external delivery of a run that touched personal data.
How a run consumes an uploaded file
A submitted file does not travel through the workflow run as bytes. On submission the
form records a small, bytes-free file reference as the value of the file field inside
the run's trigger_input — a store handle plus metadata (content_type, size,
name), never the file content (run input is size-bounded). At the very start of the
run the trigger node consumes each reference: it fetches the bytes from the anonymous
store, extracts them to text with the same document extractor the chat file-analysis path
uses (a .docx yields structure-preserving Markdown — headings, lists, pipe tables — with a
graceful fall back to flat text for an enormous or unreadable document), applies the live
PII fence, and replaces the reference with the resulting text —
so {{<trigger>.output.<field>}} yields the file's (masked) text to downstream agent
steps, and the reference (including its single-use claim token) never reaches a model.
The reference is untrusted and validated fail-closed at consumption; a reference that is malformed, points at a missing / expired / already-consumed file, or resolves to an unknown or disabled form fails the run closed (it never proceeds with a raw reference or empty content). A file reference is honoured only for form-triggered runs — a webhook or manually-triggered run cannot drive an anonymous-store consume.
The live PII fence is re-evaluated at consumption from the form's gateway's effective
configuration — the same folded, cached configuration the inference path uses (the tenant's
mandatory-masking flag included; coherent within an instance on every admin write, bounded by
config_cache_ttl across instances, see the config reference)
— never a verdict stored at upload time (which could go stale if the gateway's PII policy
changes within the file's 24-hour life). Persisted content is a strict leg: nothing re-scans
the run state, the runner templates it into every later step and a Deliver step emits it, so the
tenant's PII mandate binds here exactly as it does on an outbound web-search query — a local-only
gateway's model-leg exemption does not apply:
- gateway not masking PII and no PII mandate on the tenant → the extracted text is used as-is;
- a PII mandate in force (tenant-enforced masking) but no reversible masker
(
pii_protector) on the gateway — a detector-less, custom-keyword-only or scrub-only gateway → the content is withheld behind the placeholder[content withheld: personal-data masking is mandatory for this tenant and this gateway has no reversible masker](fail closed; previously such a gateway persisted the content raw); - gateway masking PII (a
pii_protector, acustom_piiblacklist, or apresidiodetector withaction: "scrub"or"block") → the text is masked before it is stored in the run state, with exactly the maskers the gateway applies to chat — those detectors (apresidiodetector withaction: "block"redacts its entities in place on this path, the rule stored content gets), plus the workflow owner's personal keywords and the extra maskers of the owner's role; itsregex/keyworddetectors apply at the agent step that reads the content (and at a cut), so no raw personal data is ever persisted in run history: reversible tokens ([MYRA-REDACT-…],[MYRA-CUSTOM:…]), Presidio labels (<EMAIL_ADDRESS>), and the operator's scrub placeholders. The fence's token map is thrown away, so a persisted token is an opaque placeholder — it is never restored later in the run or in a Deliver step. Under a mandate the text is masked at the mandate floor (PERSON/LOCATIONunioned into the detector's entity list at the German0.6bar whatever itslanguagesays). A gateway that masks only some values (a keyword blacklist, a scrub-only detector) masks exactly those — the same coverage it gives a chat turn.
The persistence leg never forwards on a masker error. On this leg an analyzer or masker error
or timeout always withholds the content — whatever a detector's fail_open says, and also for
a presidio scrub detector, which is open by default on the chat tool seam. This rule is scoped to
the persistence leg: the model leg and the chat tool seam keep their documented fail_open
behaviour. A wholly-local gateway's chat leg still skips masking, but its persisted trigger content
is masked like any other gateway's.
Content is withheld only for one of these causes (each a stable literal, recorded on the run as
trigger_masking.cause for an email or form trigger — see
the run fields):
| cause | when | persisted placeholder |
|---|---|---|
config_unavailable |
the gateway's configuration could not be loaded (a transient error; a gateway that does not exist stays a permanent ingest error) | [content withheld: the gateway's data-protection settings could not be loaded] |
mandate_no_masker |
a PII mandate is in force and the gateway has no reversible pii_protector |
[content withheld: personal-data masking is mandatory for this tenant and this gateway has no reversible masker] |
masker_unavailable |
the Presidio analyzer or anonymizer could not be reached or answered an error | [tool result withheld: PII scan unavailable] |
masker_error |
the custom_pii / regex / keyword masker raised, the keyword set could not be resolved, or the masked text could not be proven well-formed |
[tool result withheld: PII scan unavailable] |
budget_exhausted |
masking did not finish within the per-call budget | [tool result withheld: PII scan unavailable] |
A withhold of one chunk of a long text is not a whole withhold: that chunk is replaced by the
placeholder and the masked rest is used. A form run whose uploaded file is wholly withheld is
created but stops before its first step (status: "failed", error_code: "content_withheld";
the raw file is never stored, so the run cannot be re-run) and the workflow owner is notified.
The extracted text is size-capped so one file cannot overflow a run step's output; an over-cap extraction is truncated (with an explicit notice), never silently dropped. A PDF attachment is likewise read up to a 200-page bound (raised from a previous silent 20-page limit), and if pages beyond that were dropped the consumed text carries an explicit "only the first N of M pages were extracted" notice. A scanned PDF (no text layer) is read via OCR, and the consumed text is labelled "Read via OCR — may contain transcription errors; verify specific figures/dates against the source" (the same low-confidence caveat the chat and web-fetch paths apply), so a downstream agent qualifies OCR'd figures instead of treating them as authoritative.
Managing a form (any authoring user)
Form config uses the same gate as the other workflow triggers: the WORKFLOWS_AUTHOR
permission (the built-in member, ki_manager, tenant_admin, or admin roles, or a
custom role granting it; viewer/demouser are refused 403).
| Method | Path | Purpose |
|---|---|---|
GET |
/admin/v1/gateways/{gateway}/workflows/{id}/form |
Show the form: { "form": { "id", "enabled", "captcha_enabled", "last_submitted_at", "url_path": "/forms/<token>" } }, or { "form": false } |
POST |
/admin/v1/gateways/{gateway}/workflows/{id}/form |
Create it (409 if one exists). Body (optional): name (string, default Form, cut to 255 chars), captcha_enabled (strict boolean, default off). 201 { "id", "enabled": 1, "captcha_enabled", "url_path" } |
PATCH |
/admin/v1/gateways/{gateway}/workflows/{id}/form |
enabled / captcha_enabled (strict booleans) and/or regenerate_token: true (a discrete action; must be a JSON boolean) |
DELETE |
/admin/v1/gateways/{gateway}/workflows/{id}/form |
Remove it + cancel the workflow's pending form runs. 200 { "ok": true }; no form → 404 |
Every route first checks gateway access and the workspace workflow feature (off → 403 { "error": "feature_disabled", "feature": "workflows" }); an unknown workflow on that gateway → 404. The URL token is returned on every GET (there is no secret to hide). Creating a form and regenerating its token are refused 403 while impersonating a user.
Creating a form (POST): a non-boolean captcha_enabled → 400 { "error": "captcha_enabled must be a boolean", "code": "invalid_field", "field": "captcha_enabled" }. A workflow that already has one answers 409 { "error": "form already
exists" } — also when two creates race and the second one meets the first in the database. A workflow
deleted while the request was in flight answers 404. A short database conflict (a deadlock with a
concurrent write) is retried by the gateway itself; if it keeps conflicting, or the workflow is locked
by a change that does not finish within a few seconds, the answer is
503 { "error": "temporarily unavailable; retry later" } and nothing was created, so the request can
simply be sent again.
Disabling, regenerating the token, or deleting the form cancels the workflow's
still-pending form runs and clears their submitted trigger_input — so a form is a
real kill switch and no submitter data lingers on a cancelled run. The change and the cancel are
one transaction:
- PATCH validates every field first (
enabled,captcha_enabled,regenerate_token; a non-booleanenabled/captcha_enabled→400 { "error": "<field> must be a boolean", "code": "invalid_field", "field": "<field>" }) and applies them together or not at all. A PATCH with no field to change returns the current form. A presentregenerate_tokenthat is not a JSON boolean is400 { "error": "regenerate_token must be a boolean", "code": "invalid_field", "field": "regenerate_token" }(null= absent). A rotation and a disable in the same PATCH cancel the pending runs once, with reasonform_token_regenerated. The response is the form as read back inside the same transaction. A workflow without a form →404. - DELETE removes the form and cancels its pending runs together.
A failure leaves the form and the runs as they were: 503 { "error": "temporarily
unavailable; retry later" } when nothing was written (send it again), any other database fault
500 { "error": "internal error", "request_id": "<id>" }.
Numbers in form-upload responses are written exactly. If a response cannot be encoded, the upload answers 500 with { "error": "internal error", "code": "response_encode_failed" } (it used to answer an empty {}); see Error codes.