Current application API reference

Routes currently mounted
in this application.

This reference describes implemented routes. Examples are illustrative and do not establish production availability, document-extraction capability, or a supported integration. The browser playground accepts structured data only.

Explore the structured-data playground → View endpoint reference
Current route reference

Implemented endpoints

These routes are mounted by this Express application. Public examples are not proof of a customer deployment or production service commitment.

MethodPathAuthDescription
POST /api/triage A configured non-test key with kyc:execute is required by this route. This reference does not promise key issuance or production access. flw_test_ trial/sandbox keys cannot submit documents. The mounted route accepts KYC document data for the fixed individual_kyc_document_triage_v1 workflow. Its suggested outcome and evidence are for human review; this reference does not establish customer onboarding or production availability. The public playground accepts structured data only.
GET /api/triage/:caseId Active API key with the kyc:execute scope; tenant-scoped for live keys. Fetch the governed triage record by its immutable case UUID without mutating the audit chain.
POST /api/sandbox/ephemeral-token None Issue a client-generated session identifier for associating browser playground runs.
POST /api/sandbox/decide None; intended for the browser playground. Run synthetic structured-data examples for individual KYC or business KYB without uploading documents. The response is illustrative and does not establish document processing, production screening, or customer outcomes.
POST /api/financial-decisions/entities A live tenant API key with the financial:decide scope. Trial and sandbox keys are not accepted. Record the latest upstream-reported verification profile and metadata-only identity, business/ownership, UBO, sanctions, PEP, and AML evidence for an opaque tenant entity reference. The application does not independently verify caller-supplied source claims.
POST /api/financial-decisions A live tenant API key with the financial:decide scope. Trial and sandbox keys are not accepted. Capture a caller-supplied lending, insurance, or payment decision snapshot together with the latest profile and monitoring evidence. Missing, unverified, expired, revoked, or adverse evidence queues human review; this endpoint does not auto-approve or decline a decision.
GET /api/financial-decisions/:decisionId A live tenant API key with the financial:decide scope. Results are restricted to that key’s tenant. Return the immutable caller snapshot, evidence snapshot, current escalation/reviewer state, linked monitoring events, and governed audit events.
POST /api/financial-decisions/entities/:entityReference/monitoring-events A live tenant API key with the financial:decide scope. Trial and sandbox keys are not accepted. Accept a push-based source update, append it idempotently, and immediately re-evaluate linked decisions. A new escalation is explained and routed for human review.
GET /health None Return a lightweight liveness response without querying the database.
POST /api/triage Run KYC triage

The mounted route accepts KYC document data for the fixed individual_kyc_document_triage_v1 workflow. Its suggested outcome and evidence are for human review; this reference does not establish customer onboarding or production availability. The public playground accepts structured data only.

Authentication: A configured non-test key with kyc:execute is required by this route. This reference does not promise key issuance or production access. flw_test_ trial/sandbox keys cannot submit documents.
Limits: flw_test_ trial/sandbox keys cannot submit documents; these requests are denied before test-key quota accounting.

JSON body

FieldTypeRequiredDescription
id_document string At least one Base64 string or data URI for an identity document.
proof_of_address string No Base64 string or data URI for proof of address.
selfie string No Base64 string or data URI for a selfie.
applicant_email string No Applicant email address.
applicant_name string No Applicant name when known.
nationality string No Applicant nationality, preferably an ISO 3166-1 alpha-2 code.
address_country string No Address country, preferably an ISO 3166-1 alpha-2 code.

JSON response

FieldTypeDescription
case_id string Immutable UUID audit reference for this triage case.
execution_id string Governed execution identifier linking policy, model, evidence, actions, and audit events.
workflow_key / workflow_version / policy_version string Fixed workflow and active policy registry metadata.
model_profile / model_version string Server-selected registry profile and version; never caller-selected.
decision string Suggested route for a human reviewer: APPROVE, ESCALATE, or REJECT.Enum: APPROVE | ESCALATE | REJECT
risk_score integer Application-generated score to support human review; not a final compliance determination.
risk_factors string[] Human-readable factors that contributed to the score.
aml_flags object[] AML findings, including flag, severity, and detail where present.
sanctions_hits object[] Matched sanctions records; an empty array means no match was found.
extracted_data object Document-extracted identity fields.
evidence_provenance object[] Document type, source reference, SHA-256 digest, access/retention class, and extraction provenance. Raw document bytes are not persisted.
original_decision / effective_decision string Automated decision and current review outcome. A reviewer override never changes the original.
review_status / audit_status string Review queue state and immutable audit commit state.
ai_model string Registry model name used by the approved inference proxy.
processing_time_ms integer Elapsed time reported for this request; not a performance commitment or benchmark.
audit_logged boolean Always true for a successful response; the request fails if the final immutable audit transaction cannot commit.

