Skip to content

Flows 4 min read

Building flows

A flow is a chain of API steps on a canvas. Connect nodes, pass values between them, and decide what happens when one fails.

Here is a small checkout-smoke flow for a payments API. Run it, then switch scenarios to see how failures travel through the graph.

checkout-smoke
  1. POST /auth/token get_token queued
  2. POST /payments create_payment queued
  3. Delay Delay 2s wait_for_settlement queued
  4. Module verify-refund verify_refund queued
DELETE run_when: always /payments/{id} cleanup queued
  1. Press Run flow to stream events.
Pick a scenario, then run it. Success edges carry the run forward; the cleanup step has run_when: always, so it still runs after a failure — unless an input it needs was never produced.

Three things to notice:

  • A failure stops the success path. Nodes after a failed step are skipped, not failed.
  • Cleanup still runs because it is marked run_when: always.
  • Unless it can’t. When /payments fails, there is no payment_id to delete, so cleanup is skipped and records missing_inputs.
NodeUse it to…
RequestSend an HTTP request, then extract outputs and assert on the response.
DelayWait a fixed time — for APIs that settle asynchronously.
ModuleRun another flow as a step. Pass values in, read values back. This is how you reuse flows.
Set VariableSet a value for later nodes.
AssertCheck something as its own step.
BranchTake different paths based on a condition.
LoopRepeat part of the flow.
PollRepeat a request until a condition is met.
SSESubscribe to a server-sent events stream.
Webhook WaitWait for matching webhook events while the flow runs.

The canvas has all ten. The CLI’s flows node add covers request, delay, module, and webhook_wait; build the rest on the canvas or in a full flow definition.

Edges follow either the success or the error path, so a failing request can lead somewhere different from a passing one.

Each node also has a run_when:

ValueThe node runs…
on_success (default)only when the path before it succeeded
alwayseven after an upstream failure — ideal for cleanup

A node that does not run is marked skipped. The execution records a skip_reason, plus missing_inputs when a value it needs was never produced.

Anything in {{double braces}} gets filled in at run time:

You writeYou get
{{create_payment.payment_id}}The payment_id output of node create_payment
{{BASE_URL}}, {{API_TOKEN}}Values from the environment
{{$uuid}}, {{$email}}Fresh test data from dynamic variables

Everything in the demo above can be scripted. You need:

  • a parent flow (<flow-id>) and a child refund-check flow (<child-flow-id>);
  • BASE_URL and API_TOKEN pointing at a test API;
  • a child flow that accepts a payment_id input and has a node check_refund with a refund_status output.

The example API creates payments at POST /payments and returns the ID in $.id. Give every node an explicit ID so references and edges line up.

1. Create the payment and expose its ID

Terminal window
echopoint flows node add <flow-id> --type request --id create_payment \
--name "Create payment" --method POST --url "{{BASE_URL}}/payments" \
--headers '{"Authorization": "Bearer {{API_TOKEN}}", "Content-Type": "application/json"}' \
--body '{"amount": 4200, "currency": "eur"}'
echopoint flows node output add <flow-id> create_payment \
--name payment_id --extractor json_path --path "$.id"

2. Wait, then verify the refund in a child flow

Terminal window
# Delay is in milliseconds
echopoint flows node add <flow-id> --type delay --id wait_for_settlement \
--name "Wait for settlement" --duration 2000
echopoint flows node add <flow-id> --type module --id verify_refund \
--name "Verify refund" --flow-id <child-flow-id> \
--input 'payment_id={{create_payment.payment_id}}' \
--output refund_status=check_refund.refund_status

3. Connect them

Terminal window
echopoint flows edge add <flow-id> --from create_payment --to wait_for_settlement
echopoint flows edge add <flow-id> --from wait_for_settlement --to verify_refund

4. Add cleanup that always runs

--after creates the success edge for you.

Terminal window
echopoint flows node add <flow-id> --id cleanup --type request \
--run-when always --after verify_refund \
--name "Delete test payment" --method DELETE \
--url "{{BASE_URL}}/payments/{{create_payment.payment_id}}" \
--headers '{"Authorization": "Bearer {{API_TOKEN}}"}'

Validate the structure — every referenced node exists, bindings resolve, edges connect real nodes:

Terminal window
echopoint flows validate <flow-id>

Look at the saved flow, definition included, as JSON:

Terminal window
echopoint flow view <flow-id> -o json

The Flow Library sorts flows into folders. Create a folder, move flows in bulk, or drag one onto a folder. The CLI has the same thing under flows folder.

Next: Outputs & assertions · Tags & search · Flow history · Echopoint AI