Blog

API smoke tests: what to check and how to run them

What an API smoke test should cover, how to keep it fast and safe, and how to run the same smoke suite after every deploy, in GitHub Actions, and on a schedule.

A deploy finishes. The pipeline is green. Does the API still answer, accept a login, and return the records your clients depend on? An API smoke test answers that question in seconds, before your users do.

This guide covers what a smoke test should check, the rules that keep it fast and safe, and how to run one suite in three places: by hand, in CI after every change, and on a schedule. The examples use the Echopoint CLI, but the checklist applies to any tool.

What an API smoke test is

A smoke test is the smallest set of requests that proves the critical paths of an API work at all. The name comes from hardware: switch the device on, and check that no smoke comes out. It is not a full test suite. It is the gate in front of one.

Smoke testRegression suite
GoalIs the API usable at all?Did any existing behavior change?
Size3–10 requestsDozens to thousands
Run timeSeconds to a few minutesMinutes to hours
WhenEvery deploy, every API pull request, on a scheduleAfter the smoke test passes, nightly, before a release
A failure meansStop: the deploy or environment is brokenInvestigate a specific behavior

What to check: a five-step checklist

A useful smoke suite touches each layer a real request goes through. Start with these five checks and remove the ones your API does not have.

  1. The service answers. Call a health or status endpoint, or a cheap public read. Assert the status code, and assert one field in the body, so a proxy error page with a 200 does not pass.
  2. Authentication works. Log in or exchange a token with a dedicated test account. Assert the status, and extract the token for the next steps.
  3. A core resource can be read. Read the record your clients use most, with the token. Assert the status and a field that proves the data layer answered, for example $.id.
  4. A write works, then cleans up. Create a test record with unique data, assert 201 and capture its ID, then delete it. The delete step must run even when an earlier step fails.
  5. A critical dependency answers. If one third-party call or internal service can take the whole API down, check the endpoint that depends on it.

Keep every assertion explicit. “The request returned something” is not a check. “Status equals 201 and $.id is not empty” is.

Rules that keep smoke tests useful

  • Fast. A smoke suite that takes ten minutes stops being run after every deploy. Keep it to the critical path.
  • Independent. Each flow creates the data it needs. Do not depend on a record that someone may delete.
  • Unique data. Generate names and emails per run, so two runs never collide.
  • Always clean up. Make the cleanup step run after failures, or failed runs leave test data behind.
  • Same suite everywhere. Run the identical checks by hand, in CI, and on a schedule. When a scheduled run fails, you can reproduce it with one command.
  • Secrets stay secret. Keep tokens and passwords in environment secrets, not in the test definition or the logs.

Build the smoke flow

In Echopoint, a smoke test is a flow: request steps connected in order, each with assertions and outputs that later steps read. You can build it on the visual canvas or from a terminal. These CLI commands build steps 2 to 4 of the checklist:

Terminal window
FLOW_ID=$(echopoint flow create --name "Orders API smoke" -o json | jq -r .id)
# Log in with a test account and keep the token
echopoint flow node add "$FLOW_ID" --id login --type request --name "Log in" \
--method POST --url "{{BASE_URL}}/auth/login" \
--headers '{"Content-Type":"application/json"}' \
--body '{"email":"{{SMOKE_EMAIL}}","password":"{{SMOKE_PASSWORD}}"}'
echopoint flow node assertion add "$FLOW_ID" login \
--extractor status_code --operator equals --value "200"
echopoint flow node output add "$FLOW_ID" login \
--name token --extractor json_path --path '$.token' --secret
# Create a test order and capture its ID
echopoint flow node add "$FLOW_ID" --id create --after login --type request --name "Create order" \
--method POST --url "{{BASE_URL}}/orders" \
--headers '{"Authorization":"Bearer {{login.token}}","Content-Type":"application/json"}' \
--body '{"reference":"smoke-{{$uuid}}"}'
echopoint flow node assertion add "$FLOW_ID" create \
--extractor status_code --operator equals --value "201"
echopoint flow node output add "$FLOW_ID" create \
--name orderId --extractor json_path --path '$.id'
# Read it back
echopoint flow node add "$FLOW_ID" --id read --after create --type request --name "Read order" \
--method GET --url "{{BASE_URL}}/orders/{{create.orderId}}" \
--headers '{"Authorization":"Bearer {{login.token}}"}'
echopoint flow node assertion add "$FLOW_ID" read \
--extractor json_path --path '$.id' --operator equals --value "{{create.orderId}}"
# Delete it, even when the read failed
echopoint flow node add "$FLOW_ID" --id cleanup --after read --run-when always --type request \
--name "Delete order" --method DELETE --url "{{BASE_URL}}/orders/{{create.orderId}}" \
--headers '{"Authorization":"Bearer {{login.token}}"}'
echopoint flow tag "$FLOW_ID" --add smoke
echopoint flow validate "$FLOW_ID"