Status codes

StatusMeaningWhen it happens
200 Success Decision returned.
400 Bad request No document supplied, invalid base64, or an unrecognized X-FlowAI-Execution-Mode value.
401 Unauthorized The key is missing, unknown, revoked, expired, or lacks the kyc:execute scope.
403 Forbidden A flw_test_ trial/sandbox key attempted document processing, or agent_test was requested without its required scope.
500 Server error Triage processing failed.
503 Temporarily unavailable Agent execution is blocked while database-backed incident mode is active; response code is INCIDENT_MODE_ACTIVE.
GET /api/triage/:caseId Retrieve an audit case

Fetch the governed triage record by its immutable case UUID without mutating the audit chain.

Authentication: Active API key with the kyc:execute scope; tenant-scoped for live keys.

Path parameter

FieldTypeRequiredDescription
caseId string (UUID) Yes The case_id returned by POST /api/triage.

JSON response

FieldTypeDescription
id integer Database row identifier.
case_id string (UUID) Unique triage case identifier.
applicant_name string | null Applicant name.
applicant_email string | null Applicant email.
applicant_dob string | null Applicant date of birth.
nationality string | null Applicant nationality.
id_type / id_number / id_country string | null Extracted identity-document fields.
address_country string | null Extracted address country.
decision / original_decision / effective_decision string Suggested workflow outcome and current human-review outcome.
risk_score integer Risk score from 0 to 100.
risk_factors / aml_flags / sanctions_hits JSON Persisted scoring and screening details.
workflow_key / policy_version / model_profile / model_version string Governance registry metadata.
evidence_provenance / reviewer_override / audit_events JSON Evidence metadata, optional reviewer event, and chronological hash-chain events.
processing_time_ms integer | null Elapsed time reported for this request; not a performance commitment or benchmark.
created_at string (date-time) Audit event creation timestamp.
is_demo boolean Whether the persisted event is marked as a demo.

Status codes

StatusMeaningWhen it happens
200 Success Audit event returned.
404 Not found No case exists for the supplied UUID.
POST /api/sandbox/ephemeral-token Create a playground session

Issue a client-generated session identifier for associating browser playground runs.

Authentication: None
Limits: The response advertises a 1-hour lifetime; the decide route uses the identifier for tracking.

Request body

No request body.

JSON response

FieldTypeDescription
session_id string Opaque pg_-prefixed playground session identifier.
expires_in integer Lifetime in seconds; currently 3600.

Status codes

StatusMeaningWhen it happens
200 Success Session identifier returned.
POST /api/sandbox/decide Run a structured playground decision

Run synthetic structured-data examples for individual KYC or business KYB without uploading documents. The response is illustrative and does not establish document processing, production screening, or customer outcomes.

Authentication: None; intended for the browser playground.
Limits: 20 runs/hour per IP. Send X-Playground-Session or session_id to associate a run with a session.

JSON body and optional header

FieldTypeRequiredDescription
payload_type string No individual_kyc (default) or business_kyb.Enum: individual_kyc | business_kyb
session_id string No Optional fallback session identifier when the X-Playground-Session header is not used.
applicant_name / date_of_birth string No Individual KYC identity fields.
nationality / address_country string No Individual country fields.
document_type / id_number / document_expiry string No Individual document fields; passport is the default document_type.
company_name / registration_number / jurisdiction string No Business KYB entity fields.
industry_code string No Structured business industry code.
beneficial_owners object[] No Business owner objects; each may include string name/full_name/nationality and numeric ownership_pct fields only.

JSON response

FieldTypeDescription
decision string Illustrative sample route label for human review: APPROVE, ESCALATE, or REJECT.Enum: APPROVE | ESCALATE | REJECT
risk_score integer Risk score from 0 to 100.
risk_factors / aml_flags / sanctions_hits JSON Scoring and screening details.
ubo_sanctions object[] Business-owner sanctions matches.
bank_reference object Mock bank lookup result.
reasoning_chain object[] Human-readable reasoning steps.
payload_type string Resolved request type.
playground boolean Always true for this route.

Status codes

StatusMeaningWhen it happens
200 Success Playground decision returned.
400 Bad request The payload type or a top-level / beneficial-owner field is not an allowed structured playground field.
429 Rate limited 20 playground runs in the last hour for the IP.
500 Server error Playground triage processing failed.
POST /api/financial-decisions/entities Record a verified-entity profile

