Overview
The Metlo CLI provides powerful testing capabilities to generate and execute API security tests. Tests can be generated from templates or custom scripts, and executed against your endpoints.Generate Tests
Generate a test for a specific endpoint using a template or custom test file.Command
Options
Type of test to generate. Can be a built-in template name (e.g.,
BOLA, SQL_INJECTION) or a path to a custom .js or .ts test file.The endpoint path to generate this test for (e.g.,
/api/users)Path where the generated test file should be saved. If not provided, the test will be printed to stdout.
The host to generate this test for (e.g.,
api.example.com)The HTTP method of the endpoint (e.g.,
GET, POST, PUT, DELETE)The version of the test template to use (for built-in templates only)
Examples
Generate a BOLA test for an endpoint:Output
The command generates a YAML test file that can be executed withmetlo test run. Example output:
Run Tests
Execute API security tests from YAML test files or by filtering endpoints.Command
Arguments
Paths to one or more YAML test files. If not provided, tests will be fetched from the Metlo backend based on filter options.
Options
Filter tests by endpoint pattern or UUID. Only used when no paths are provided.
Filter tests by HTTP method (e.g.,
GET, POST). Only used when no paths are provided.Filter tests by hostname. Only used when no paths are provided.
Print detailed test errors and response information
Path to a
.env file containing environment variables for test executionSet individual environment variables (can be used multiple times). Format:
--env KEY=valueExamples
Run a specific test file:Output
The command provides real-time feedback on test execution:Request Estimate Warning
If a test will make more than 300 requests, you’ll be prompted for confirmation:Global Environment Variables
The CLI automatically fetches global environment variables from your Metlo backend and makes them available to tests under theglobal namespace.
Run Auth Tests
Execute authentication tests for endpoints configured in your Metlo backend.Command
Example
Test Exit Codes
- Exit code 0: All tests passed
- Exit code 1: One or more tests failed