Workflow DSL reference
A workflow is a JSON document with "schema": "rightful.workflow/v1". The field tables on this page are generated from the service’s code (rightful/workflow.py) every time the site is built, so the types, defaults and limits are always the ones the server enforces. Unknown fields are rejected everywhere. For the ideas behind the fields, read workflows first.
A minimal workflow:
{ "schema": "rightful.workflow/v1", "key": "selfie-check", "steps": [ {"id": "liveness", "type": "gestures"}, {"id": "match", "type": "face_match", "config": {"against": [{"reference": "profile_photo"}]}} ], "inputs": {"reference_images": {"required": ["profile_photo"]}}}Check a definition without saving it with POST /v1/workflows/validate. The response’s plan shows every step with the policy that will apply to each outcome, defaults included.
Top level
Section titled “Top level”| Field | Type | Notes |
|---|---|---|
schema | "rightful.workflow/v1" | Always rightful.workflow/v1. |
keyrequired | string | Your name for the workflow, used in POST /v1/sessions and the URL of PUT /v1/workflows/{key}. |
name | string | A description for people. Not shown to the person being verified. |
ui | Ui | Languages, theme, delivery and allowed origins. See ui. |
consent | Consent | Who shows the consent text. See consent. |
inputs | Inputs | Reference photos the app sends. See inputs. |
limits | Limits | Time and attempts. See limits. |
stepsrequired | (GesturesStep | LightStep | IdPortraitStep | FaceMatchStep | NameMatchStep | IdExpiryStep | IdBarcodeStep | VoiceEnrolStep | VoiceMatchStep)[] | One to eight steps, run in order. See steps. |
decision | Decision | How the final decision is made. See decision. |
output | Output | How much the result says, and which images are kept. See output. |
review | Review | The hosted review page. See review. |
| Field | Type | Notes |
|---|---|---|
locales | ("en" | "fr" | "ar" | "es-419" | "pt-BR" | "pt" | "sw" | "ha" | "yo" | "ig" | "am")[] | Languages the page may use. English and French are reviewed; ar, es-419, pt-BR, pt, sw, ha, yo, ig and am are machine-drafted. |
default_locale | "en" | "fr" | "ar" | "es-419" | "pt-BR" | "pt" | "sw" | "ha" | "yo" | "ig" | "am" | Must be one of locales. A session’s locale overrides it. |
theme | Theme | Overrides the app theme field by field for this workflow. See the theme schema. |
delivery | ("redirect" | "embedded")[] | redirect: the app sends the person to the page. embedded: the app shows it in an iframe. See embedding. |
allowed_origins | string[] | Pages that may frame the check. Required for embedded. https:// origins, or http://localhost for development. |
return_origins | string[] | When set, a session’s return_url must be on one of these origins, or creation fails with 422 RETURN_URL_NOT_ALLOWED. Set it on every workflow, so a leaked API key cannot turn the page into an open redirect. Empty accepts any http(s) URL. |
consent
Section titled “consent”| Field | Type | Notes |
|---|---|---|
mode | "hosted" | "app_attested" | hosted: the page shows the platform’s consent text and records the answer. app_attested: your app collected consent and sends consent: {reference, at} when creating the session; without it creation fails with 422 CONSENT_REQUIRED. |
text_version | string | The version of the platform consent text. Leave the default. |
inputs
Section titled “inputs”inputs.reference_images declares the photos the app sends with reference_images (or as reference_sessions), by label.
| Field | Type | Notes |
|---|---|---|
required | string[] | Labels the app must send. A missing or unknown label fails creation with 422 REFERENCE_IMAGES_MISMATCH. |
optional | string[] | Labels the app may send. When one is not sent, a face_match against it is skipped (recorded as NOT_SUPPLIED) and the step is judged on the comparisons that were made. |
Labels are lowercase identifiers (^[a-z][a-z0-9_]{0,31}$) and must be unique across both lists.
limits
Section titled “limits”| Field | Type | Notes |
|---|---|---|
session_ttl_seconds | integer | After this the session expires if it has not completed. |
max_attempts | integer | Capture attempts per session, the first one included. A retry policy never goes past it. |
Every step has an id (unique, lowercase, used in results and decision rules), a type, an optional config and an optional on block of policies.
Order rules
Section titled “Order rules”- The first capture step must be
gestures. - Capture steps (
gestures,light,id_portrait) run at most once each, in that order. id_portraitneeds alightstep before it.- Server checks (
face_match,name_match,id_expiry,id_barcode) that read the ID name an earlierid_portraitstep. embeddeddelivery cannot includelightorid_portrait.
gestures
Section titled “gestures”The person makes gestures drawn at random from pool on every attempt, so a recording cannot answer.
| Field | Type | Notes |
|---|---|---|
pool | ("SMILE" | "OPEN_MOUTH" | "BLINK" | "TURN_LEFT" | "TURN_RIGHT")[] | Any of SMILE, OPEN_MOUTH, BLINK, TURN_LEFT, TURN_RIGHT, without duplicates. |
count | integer | Count | How many gestures: a number, or {"min", "max"} for a random count. At most the size of pool. |
The screen shows a sequence of colours and the server checks the face reflects that sequence. A mismatch (failed) can never be retried.
| Field | Type | Notes |
|---|---|---|
protocol | "color_sequence" | The only protocol today. |
skip | "off" | "review" | "continue" | Whether the person may skip the light check, for example because flashing colours bother them. review (the default): they may, and a session that would otherwise be approved goes to review with the reason light_skipped. continue: they may, and your decision settles it like any other outcome. off: they may not. |
A skipped light check is reported like every other step: in the session’s checks, the light step has the outcome skipped and the reason skipped_by_person, so you always know which checks passed and which were skipped. With skip: "continue" and decision.mode: "rules", you can decide what a skip leads to yourself:
"decision": { "mode": "rules", "rules": [ {"if": {"all": [{"step": "liveness", "is": "passed"}, {"step": "light", "is": "skipped"}, {"step": "match", "band_at_least": "strong"}]}, "then": "approve", "reason": "light_skipped"}, {"if": {"all": [{"step": "liveness", "is": "passed"}, {"step": "light", "is": "passed"}, {"step": "match", "band_at_least": "strong"}]}, "then": "approve"} ], "otherwise": "review"}A person who presses Stop during a step is told apart from a camera or connection failure: the step’s reason is stopped_by_person (or page_left when the page was closed), and if that ends the session the session’s reason is, for example, light_stopped_by_person.
id_portrait
Section titled “id_portrait”The person photographs their ID. The server crops the portrait and reads the document type from the printed text.
| Field | Type | Notes |
|---|---|---|
capture | ("same_device" | "phone_handoff")[] | same_device: the camera the check started on. phone_handoff: on a computer, offer a QR code so the photo can be taken with a phone, then carry on on the computer. Offered only over HTTPS. |
accept | ("passport" | "pr_card" | "driver_licence" | "photo_id_card" | "health_card" | "unknown")[] | Document types to accept: passport, pr_card, driver_licence, photo_id_card, health_card, unknown. Omit to accept any. Ontario and Quebec restrict requiring a health card outside health services, so leave health_card out unless you are one. A health card’s image is never kept. |
review | boolean | After the photo is taken, show it with a short checklist and **Use this photo**, **Retake** (up to 3 times) or **Take the photo myself** (up to 10 tries). Nothing is checked until the person confirms. false checks the photo as soon as it is taken. |
liveness | IdLivenessConfig | Whether the ID is a physical card rather than a screen showing one or a copy. See ID liveness below. |
The check records capture (auto or manual) and retakes in its measurements.
ID liveness
Section titled “ID liveness”Every ID photo is also checked, with no extra step for the person, for signs that it is not a physical card, such as a photo of the ID shown on a screen or a photocopy. A flagged photo adds id_screen_recapture or id_photocopy to the ID check’s reasons, and a session that would otherwise be approved goes to review. When the check cannot run, the reason is id_liveness_not_computed and the session goes to review too: it is never treated as a pass.
| Field | Type | Notes |
|---|---|---|
mode | "off" | "passive" | passive (the default): checked on every ID photo. off: not checked. |
review_at | number | The attack score (0 to 1) at or above which the photo is flagged and the session goes to review. Default 0.8. |
decline_at | number | The attack score at or above which the session is declined. None by default, so a flagged photo only sends the session to review. Must be at least review_at. |
The scores are in the ID check’s measurements (liveness), for apps that receive them. See also the light step, which defends the face side against replays.
face_match
Section titled “face_match”A 1:1 match on the server between the live face (the best frame from the gestures step) and one or more references. Only a server-side frame is used, never one sent by the browser.
| Field | Type | Notes |
|---|---|---|
againstrequired | Against[] | One to three references. Each passes only if its band reaches min_band; the step takes the worst. |
min_band | "strong" | "possible" | The band each comparison must reach. Below it, possible is inconclusive and weak is failed. |
Each entry of against names exactly one of:
| Field | Type | Notes |
|---|---|---|
reference | string | A label declared under inputs.reference_images: a photo the app sends, or a reference_sessions entry. |
step | string | An earlier id_portrait step: match against the ID portrait. |
If no face is found in an image, the match is retried once on an enhanced copy.
name_match
Section titled “name_match”Reads the name printed on the ID and compares it with the session’s subject_name, which the app must send (422 SUBJECT_NAME_REQUIRED).
| Field | Type | Notes |
|---|---|---|
fromrequired | string | The id_portrait step whose photo is read. |
- One name: the ID must show exactly that name.
- Two names: both must appear, in either order.
- Three or more: the first and last must both appear; middle names may differ.
Case and accents are ignored, and hyphens match spaces. Passports are read from their machine-readable lines. Unreadable text is inconclusive, not a mismatch. Only which names matched is kept; the text read from the card is neither stored nor returned.
id_expiry
Section titled “id_expiry”| Field | Type | Notes |
|---|---|---|
fromrequired | string | The id_portrait step whose ID is read. |
min_days_valid | integer | Days of validity the ID must have left. 0 means valid today. |
The expiry comes from a passport’s machine-readable zone (check digit verified), or else from a date printed next to an expiry label. Unlabelled dates are never guessed from. An unreadable date is inconclusive.
id_barcode
Section titled “id_barcode”After the front of a licence or photo card is confirmed, the person turns it over, and the server checks that the PDF417 barcode on the back agrees with the front. A barcode is easy to fake, so this only adds a mismatch signal; it never confirms a name the front did not show.
| Field | Type | Notes |
|---|---|---|
fromrequired | string | The id_portrait step whose card this is. |
types | ("driver_licence" | "photo_id_card" | "unknown")[] | Document types for which the back is asked for. For unknown, the person sees a “my ID has no barcode” option. |
optional_on_computer | boolean |
Policies
Section titled “Policies”on sets what happens for each outcome other than passed.
| Field | Type | Notes |
|---|---|---|
inconclusive | Retry | Final | The step could not tell, for example a weak face match or an unreadable date. |
failed | Retry | Final | The step’s check did not pass. |
capture_error | Retry | Final | The capture itself did not work, for example no face in view. Server checks never report it. |
A policy is either a retry:
| Field | Type | Notes |
|---|---|---|
actionrequired | "retry" | |
maxrequired | integer | How many times this step may trigger a retry in one session. |
then | Final | What to do once the retries are used up, or max_attempts is reached. |
or a final action:
| Field | Type | Notes |
|---|---|---|
actionrequired | "review" | "decline" | "continue" | review or decline end the session with that declared decision. continue carries on with the next step, but an approve at the end becomes review. |
reason | string | A short code returned as the session’s reason, such as weak_match. Defaults to <step id>_<outcome>. |
Rules for policies:
retryis only allowed on capture steps. A retry re-runs the whole capture chain with fresh challenges.continueis only allowed on server checks.- A
lightstep’sfailedpolicy cannot be a retry.
When a step has no policy for an outcome, these apply:
| Outcome | Default |
|---|---|
capture_error |
Retry up to 2 times, then review with reason capture_unreliable |
inconclusive |
Retry once, then review |
failed |
review |
decision
Section titled “decision”Applies when every step has run and no policy ended the session.
| Field | Type | Notes |
|---|---|---|
mode | "all_passed" | "rules" | all_passed: approve when every step passed. rules: use the first matching rule. |
rules | Rule[] | Checked in order; the first rule whose condition holds decides. Needed for mode: "rules". |
approve | "approve" | "review" | With all_passed: what to declare when every step passed. review makes a workflow that never approves on its own. |
otherwise | "approve" | "review" | "decline" | With all_passed: what to declare when not every step passed. With rules: when no rule matched. |
| Field | Type | Notes |
|---|---|---|
ifrequired | Cond | AllOf | AnyOf | A condition, or {"all": [conditions]}, or {"any": [conditions]} (1 to 8 each). |
thenrequired | "approve" | "review" | "decline" | The declared decision when it holds. |
reason | string | The session’s reason when this rule decides. |
Condition
Section titled “Condition”| Field | Type | Notes |
|---|---|---|
steprequired | string | A step id of this workflow. |
is | "passed" | "inconclusive" | "failed" | "capture_error" | "skipped" | The step’s outcome. |
band_at_least | "strong" | "possible" | For a face_match step: its band is at least this. |
A condition has exactly one of is and band_at_least. For example:
"decision": { "mode": "rules", "rules": [ {"if": {"all": [{"step": "liveness", "is": "passed"}, {"step": "match", "band_at_least": "strong"}]}, "then": "approve"}, {"if": {"step": "match", "is": "failed"}, "then": "review", "reason": "different_person"} ], "otherwise": "review"}output
Section titled “output”| Field | Type | Notes |
|---|---|---|
detail | "verdict" | "checks" | "scores" | verdict: no per-step checks. checks: each step’s outcome, reasons, band and policy version. scores: also the raw measurements. |
evidence | Evidence | Which images to keep. See evidence. |
evidence
Section titled “evidence”| Field | Type | Notes |
|---|---|---|
return | ("live_face" | "id_portrait" | "id_card")[] | Any of live_face, id_portrait, id_card, without duplicates. id_portrait and id_card need an id_portrait step. Must be empty when retention_days is 0. |
retention_days | integer | How long images are kept after completion, at most 7. |
when | "always" | "review" | always: every completed session. review: only sessions that end in review. |
See evidence and retention for how images are encrypted and deleted.
review
Section titled “review”| Field | Type | Notes |
|---|---|---|
link_days | integer | How long the review link works after completion. |
allowed_origins | string[] | Your pages that may show the review page in an iframe. Empty: none. |
decide_in | "page" | "app" | page: the reviewer approves or declines on the review page. app: the page shows checks and images only, and your app records the decision with POST /v1/sessions/{id}/review. |
See review links.
A complete example
Section titled “A complete example”{ "schema": "rightful.workflow/v1", "key": "interview-identity", "name": "Introcall: confirm the applicant before the interview (live face + photo ID + name on the ID)", "ui": { "locales": [ "en", "fr" ], "default_locale": "en", "delivery": [ "redirect" ] }, "consent": { "mode": "hosted", "text_version": "2026-11b" }, "limits": { "session_ttl_seconds": 1200, "max_attempts": 3 }, "steps": [ { "id": "liveness", "type": "gestures", "config": { "pool": [ "SMILE", "OPEN_MOUTH", "BLINK", "TURN_LEFT", "TURN_RIGHT" ], "count": 3 }, "on": { "capture_error": { "action": "retry", "max": 2, "then": { "action": "review", "reason": "capture_unreliable" } }, "inconclusive": { "action": "retry", "max": 1, "then": { "action": "review", "reason": "liveness_not_observed" } }, "failed": { "action": "review", "reason": "liveness_guard_tripped" } } }, { "id": "light", "type": "light", "on": { "inconclusive": { "action": "retry", "max": 1, "then": { "action": "review", "reason": "light_unclear" } }, "capture_error": { "action": "retry", "max": 1, "then": { "action": "review", "reason": "light_unclear" } }, "failed": { "action": "review", "reason": "light_mismatch" } } }, { "id": "id", "type": "id_portrait", "on": { "capture_error": { "action": "retry", "max": 1, "then": { "action": "review", "reason": "id_unreadable" } }, "inconclusive": { "action": "retry", "max": 1, "then": { "action": "review", "reason": "id_unreadable" } }, "failed": { "action": "review", "reason": "document_not_accepted" } }, "config": { "accept": [ "passport", "driver_licence", "photo_id_card", "pr_card", "unknown" ] } }, { "id": "expiry", "type": "id_expiry", "config": { "from": "id" }, "on": { "inconclusive": { "action": "review", "reason": "id_expiry_unreadable" }, "failed": { "action": "review", "reason": "id_expired" } } }, { "id": "match", "type": "face_match", "config": { "against": [ { "step": "id" } ], "min_band": "strong" }, "on": { "inconclusive": { "action": "review", "reason": "face_id_weak_match" }, "failed": { "action": "review", "reason": "face_id_mismatch" } } }, { "id": "name", "type": "name_match", "config": { "from": "id" }, "on": { "inconclusive": { "action": "review", "reason": "id_name_unreadable" }, "failed": { "action": "review", "reason": "id_name_mismatch" } } }, { "id": "barcode", "type": "id_barcode", "config": { "from": "id" }, "on": { "inconclusive": { "action": "continue" }, "failed": { "action": "review", "reason": "id_barcode_mismatch" } } } ], "decision": { "mode": "all_passed", "approve": "approve", "otherwise": "review" }, "output": { "detail": "checks", "evidence": { "return": [ "live_face", "id_card" ], "retention_days": 7 } }, "review": { "link_days": 7, "allowed_origins": [ "https://introcall.si", "https://www.introcall.si" ] }}More are on the example workflows page.