Skip to main content

How to test API gateway workflows before they touch production traffic

How to test API gateway workflows before production: test-listen sessions, draft status, the save vs enable gate, and request log evidence for every branch.

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

Gateway workflows are production logic. A node graph that validates payloads, branches on consent status, retries a flaky upstream, or aggregates three backends is doing work that used to live in application code, and it deserves the same discipline: you do not edit it live and hope. Yet that is exactly how most teams operate their gateway layer, because their tooling gives them no way to test API gateway workflows before the change is serving real traffic.

The failure mode is familiar. An engineer adjusts a routing condition on a payments proxy at 4pm, the change takes effect immediately, and the first sign of a mistake is a partner integration throwing 502s. Or the team is so afraid of that scenario that every gateway change waits for a weekly maintenance window, and the gateway becomes the slowest-moving part of the platform.

This post is a practical guide to the promotion path Zerq builds into the workflow builder: how draft status, the save versus enable separation, and test-listen sessions let you build, run, and verify a workflow end to end while production traffic never sees it, and what evidence to collect in the request logs before you flip it live.

Why gateway changes are usually tested in production

Traditional gateways conflate saving a change with deploying it. A Kong plugin config or an Apigee policy attaches to a live proxy the moment you apply it; there is no intermediate state where the logic exists, is executable, and is invisible to consumers. Testing means deploy-and-curl against the real route, with real clients one misconfigured condition away from an outage.

The standard workaround is a parallel staging gateway. That helps, but it introduces its own failure class: staging drifts. The staging instance has different credentials, different upstream URLs, a subset of the plugins, and a config that was hand-synced three sprints ago. A workflow that passes in staging can still fail in production because the environments are not the same object. And for orchestration logic specifically, staging tells you the final status code, not which branch executed or what each step produced, so a workflow that returns 200 for the wrong reason passes the test.

The deeper problem is granularity. A gateway workflow is a graph. When a test fails, the question is never just "did it return 500" but "which node failed, with what input, and which branch did the graph take instead." A black-box curl against a staging host cannot answer that. You need the gateway itself to expose per-node execution results, and you need a way to run the graph without enabling it.

Testing API gateway workflows in Zerq: three independent gates

Zerq separates a workflow's existence from its exposure with three controls that fail closed, meaning production traffic only reaches workflow logic when every gate is deliberately opened.

Gate 1: draft status hides the proxy entirely

Every collection and every proxy in Zerq carries a status of draft or published. A draft proxy is not routable through the gateway and is hidden from the developer portal, even if its parent collection is published. A draft collection hides all of its proxies regardless of their individual status. Publishing is explicit in both directions: publishing a collection does not auto-publish its proxies, and duplicating a collection creates every copied proxy in draft so a clone can never leak live by accident.

This is the outermost gate. While you are building a new orchestration, the proxy simply does not exist as far as clients and partners are concerned.

Gate 2: save and enable are decoupled

Inside the workflow builder, clicking Save and turning on the Active switch in the header are separate actions with separate semantics. Save persists the node graph. Enable activates it. The Management API accepts them independently or together:

// PUT /api/v1/proxies/:id/workflow

{ "workflow_definition": { ... } }
// save only: persists the graph, no validation, nothing activates

{ "workflow_enabled": true }
// enable only: backend validates the saved definition at this moment

{ "workflow_definition": { ... }, "workflow_enabled": true }
// save and enable in one request: validated as a unit

The asymmetry is deliberate. While a workflow is disabled you can save half-finished graphs, disconnected nodes, unconfigured steps, whatever state your work-in-progress is in. The moment workflow_enabled flips from false to true, the backend validates the definition: it must parse as a workflow and have exactly one valid entry trigger. A graph that fails validation does not enable. Saving a new definition to an already-enabled workflow re-validates it, so you cannot degrade a live workflow into an invalid state either. A valid save to an enabled workflow goes live at once, though. To change a live workflow without exposing the change, keep it in Workflows: there you save and test a draft, proxies run the published version, and publishing is the moment the change goes live.

