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. The only way to read the result today is to poll GET /flow-runs/{runId} until status is terminal. There is no result in the trigger response, and no push of the finished report on the run API. 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.

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: report is null until the run completes. Do not treat a missing report as a finished empty result.

3. Download structured output (optional)

Some Flows also write a structured output file (JSON). If Get Run shows output_ref set, request a short-lived download URL:
Response:
Download url before it expires (currently 300 seconds). 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} — that is the current way to learn status and read report.
  • 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.
  • Treat report as ready only when status is COMPLETED.
  • Call the output-url endpoint only after output_ref is set. The download URL expires quickly; fetch the file right away.

Next steps