A few details carry the rules above:

  • {{$uuid}} is one of the built-in dynamic variables. Each run gets fresh test data.
  • --secret on the token output shows it as *** in results.
  • --run-when always runs the cleanup step after an upstream failure, as long as the order ID it needs exists.
  • BASE_URL, SMOKE_EMAIL and SMOKE_PASSWORD come from an environment, so one flow tests staging and production. Mark the password as a secret.
  • The smoke tag turns any number of flows into one suite.

Run it after every deploy

Run the whole tagged suite against an environment from your terminal or a deploy script:

Terminal window
echopoint flow run --tag smoke -e staging -o json

flow run executes the flows on the machine that calls it and waits, so it also reaches an API on localhost or a private network. It exits with 0 when every flow passed, 1 when a flow failed, 2 when cancelled, 3 on an API or runner error, and 4 on a timeout. A deploy script can stop or roll back on any non-zero code.

To see why a step failed, filter the JSON for failed nodes. Each assertion reports the expected and the actual value. A run of several flows puts one result per flow under results:

Terminal window
echopoint flow run --tag smoke -e staging -o json \
| jq '(.results // [.])[] | .nodes[] | select(.status == "failed") | {node_id, error_message, assertions}'

Run it in GitHub Actions

The GitHub Action runs the same tagged suite inside the CI job. Put it after the deploy step, so the check tests what was just shipped:

name: deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./scripts/deploy-staging.sh
smoke:
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: nanostack-dev/echopoint-cli@v1
with:
api-key: ${{ secrets.ECHOPOINT_API_KEY }}
organization-id: ${{ secrets.ECHOPOINT_ORG_ID }}
tags: smoke
environment: staging
parallel: '3'

A failed flow fails the job. Make the job a required check if it should block a merge or a promotion to production. The pull-request guide covers that setup in detail.

Run it on a schedule

Deploys are not the only thing that breaks an API. An expired certificate, a changed configuration, or a failing dependency can break it while nobody ships anything. A scheduled run, called a monitor in the app, launches the same tagged suite on a recurring schedule:

  • The monitor selects flows by tag, the same tags the CLI uses. The app previews which flows the tags match before you save.
  • Each monitor keeps its own run history, with per-node results and assertions.
  • Failure emails go to the recipients you choose.
  • You can pause a monitor during maintenance and resume it later.

A cron monitor runs at most every 15 minutes. With the cloud runner, the API must be reachable from the internet. For an API on a private network, use a self-hosted runner.

When a smoke test fails

A failed smoke test tells you which step broke and what it returned. It does not tell you whose fault it is. Before you change anything, decide which side is wrong:

  • The API returned the wrong thing. Keep the assertion, and fix or roll back the deploy.
  • The test asserts the wrong thing, because the contract changed on purpose. Update the assertion, and review that change like code.

Never relax an assertion only to make the build green. That turns the smoke test into decoration.

Summary

A good API smoke test is five steps or fewer, runs in seconds, creates and removes its own data, and asserts explicit values. Write it once, tag it smoke, and run the same suite after every deploy, in CI, and on a schedule.

Echopoint is free while in beta. Read the getting-started guide to build your first flow, or see how a coding agent can write and run these tests from the CLI.

FAQ

What is an API smoke test?

An API smoke test is a short set of requests that checks the most important paths of an API still work after a change: the service answers, authentication works, a core resource can be read, and a write can be made and cleaned up. It does not try to cover every case. It tells you quickly whether deeper testing is worth running, or whether a deploy is broken.

How is a smoke test different from a regression test?

A smoke test is small and fast and checks that the critical paths work at all. A regression test suite is larger and checks that existing behavior did not change in detail, including edge cases. Run the smoke suite first, on every deploy, and the regression suite after it passes or on a slower cadence.

How often should API smoke tests run?

Run them after every deploy and on every pull request that changes the API. Many teams also run the same suite on a schedule between deploys, to catch failures caused by configuration, data, or a dependency. In Echopoint a cron monitor can run a tagged suite at most every 15 minutes.

Should smoke tests run against production?

Only with read-only checks or test data that you own and clean up. A smoke test sends real requests. Run write steps against staging, or use a dedicated test account in production and a cleanup step that runs even when an earlier step fails.

Echopoint is free while in beta.

Sign up with GitHub, Google, or email. No credit card.

Start free Runner docs