Documentation / CLI & Automation
CLI & Automation
Use the Apicurl command-line interface to run collections, schedule checks, and integrate API tests into your CI/CD pipelines.
1. Why Use the CLI?
The browser app is ideal for exploration and debugging, but regression tests need to run unattended. The Apicurl CLI lets you execute the same HTTP requests and collections from a terminal or CI runner so you can detect breaking changes before they reach users.
2. Typical Workflow
A common pattern when automating API tests with Apicurl is:
- Design and stabilize requests in the Apicurl app.
- Save them into collections and configure environments.
- Export the collection or reference it from the CLI.
- Wire CLI commands into your CI provider of choice.
This keeps exploratory work fast while still giving you a repeatable, scripted layer for every deploy.
3. Environment Variables and Secrets
The CLI reads environment variables the same way your application code does. Use them for API keys, base URLs, and tenant-specific data instead of hard-coding secrets into configuration files.
For local development, a simple .env file or shell exports are usually enough. In CI, use your provider's encrypted secret store.
4. Running Checks in CI
Once you have a set of stable requests, run them in CI as part of your build, deploy, or nightly jobs. At a minimum, you should cover health checks and a handful of critical scenarios such as authentication, core CRUD flows, and billing or payment endpoints.
When a run fails, the CLI exposes exit codes and logs that make it clear which request broke, along with the HTTP status and response body that triggered the failure.
5. Combining CLI with Examples
The examples library at /examples is a great starting point for CLI-driven tests. You can adapt the GitHub, Stripe, OpenAI, Slack, and authentication examples to your own services, then execute those flows automatically in staging and production.
6. Next Steps
As your test suite grows, you can split collections by domain, environment, or team and schedule different runs throughout the day. Pair the CLI with API testing patterns to design scenarios that catch real-world failures, not just happy-path bugs.

