Skip to main content

The Zerq workflow builder: a complete guide to visual API orchestration

How to use the Zerq API gateway workflow builder: node types, expressions, templates, and step-by-step instructions for fan-out, routing, and transformation.

  • workflows
  • api-management
  • how-to
  • platform-engineering
Zerq team

Every platform team eventually hits the same wall. A new API requirement arrives: aggregate three microservices into one response, validate the request body before it reaches the backend, route traffic to a new service for a subset of partners. The answer is always the same: write more code, deploy another service, add it to the maintenance backlog.

That code accumulates. Over time it becomes a layer of custom middleware that nobody fully understands, that breaks when backends change, and that takes a sprint to modify. The API gateway exists precisely to absorb this kind of logic, but most gateways make it harder than it needs to be: Kong plugins written in Lua, Apigee policies in XML, AWS Lambda authorizers that are just serverless functions with extra steps. None of these feel like the visual API gateway workflow builder that platform engineers actually want.

Zerq's workflow builder is a visual, node-based canvas attached directly to a proxy. It runs inside the gateway path with no external service, no queue, no additional deployment, and it handles the full range of API orchestration patterns: fan-out aggregation, conditional routing, request validation, response transformation, database enrichment, and error handling. This guide walks through how it works, what the nodes do, and how to use it.

How the workflow builder fits into Zerq

In Zerq, every API you expose is a proxy inside a collection. By default, a proxy is a simple pass-through: request arrives, gateway authenticates and rate-limits it, request forwards to the upstream, response comes back. That covers most cases.

When you need more, you attach a workflow to the proxy. From that point on, every request runs through the workflow graph instead of simple forwarding. The workflow has full access to the request context: method, path, path parameters, query string, headers, body, and the responses from any upstream services it calls.

To open the builder:

  1. Go to Collections and open the relevant collection.
  2. On the row of the proxy you want to add logic to, click Workflow.

An empty workflow shows Add the first step. Click it and pick Incoming request (http_trigger); it takes the route's method and path, and you build from there. A route can also use an existing workflow instead of one built on its own page, so one workflow can serve many proxies.

The canvas and node model

The workflow is a directed acyclic graph (DAG) of connected nodes, which the editor calls steps. Steps flow from left to right: each step is a card with its input on the left edge and labelled outputs on the right edge.

To add a step, click the + on an output that is not connected yet, click the + on a connection to insert a step in the middle, or select a step and press Tab. Then pick the step in the Add a step picker, which is searchable and grouped into Triggers, Flow, Data & transform, AI, Databases, Send & call, and Respond. The new step is placed and connected for you. To connect steps by hand, drag from an output to the input of another step.

Output handles can be:

  • default: the normal execution path for nodes that don't branch
  • success / error: used by nodes that make outbound calls or run code
  • valid / invalid: used by the validate_node, jwt_node (verify) and crypto_node (HMAC verify)
  • loop / done: used by loop_node (each item, then when all items are done)
  • Custom labels: used by condition_node and switch_node for named branches

Nodes that use named outputs are called branching nodes. The engine routes execution to the output whose label matches the node's result. Nodes without named outputs follow all outgoing edges unconditionally. The parallel_node is the exception: it executes all outgoing edges concurrently.

Node categories

Zerq ships 35 node types across eight categories:

CategoryNodes
Triggershttp_trigger, manual_trigger, cron_trigger, kafka_consumer, imap_trigger, workflow_trigger (called by another workflow)
HTTP and proxyproxy_node, http_request_node, response_node
Data processingcode_node, set_node, xml_node, llm_node (prompt any LLM), agent_node (AI agent with HTTP tools and chat memory)
Logic and routingcondition_node, validate_node, switch_node, loop_node, execute_workflow_node (sub-workflows), return_node (hands a result back to the caller)
Flow controldelay_node, parallel_node, merge_node, redirect_node, stop_node
Securityjwt_node, crypto_node
Databasemongodb_node, postgres_node, sqlserver_node, oracle_node, redis_node
Messagingsmtp_node, sendgrid_node, kafka_node

The picker shows display names rather than type ids: Incoming request is http_trigger, Forward to upstream is proxy_node, HTTP request is http_request_node, Set fields is set_node, If is condition_node and Respond is response_node. Searching for a type id such as condition also finds the step.

For API request flows, the entry node is always http_trigger. Every execution path must end at response_node (to return a response) or redirect_node (to issue a redirect). stop_node terminates a branch without sending an HTTP response, which is useful for fire-and-forget side effects like sending a notification after the response has already been sent.

