Synchronous vs Asynchronous Evaluations

Synchronous evaluations return a decision immediately. Asynchronous evaluations pause for user action and deliver results via webhook.

RiskOS™ evaluations follow one of two execution patterns depending on the workflow configuration: synchronous (immediate response) or asynchronous (paused for user action, results via webhook).


Comparison

AspectSynchronousAsynchronous
ResponseDecision returned in the API responseevaluation_paused status returned; decision delivered via webhook
Workflow stepsNo user-interaction steps (OTP, DocV, Wait, Hosted Flow)Contains at least one user-interaction step
Typical use casesIdentity verification, fraud screening, risk scoringDocument verification, OTP challenges, multi-step onboarding
Webhook requiredOptional (for case updates, watchlist alerts)Required (for receiving the final decision)
LatencyMilliseconds to secondsSeconds to hours (depends on user action)

Synchronous execution

sequenceDiagram
    participant App as Your Application
    participant RiskOS as RiskOS™

    App->>RiskOS: POST /api/evaluation
    RiskOS->>RiskOS: Input → Enrichments → Rules → Decision
    RiskOS-->>App: 200 OK (decision + enrichment data)

The workflow completes all steps in a single request-response cycle. The API returns the decision, enrichment data, tags, reason codes, and scores.

When workflows are synchronous

A workflow is synchronous when it contains no user-interaction steps. All enrichment calls, conditions, transformations, and decisions execute server-side without requiring input from the end user.


Asynchronous execution

sequenceDiagram
    participant App as Your Application
    participant RiskOS as RiskOS™
    participant User as End User

    App->>RiskOS: POST /api/evaluation
    RiskOS->>RiskOS: Input → Enrichments → ...
    RiskOS->>RiskOS: Reach async step (OTP / DocV / Wait / Hosted Flow)
    RiskOS-->>App: 200 OK (evaluation_paused + eval_id)
    App->>User: Prompt for action
    User->>RiskOS: Complete action (verify OTP, capture document, etc.)
    RiskOS->>RiskOS: Resume → remaining steps → Decision
    RiskOS-->>App: Webhook: evaluation_completed (decision + data)

The workflow pauses when it reaches a step that requires user action. RiskOS™ returns a response with evaluation_paused status and the eval_id. When the user completes the action, the workflow resumes and delivers the final decision via webhook.

Steps that make a workflow asynchronous

StepWhat it waits for
OTPUser enters a one-time passcode sent via SMS, voice, or email
DocV (Predictive Document Verification)User captures a government-issued ID (and optional selfie)
WaitAn external API PATCH call resumes the workflow
Hosted FlowUser completes a Socure-hosted data collection or verification page

Handling paused evaluations

When an evaluation pauses, your application should:

  1. Store the eval_id from the initial API response.
  2. Direct the user to complete the required action (redirect to Hosted Flow URL, launch DocV SDK, or prompt for OTP).
  3. Listen for webhooks: Subscribe to evaluation_completed and evaluation_paused events.
  4. Process the final decision from the webhook payload.

Forcing a resume

If you need to skip a paused step (for example, the user abandoned the flow), send a PATCH request:

PATCH /api/evaluation/{eval_id}
{
  "actions": {
    "resume": true
  }
}

The paused step is skipped (produces no output), and the workflow continues from the next step.

Ending a paused evaluation

To terminate a paused evaluation entirely:

PATCH /api/evaluation/{eval_id}
{
  "actions": {
    "end": true
  }
}

Webhook events for async evaluations

EventWhen it fires
evaluation_pausedWorkflow reaches an async step and pauses
evaluation_completedWorkflow resumes, completes, and returns a final decision
workflow_execution_failedWorkflow encounters an unrecoverable error during execution

Important: Evaluation webhook events are sent only for asynchronous workflows. If your workflows don't contain async steps, you won't receive these events. Subscribe to decision_update and case events for post-decision notifications.


Related concepts