Record the latest upstream-reported verification profile and metadata-only identity, business/ownership, UBO, sanctions, PEP, and AML evidence for an opaque tenant entity reference. The application does not independently verify caller-supplied source claims.

Authentication: A live tenant API key with the financial:decide scope. Trial and sandbox keys are not accepted.

JSON body

FieldTypeRequiredDescription
entity_reference / idempotency_key string Yes Tenant-scoped opaque entity key and replay key.
entity_type string Yes individual, business, organization, merchant, corporate, or other.
verification_status string Yes Upstream status: verified, unverified, pending, revoked, expired, or unknown.
source_name / source_reference string Yes Provider or source label and its opaque record reference.
captured_at date-time Yes Source capture time.
expires_at date-time No Optional source-reported expiry.
evidence object Yes Metadata-only check objects for identity, business/ownership (including UBO where supplied), sanctions, PEP, and AML.

JSON response

FieldTypeDescription
entity_reference / verification_status / entity_type string Tenant-scoped profile identity and latest upstream status.
source object Source name/reference, capture/expiry times, evidence digest, and upstream_reported attestation.
idempotent_replay boolean True when the same tenant/entity idempotency key was already recorded.

Status codes

StatusMeaningWhen it happens
201 Created Profile metadata recorded.
200 Replay Existing profile returned for a repeated idempotency key.
400 Bad request Invalid metadata, raw document data, or oversized evidence.
403 Forbidden A trial/sandbox key or a key without a live tenant was used.
POST /api/financial-decisions Attach evidence to a financial decision

Capture a caller-supplied lending, insurance, or payment decision snapshot together with the latest profile and monitoring evidence. Missing, unverified, expired, revoked, or adverse evidence queues human review; this endpoint does not auto-approve or decline a decision.

Authentication: A live tenant API key with the financial:decide scope. Trial and sandbox keys are not accepted.

JSON body

FieldTypeRequiredDescription
decision_type string Yes lending, insurance, or payment.
entity_reference / idempotency_key string Yes Profile reference and tenant-scoped replay key.
decision_snapshot object Yes The caller’s original decision context; raw identity-document bytes are not accepted.

JSON response

FieldTypeDescription
decision_id / original_decision_snapshot object Immutable captured decision and original caller snapshot.
evidence_snapshot object Attached profile/monitoring evidence, source references, timestamps, and evidence digest.
review object Current review state, stable reason codes, and provenance explanation for each escalation.

Status codes

StatusMeaningWhen it happens
201 Created Decision and evidence snapshot recorded.
200 Replay The prior record is returned for a repeated idempotency key.
400 Bad request Invalid decision type or missing fields.
403 Forbidden A trial/sandbox key or a key without a live tenant was used.
GET /api/financial-decisions/:decisionId Retrieve a financial decision

Return the immutable caller snapshot, evidence snapshot, current escalation/reviewer state, linked monitoring events, and governed audit events.

Authentication: A live tenant API key with the financial:decide scope. Results are restricted to that key’s tenant.

Path parameter

FieldTypeRequiredDescription
decisionId string (UUID) Yes The decision_id returned by POST /api/financial-decisions.

JSON response

FieldTypeDescription
original_decision_snapshot / evidence_snapshot object Tenant-scoped immutable decision and attached evidence provenance.
review object Current review state, reason codes, explanations, and reviewer rationale.
current_monitoring_events / audit_events object[] Monitoring updates and hash-chain timeline.

Status codes

StatusMeaningWhen it happens
200 Success Decision returned for the authenticated tenant.
404 Not found No decision with that identifier exists in the authenticated tenant.
POST /api/financial-decisions/entities/:entityReference/monitoring-events Record an entity monitoring event

Accept a push-based source update, append it idempotently, and immediately re-evaluate linked decisions. A new escalation is explained and routed for human review.

Authentication: A live tenant API key with the financial:decide scope. Trial and sandbox keys are not accepted.

Path parameter and JSON body

FieldTypeRequiredDescription
entityReference string Yes Opaque tenant-scoped entity reference.
idempotency_key string Yes Tenant/entity-scoped replay key; duplicate events do not create duplicate audit entries.
source_name / source_reference / occurred_at string / date-time Yes Upstream source provenance and source event time.
findings object Yes Metadata-only screening or monitoring findings.

JSON response

FieldTypeDescription
event object Persisted event with source reference, timestamp, and digest.
reevaluated_decisions object[] Current review state and reason-code explanations for linked decisions.
idempotent_replay boolean True for an already-recorded tenant/entity idempotency key.

Status codes

StatusMeaningWhen it happens
201 Created Event recorded and linked decisions re-evaluated.
200 Replay Previously recorded event returned without duplicate re-evaluation.
400 Bad request Invalid event metadata or oversized findings.
403 Forbidden A trial/sandbox key or a key without a live tenant was used.
GET /health Check service health