One caveat the docs are explicit about, and it matters for your test plan: structural validation confirms the graph is well formed, not that every runtime branch behaves. A workflow can validate cleanly and still route the wrong payload down the wrong branch. Scenario testing, covered below, is what catches that.

Gate 3: production triggers require enabled and published together

For workflows driven by schedulers rather than inbound HTTP, such as cron_trigger, kafka_consumer, and imap_trigger workflows, the trigger scheduler applies one eligibility rule:

eligible := proxy.WorkflowEnabled && proxy.Status == "published"

Both flags must be true before a scheduler starts a worker. When either flips false, the scheduler cancels the worker and releases its coordination lock; when the definition of an eligible workflow changes, the scheduler reconciles in three phases, cancel, drain, then start, so an update never runs two versions concurrently. The practical consequence: you can fully configure a Kafka-consuming compliance workflow, enable it, and it still consumes nothing until you publish the proxy. The publish action becomes your go-live moment, and it is a single reversible toggle.

Run the graph without enabling it: test-listen sessions

Gates keep untested logic away from production. Test-listen modes are how you actually exercise it. Every trigger type in the builder has a test mode that captures a real event and runs the full downstream graph, and none of them check workflow_enabled. This is enforced in the backend handlers: test execution works identically on enabled and disabled workflows, so you test the exact graph you are about to promote, on the same gateway instance, against the same backends and credentials it will use in production. No staging drift, because there is no staging copy.