Expressions and data flow

Every node's output is available to all downstream nodes through the $json context object. The syntax is:

$json['node_id'].field.subfield

The http_trigger node always has this structure:

$json['http_trigger'].request.method          // "GET", "POST", etc.
$json['http_trigger'].request.path            // "/accounts/123/summary"
$json['http_trigger'].request.path_params.id  // path parameter {id}
$json['http_trigger'].request.query.limit     // query string ?limit=10
$json['http_trigger'].request.headers['authorization']
$json['http_trigger'].request.body            // parsed request body

For an http_request_node with ID fetch_orders:

$json['fetch_orders'].response.status_code    // 200
$json['fetch_orders'].response.body           // parsed JSON body
$json['fetch_orders'].response.body.items     // nested field

Expressions use double curly brace syntax and support full ES6+ JavaScript:

// URL with path parameter
https://internal.example.com/orders/{{ $json['http_trigger'].request.path_params.orderId }}

// Conditional default
{{ $json['http_trigger'].request.query.limit ? parseInt($json['http_trigger'].request.query.limit) : 20 }}

// Filter upstream array
{{ $json['get_orders'].response.body.items.filter(o => o.status === 'pending').length }}

// Compose JSON for response
{{ JSON.stringify({
  user: $json['get_user'].response.body,
  balance: $json['get_balance'].response.body.amount
}) }}

Node IDs matter. Use descriptive IDs like get_user, fetch_orders, check_balance rather than auto-generated ones. Open a step (double-click it, or select it and press Enter) and click its name in the step editor header to rename it before building expressions that reference it; expressions that already refer to it are updated.

The step editor opens over the canvas with three columns: Input (the data of every earlier step from the last test), Parameters, and Output. Drag a field from Input onto a parameter to insert the matching expression. Press Esc or click Canvas to close it.

Start from a template

Click Or start from a template on an empty canvas, or choose ⋯ › Templates in the header at any time, to open Workflow templates: 41 working graphs grouped by category (Basic, Validation, Advanced, Integration, Logic, Data, Messaging and Email), with a search box. Use template loads one onto the canvas, ready to modify. Four cover the patterns in this guide:

Parallel Two HTTP then Merge (Integration): fan out to two backends and merge the results:

http_trigger → parallel_node → [http_request_node, http_request_node] → merge_node → set_node → response_node

Set then Proxy (Basic): reshape the request before it reaches the upstream (Validate + Transform + Proxy adds a validate_node in front):

http_trigger → set_node → proxy_node → response_node

Switch by Status (Advanced): a different response per upstream status, for fallbacks and friendly errors:

http_trigger → proxy_node → switch_node → [200 response, 404 response, default response]

Conditional Path (Advanced): route on the request itself:

http_trigger → condition_node → [yes: proxy_node → response_node, no: set_node → response_node]

Start with the template closest to your use case, then customize node configuration.

A template keeps its HTTP trigger's method. When that method is not one of the proxy's allowed methods, the builder shows a warning above the canvas and in the Incoming request step's settings, because the gateway would answer those requests with 405 before the workflow runs. Add the method to the proxy if clients will send it, or set the trigger's Method to one the proxy allows.

Step-by-step: build a multi-backend fan-out workflow

This pattern is common in platform engineering: a client requests an account summary, and the response must aggregate data from three separate microservices. Assembling this in application code means writing and maintaining a backend-for-frontend service. In Zerq it is a workflow on the gateway proxy.