Return a lightweight liveness response without querying the database.

Authentication: None

Request body

No request body.

JSON response

FieldTypeDescription
status string Always ok when the process is live.

Status codes

StatusMeaningWhen it happens
200 Success { "status": "ok" }.
Error handling

Common JSON errors

Every documented failure uses an error string. Rate-limit responses add the route-specific upgrade field shown below.

StatusRoutesJSON shapeCorrective action
400 POST /api/triage { "error": "At least one document (id_document, proof_of_address, or selfie) is required." } Send at least one string document value as base64 or a data URI.
401 POST /api/triage { "error": "API key not found, expired, revoked, or insufficiently scoped." } Use an active API key with the kyc:execute scope. flw_test_ keys cannot submit documents to this endpoint.
403 POST /api/triage { "error": "This key cannot submit documents to the mounted route." } Document-processing access and any non-test key issuance must be confirmed separately with FlowAI. Controlled agent testing also requires X-FlowAI-Execution-Mode: agent_test and the kyc:customer-upload-test scope.
404 GET /api/triage/:caseId { "error": "Case not found." } Use the case_id returned by POST /api/triage.
429 POST /api/sandbox/decide { "error": "...", "upgrade_cta": "..." } Wait for the playground quota window to reset; it allows 20 runs/hour per IP.
500 POST /api/triage; POST /api/sandbox/decide { "error": "Triage processing failed. Please try again." } Retry with the same JSON after checking service health at /health.
Working example

POST /api/triage

Illustrative example only. Do not use sample data for compliance decisions. The browser playground accepts structured data only; document processing requires separately confirmed production access.

bash / cURL
curl -X POST https://www.flowaifinance.com/api/triage \
  -H "Authorization: Bearer $FLOWAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "id_document": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=",
    "applicant_name": "Jane Doe",
    "applicant_email": "jane.doe@acme.com",
    "nationality": "US",
    "address_country": "US"
  }'
200 response
{
  "case_id": "550e8400-e29b-41d4-a716-446655440000",
  "execution_id": "550e8400-e29b-41d4-a716-446655440001",
  "workflow_key": "individual_kyc_document_triage_v1",
  "workflow_version": "1.0.0",
  "policy_version": "1.0.0",
  "model_profile": "private",
  "model_version": "private-kyc-v1",
  "decision": "APPROVE",
  "original_decision": "APPROVE",
  "effective_decision": "APPROVE",
  "risk_score": 4,
  "risk_factors": ["Missing fields: date_of_birth, id_number"],
  "aml_flags": [],
  "sanctions_hits": [],
  "extracted_data": {
    "full_name": "Jane Doe",
    "date_of_birth": null,
    "nationality": "US",
    "id_type": "passport",
    "id_number": null,
    "id_country": "US",
    "address_country": "US",
    "document_expiry": null
  },
  "ai_model": "gpt-4o",
  "evidence_provenance": [{ "document_type": "ID Document", "sha256_digest": "…", "access_class": "restricted", "retention_class": "metadata_only" }],
  "review_status": "not_queued",
  "audit_status": "complete",
  "processing_time_ms": 1842,
  "audit_logged": true
}

Open the structured-data playground →

FAQ

Developer questions, straight answers

The questions integration teams ask before wiring FlowAI — answered with the same brevity as on /faq.

What is /api-docs and how is it different from /docs?

/api-docs describes routes currently mounted in this Express application. Request examples are illustrative and do not promise production access, customer onboarding, document support, or an integration.

Can I get a sandbox key?

The public browser playground at POST /api/sandbox/decide accepts structured data only; it does not process uploaded documents. A flw_test_ key cannot submit documents to POST /api/triage. Production access and document-processing scope must be confirmed with FlowAI.

Where does the audit trail live, and can I export it?

The mounted triage route records execution and audit information as implemented in this application. This reference does not claim regulator acceptance, a standardized export, or a customer production deployment.

Does the live API reference include webhooks?

No. This page documents routes currently mounted in the app. Webhook delivery, signing, retries, and plan entitlements are not offered in this public reference.

The name="api-docs-faq" attribute on every <details> makes the accordion exclusive — opening one closes the others automatically. No JavaScript required.

Discuss evaluation scope

Share the workflow you want to evaluate. This form does not promise a key, production access, timing, or supported workflows. The public structured-data playground is synthetic and does not process documents.

Submitting a request does not confirm key issuance, timing, or production availability.

✓

Request received

Your request has been recorded. The team will review current evaluation scope.
In the meantime, review the route reference or structured-data playground.