Mint a throwaway preview session for the KYC policy editor
/v1/kyc/policy/draft/preview-sessionRequires an API client bearer token.
Mints a short-lived (15 minute), throwaway preview session so the console's step-through preview pane can render the open editor draft — or, when no draft exists, the current active policy as-is — inside the real hosted capture widget. `source` reports which one was actually used. `capture_url` uses the SAME URL shape `POST .../capture-session` produces, but its `#token=preview` fragment is never redeemable: no `capture_sessions` row is ever created for a preview mint. No `Idempotency-Key` is required — every call mints a brand-new, independently expiring session. 400s `unknown_flow` for a `flow_key` naming no lineage. A draft carrying a `workflow` previews with the level snapshots publishing would take, and is refused exactly as publish refuses it: 409 `level_unavailable`, 400 `invalid_workflow`. 503s with problem code `preview_unavailable` when this environment has no console origin configured to frame a preview session. The LEVEL form (`level: { level_key, display_name, definition }`, optional `screen`) previews one level as the editor holds it — saved or not — as a one-level workflow, with `source: level`; `flow_key` then only picks the branding (default `default`), `screen` names the screen key to open on, and a definition that does not validate is a 400 `invalid_level` with `problems`. Requires the programme_admin role and shares `PUT .../draft`'s looser rate-limit class.
Request body
One of
Option 1
Option 2
+ show properties− hide properties
Example
curl -X POST https://api.rigid.fi/v1/kyc/policy/draft/preview-session \
-H "Authorization: Bearer $RIGID_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"programme_id": "uuid"
}'Responses
200A minted, throwaway preview session and ready-made capture-widget URL.
400Validation error
401Authentication required
403Forbidden
409A level the draft workflow references is missing or archived (code `level_unavailable`, `levels`)
500Internal server error
503No console origin is configured to frame a preview session (`code: preview_unavailable`) — this environment has no `KYC_PREVIEW_FRAME_ORIGIN` set.