Skip to main content
A Flow is a named automation that Diligent runs for you — for example KYC enrichment or adverse-media review. You start a run with an API call; the work happens in the background. This guide covers the public run API: how to trigger a run, how to read the result, and how the async lifecycle works.
You need a published Flow and its flowId. Find both in the Diligent dashboard, or ask your Diligent contact.

How a run works

Starting a run is asynchronous. POST /flows/{flowId}/runs validates the input, queues the run, and returns immediately with a run id. It does not wait for the Flow to finish. Poll GET /flow-runs/{runId} until status is terminal, or register a webhook for flow_run_completed and flow_run_failed. A webhook carries the terminal run object, including an inline report or output_ref when present; structured output is read separately with GET /flow-runs/{runId}/output. There is no result in the trigger response. Typical statuses: COMPLETED, FAILED, CANCELLED, and SKIPPED are terminal. Once a run reaches one of these, status does not change again.

Quick start

1. Trigger a run

input must match the Flow’s active version input schema. The fields below are an example — use the schema for your Flow.
Response (202 Accepted):
Save id. That is the only handle you have for polling. If input does not match the schema, the call fails immediately with 400 and does not queue a run:
A 404 with FLOW_NOT_FOUND means the flowId does not exist or belongs to another customer. A 409 with NO_ACTIVE_VERSION means the Flow has no published active version.

2. Poll the run

Call Get Run with the id from step 1. Repeat until status is terminal.
While the run is in progress:
When the run completes:
What to read from the completed run: Fields that are not yet available are omitted rather than returned as null. A completed structured-only Flow may have output_ref without report, so use status to determine whether the run is finished.

3. Read structured output (optional)

Some Flows also produce structured output (JSON). If Get Run shows output_ref set, read it with Get Run Output:
Response: the output itself. Its fields depend on the Flow, and every object key is snake_case:
If the run has no structured output, this endpoint returns 404 with OUTPUT_NOT_AVAILABLE.

Examples

Poll until the run finishes (bash)

Poll every 3 seconds and stop when the status is terminal. Then print the report.

Poll until the run finishes (Python)

Failed run

When execution fails, polling still ends on a terminal status. Read error instead of report.

Polling guidance

  • Poll GET /flow-runs/{runId} for the simplest integration, or use flow_run_completed and flow_run_failed webhooks to receive the terminal run object.
  • Start with a 2–5 second interval. Runs can take seconds to minutes depending on the Flow.
  • Stop when status is COMPLETED, FAILED, CANCELLED, or SKIPPED.
  • Persist the run id in your system so you can resume polling after a restart.
  • Read report when present; a completed Flow may produce structured output without Markdown.
  • Call the output endpoint only after output_ref is set.

Next steps