Goal: GET /accounts/{accountId}/summary returns a merged response containing account details, recent transactions, and credit score from three separate internal services.

  1. Open Collections, select your collection, click Workflow on the account-summary proxy's row.
  2. Choose ⋯ › Templates, search for Parallel Two HTTP then Merge and click Use template. The canvas opens with a parallel_node fanning out to two http_request_nodes, a merge_node, a set_node and a response_node. Rename the trigger from http_trigger_1 to http_trigger so the expressions below match (renaming a step updates the expressions that reference it).
  3. Rename the first http_request_node (http_a) to get_account. Set its URL to:
    https://accounts.internal/v1/accounts/{{ $json['http_trigger'].request.path_params.accountId }}
    
    Set method to GET, timeout to 3000 ms.
  4. Rename the second http_request_node (http_b) to get_transactions, URL:
    https://ledger.internal/v1/accounts/{{ $json['http_trigger'].request.path_params.accountId }}/transactions?limit=10
    
  5. Select the template's parallel_node, press Tab and pick HTTP request in the Add a step picker. The new step is connected from parallel_node, so it now fans out to all three request steps. Rename it get_credit, URL:
    https://credit.internal/v1/scores/{{ $json['http_trigger'].request.path_params.accountId }}
    
  6. Connect the success output of get_credit to the template's merge_node; the other two are already connected.
  7. Rename the template's set_node to compose_response and replace its assignments with one:
    • Key: summary
    • Value (expression):
    {{ JSON.stringify({
      account: $json['get_account'].response.body,
      transactions: $json['get_transactions'].response.body.items,
      creditScore: $json['get_credit'].response.body.score
    }) }}
    
  8. merge_node already feeds compose_response, which feeds response_node. In response_node, set status 200 and body {{ $json['compose_response'].summary }}.
  9. Add an error path for each backend: click the + on the error output of each http_request_node and pick Respond (response_node), returning status 502 and a structured error body.
  10. Click Save, then click Listen for a request at the bottom of the canvas and send a GET with a test accountId to the test URL. The workflow runs on the captured request: steps that ran turn green, a failed step turns red with its error, and steps that did not run are dimmed. Click any step to see its input and output.
  11. Once the test passes, turn on the Active switch in the header to route production traffic through the workflow.

The three backend calls execute in parallel through parallel_node. merge_node waits for all three to complete before passing control downstream. Typical added latency is under 5ms per node, and the total latency is bounded by the slowest of the three backends, not their sum.

Step-by-step: add request validation with branched error handling

Before the fan-out reaches the backends, you want to validate that the accountId path parameter looks like a valid account identifier. Malformed requests should return 400 immediately, before any backend is called.

  1. Hover the connection from http_trigger to parallel_node, click its + and pick Validate (validate_node). Rename it validate_account_id.
  2. The step is inserted between the two: http_trigger now feeds validate_account_id, which feeds parallel_node.
  3. Open validate_account_id and set its parameters:
    {
      "inputs": {
        "value": "{{ $json['http_trigger'].request.path_params.accountId }}"
      },
      "config": {
        "schema": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9\\-]{8,36}$"
        }
      }
    }
    
  4. Check that the connection to parallel_node leaves from the valid output.
  5. Click the + on the invalid output and pick Respond (response_node). Configure it:
    {
      "status": 400,
      "body": "{\"error\": \"invalid_account_id\", \"message\": \"accountId must be 8-36 alphanumeric characters\"}"
    }
    
  6. Click Save, then choose ⋯ › Validate. Validate checks the workflow's structure (it parses and has exactly one entry trigger); it does not check step settings, expressions or wiring, so prove those with a test run.

With this in place, every malformed request is rejected at the gateway with a deterministic 400 response. The validation runs before any backend call is made.

Conditional routing with condition_node and switch_node

The condition_node evaluates conditions in order and routes to the first matching named output. Use it when the branching logic involves complex predicates:

{
  "id": "n_cond",
  "type": "condition_node",
  "config": {
    "conditions": [
      {
        "condition": "$json['http_trigger'].request.headers['x-partner-tier'] === 'premium'",
        "output": "premium_path"
      },
      {
        "condition": "$json['proxy_1'].response.status_code >= 500",
        "output": "upstream_error"
      }
    ],
    "default_output": "standard_path"
  }
}

Wire named output edges to the corresponding downstream nodes. Always wire the default_output: requests that match no condition fall through to it, and an unwired default silently drops the request.

The switch_node is the right tool when you are branching on a single value with multiple discrete cases:

{
  "id": "route_by_method",
  "type": "switch_node",
  "config": {
    "value_expression": "{{ $json['http_trigger'].request.method }}",
    "cases": [
      { "value": "GET",    "output": "read_path" },
      { "value": "POST",   "output": "write_path" },
      { "value": "DELETE", "output": "delete_path" }
    ],
    "default_output": "method_not_allowed"
  }
}

List GET, POST and DELETE in the proxy's allowed methods. The gateway checks every request against that list before the workflow starts and answers any other method with 405 itself, so the workflow only sees the methods the proxy allows. Wire method_not_allowed to a response_node returning status 405 to cover a method the proxy allows but the switch does not handle. The switch_node uses string comparison internally, so the case values must match exactly including letter casing.

Testing before you enable