For an HTTP-triggered workflow, the loop looks like this:

  1. Open the workflow: go to Collections, open the collection, click Workflow on the proxy's row. The canvas opens with your saved graph.
  2. Click Listen for a request next to Test workflow at the bottom of the canvas (or use the listen panel in the Incoming request step's editor). The builder starts a test session, and the canvas shows Waiting for a request… with a temporary test URL.
  3. Copy the test URL and send a realistic request to it with curl, Postman, or your integration test suite. Use sanitized payloads, not production PII; the URL is a temporary test endpoint, not a production webhook.
  4. The builder captures the request and executes the downstream workflow with the captured path, query, headers, and body. The canvas shows the result: steps that ran turn green, a failed step turns red with its error, steps that took their error or invalid branch turn amber, and steps that did not run are dimmed.
  5. Click each step to see its input and output. This is the step a staging curl cannot give you: per-step inputs and outputs, which branch an If step (condition_node) took, what a backend call returned, what the Respond step (response_node) finally shaped.
  6. Fix, save, and repeat. Sessions are short-lived, around ten minutes, and one listener runs per workflow at a time, so a fresh session cancels the previous one.

Email-triggered workflows get the same treatment with Listen for an email, next to Test workflow: the builder connects to the configured mailbox read-only, captures the first unseen message with its subject, from, body_text, and uid fields, and runs the graph. Because the test mode never marks messages as seen, you can replay the same email across sessions while you iterate.

For cron_trigger, kafka_consumer, and manual_trigger workflows there is no external event to capture, so Test workflow at the bottom of the canvas (or Ctrl/Cmd + Enter) injects representative mock trigger data instead: a cron test run receives triggered_at, schedule, timezone, and run_id; a Kafka test run receives topic, partition, offset, key, message, and headers. Downstream steps see the same shape they will see in production, so expressions like {{ $json['kafka_consumer'].message }} are exercised for real.

The release matrix: what to prove before you publish

A workflow that handles the happy path is half tested. Before promoting, run a scenario matrix that proves the deny and error branches too. For a typical partner-facing workflow, the minimum set:

  • Authentication: a valid token returns 200; a missing token returns 401; a token with the wrong audience or scope returns 403.
  • Profile isolation: the same request with a different X-Profile-ID confirms the access profile boundary holds, and a method the profile blocks returns 405 with HTTP method not allowed.
  • Method boundary: a method the profile allows but the proxy's allowed methods do not include returns 405 with Method DELETE not allowed for this endpoint (naming the method sent) before the workflow runs, so no node executes. List every method your clients send on the proxy; the builder warns when the HTTP trigger's method is not one of them.
  • Input validation: a schema-valid payload routes down the valid branch; a malformed payload routes down invalid and returns the 400 your contract promises.
  • Resilience: sustained load eventually returns 429 when rate limits engage, and a simulated upstream fault routes down the error branch instead of leaking a raw 502.

Three concrete probes from that matrix. The first two work against a published test proxy or a listen session; run the third through the gateway, because the listen URL accepts any method while live traffic is limited to the proxy's allowed methods:

# $CLIENT_ID and $PROFILE_ID: the client and profile IDs from the profile page

# valid payload -> expect 200 via the valid branch
curl -i https://gateway.example.com/payments \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Client-ID: $CLIENT_ID" \
  -H "X-Profile-ID: $PROFILE_ID" \
  -H "Content-Type: application/json" \
  -d '{"amount":1250,"currency":"USD"}'

# malformed payload -> expect 400 via the invalid branch
curl -i https://gateway.example.com/payments \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Client-ID: $CLIENT_ID" \
  -H "X-Profile-ID: $PROFILE_ID" \
  -H "Content-Type: application/json" \
  -d '{"amount":"bad"}'

# method the profile allows but the proxy does not -> expect 405 from the gateway, workflow not run
curl -i -X DELETE https://gateway.example.com/payments \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Client-ID: $CLIENT_ID" \
  -H "X-Profile-ID: $PROFILE_ID"

Prove it in the logs, not in your head

The release gate is evidence, and the evidence lives in request logs. Every request through the gateway is logged with its request ID (also returned to the caller in the X-Request-ID header), method, path, status code, end-to-end latency, client ID, profile ID, matched collection, target endpoint, and request and response headers and bodies, with credential values masked. For each row of your test matrix, pull the log entry and confirm three things: the status code matches the expectation, the client and profile attribution is correct, and the response body shows the branch you intended produced it.

The payload filter makes the branch check fast: it searches request and response bodies in one query, so filtering on a marker like "error":"invalid_token" or a correlation ID surfaces the exact executions you care about without knowing which side of the transaction the value appears on. Config changes land in the same place: the audit trail records who saved the definition, who enabled it, and who published the proxy, which is precisely what a reviewer or a regulator asks for when a workflow change is questioned later.

Teams that automate promotion do the same thing through the Management API, publishing with PUT /api/v1/collections/:id/status from a pipeline after the matrix passes. The same operations are exposed through Management MCP, whose workflow tools include get, update, and validate, so a CI job or an AI assistant can run the structural validation step under the same OIDC session and RBAC as a human operator.

What this looks like in practice

Illustrative scenario, not a specific customer deployment.

A payments team at a mid-size bank needs to add duplicate-request protection to a partner-facing transfer endpoint: a new branch that checks an idempotency key in Redis before the backend call. Under their previous gateway, this change class required a staging deploy, a manual test round, and a change-window deploy to production, roughly a week of elapsed time for twenty minutes of logic.

With Zerq, the transfer route runs a workflow kept in Workflows. The engineer opens it there, adds the Redis lookup and the conditional branch, and clicks Save draft. Production traffic continues to flow through the published version; the new graph is just a draft until she publishes it. She tests the draft against three captured scenarios from the integration suite: a fresh transfer, a duplicate with a known key, and a malformed body. The canvas shows the duplicate correctly short-circuiting to the cached response, with the backend call dimmed because it never ran. She runs the deny-path matrix, checks the request log entries for all three request IDs, and attaches the log evidence to the change ticket. Then she clicks Publish, the backend validates the graph, and the new logic is live. If anything looks wrong later, Versions lists the previous version, ready to restore to the draft and publish again. Elapsed time: one afternoon, and the compliance reviewer gets a complete who-did-what trail from the audit log without asking anyone.

The takeaway

Draft status means new workflow logic is invisible to clients until you publish it. Decoupled save and enable, plus a workflow's draft and published versions, mean you can iterate on a graph, even a live one, without executing a single untested change. Structural validation at enable time means a broken graph cannot go live. Test-listen sessions mean you exercise the real graph, on the real gateway, with per-node visibility, before production traffic exists. And the request and audit logs turn "we tested it" into evidence you can hand to a reviewer. That is what it takes to move gateway logic at the speed of application code without accepting production as your test environment.


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.