Two test modes are available regardless of whether the workflow is enabled.

Test workflow (at the bottom of the canvas, or Ctrl/Cmd + Enter) runs the full graph with the trigger's sample data. The canvas shows the result: steps that ran turn green, the step that failed turns red with its error message underneath, steps that took their own error or invalid branch turn amber, and steps that did not run are dimmed. Click any step to see what it received and returned. To run one step on its own, use Test step.

Listen for a request (next to Test workflow, or in the listen panel of the Incoming request step's editor) opens a temporary URL. Send a real HTTP request to it and the payload is captured, then the workflow runs automatically so you can inspect every step's output in one pass.

Run at least these scenarios before enabling:

  1. A valid request with correct parameters: verify 200 and the expected response body.
  2. A malformed request: verify 400 from the validate_node invalid branch.
  3. A request where one backend returns 500: verify the error branch returns 502 and does not expose internal details.
  4. A request with an invalid auth token: verify 401 is returned by the gateway layer before the workflow runs.
  5. A request with a method the proxy does not list: verify 405 with Method DELETE not allowed for this endpoint (naming the method you sent) before the workflow runs. Send it through the gateway: the Listen for a request test URL accepts any method.

Save, validate, and enable

Save (or Ctrl/Cmd + S) persists the workflow definition. It does not activate production traffic. The header shows Saved or Unsaved changes, and Save is only enabled when there are unsaved changes. While the workflow is off, you can save an incomplete draft; while it is active, every save is validated and an invalid definition is rejected, leaving the live workflow unchanged.

Validate (in the ⋯ menu) runs the same structural check as activation: the definition parses and has exactly one entry trigger. It does not check step settings, expressions or wiring, which is why the test runs above matter.

The Active switch in the header activates the workflow on the proxy. For http_trigger workflows, all live traffic to the proxy that uses one of its allowed methods starts running through the graph; other methods get 405 from the gateway and never reach it. For trigger-based workflows (cron_trigger, kafka_consumer, imap_trigger), enabling starts the production schedulers. Turning the switch off pauses production execution but does not delete it: the proxy falls back to simple pass-through forwarding, and all test modes remain available.

What this looks like in practice

Illustrative scenario, not a specific customer deployment.

A financial data platform manages APIs for a set of B2B partners, each with different data entitlements. The core challenge: partners call a single /portfolio/summary endpoint, but the underlying data comes from four separate microservices: equity positions, bond positions, cash balances, and a risk score engine. The risk score engine is slower than the others and is not required for all partners.

Before Zerq, this aggregation lived in a Node.js BFF service. Every time a microservice changed its response shape, someone had to update the BFF, cut a release, and deploy. The BFF had no visibility into which partner triggered which request.

After migrating to Zerq, the team built a workflow on the portfolio-summary proxy. http_trigger flows into a validate_node that checks the portfolioId format. The valid branch reaches a condition_node that checks whether the partner's access profile includes risk scoring. Both branches fan out to the relevant backends via parallel_node, merge_node collects results, a set_node composes the final response conditional on which fields were populated, and response_node returns the merged payload.

The risk score engine branch is only triggered for partners whose profile has that endpoint in scope. Partners without risk scoring access never touch that backend. The gateway's request log records every request: which partner, which profile, path, status and latency; with tracing on, each workflow node is a span showing which branches ran and the latency of each node. When the equity positions service changed its response schema, the team updated the set_node expression in the workflow builder, saved, validated, and enabled. No application deployment required. Every workflow save is recorded in Zerq's audit log as update_workflow with the saved definition, alongside access control and credential changes, so compliance teams see the full history of who modified what and when. The proxy's History also keeps every save as a version you can compare with the current one and restore.

Closing summary

The Zerq workflow builder gives platform teams a way to handle API orchestration, transformation, validation, and routing directly at the gateway layer, without writing and maintaining custom middleware. The 35 node types cover the patterns that come up repeatedly: fan-out and merge, conditional branching, request validation, response composition, database enrichment, and error handling. The expression system is standard JavaScript with access to every upstream node's output. The built-in test modes let you verify every branch before enabling. And because workflows run inside the gateway process, they inherit the full access control, rate limiting, and audit trail that applies to every other request, including per-node execution records for compliance teams.


Zerq is an enterprise API gateway built for regulated industries — one platform for API management, AI agent access, compliance audit, and developer portal, running entirely in your own infrastructure. See how it works or request a demo to walk through your specific requirements.