Schemathesis CLI Reference
This reference details all the command-line options available in the Schemathesis CLI. The documentation is organized by command and subcommand to provide a clear structure of available options and their usage.
Global Options
These options apply to all Schemathesis commands and must be placed before the command name:
$ st --no-color run openapi.yaml
--config-file PATH
Type: String (file path)
Default: null
Path to the schemathesis.toml file to use. By default Schemathesis looks for schemathesis.toml in the current directory and its parents. See Configuration.
--no-color
Disables ANSI color output in the terminal. Use this option when running in environments where color codes may cause issues or when redirecting output to files.
--version
Print the Schemathesis version and exit.
The run and fuzz commands additionally accept --no-color and --force-color after the command name:
--force-color
Forces the use of ANSI color escape codes in terminal output, even in environments where Schemathesis would normally disable colors. Not available on st replay.
run
The run command executes API tests against an API using a schema for test generation.
$ st run [OPTIONS] LOCATION
Required Parameter
LOCATION: Path to an OpenAPI (.json, .yaml, .yml), GraphQL SDL, or gRPC descriptor-set (.binpb, .pb, .protoset) file; an OpenAPI or GraphQL URL; or a gRPC reflection target such as grpc://localhost:50051. This location defines the API surface to test.
Basic Options
-u, --url URL
Type: String
Default: null
Specifies the base URL for the API under test. Required for file-based schemas.
$ st run openapi.yaml --url https://api.example.com
--origin URL
Type: String
Default: null
Specifies the API origin - scheme, host and port only. The base path comes from the schema's basePath or servers[0].url. Use it when the host is known only at run time, and --url when you want to set the path yourself. Mutually exclusive with --url.
$ st run openapi.yaml --origin http://127.0.0.1:8080
-w, --workers VALUE
Type: Integer or "auto"
Default: 1
Range: 1-64 or auto
Specifies the number of concurrent workers for running unit test phases (examples, coverage, fuzzing). Use "auto" to automatically adjust based on available CPU cores.
$ st run openapi.yaml --workers 4
--phases PHASES
Type: Comma-separated list
Default: All phases enabled
Possible values: examples, coverage, fuzzing, stateful
Specifies which test phases to run.
$ st run openapi.yaml --phases examples,fuzzing
--suppress-health-check CHECKS
Type: Comma-separated list
Default: []
Possible values: data_too_large, filter_too_much, too_slow, large_base_example, all
Disables specified health checks during test execution. Health checks identify potential problems with test generation or performance and may stop tests early with an error to prevent Schemathesis from hanging (e.g., when processing extremely complex schemas).
$ st run openapi.yaml --suppress-health-check too_slow,data_too_large
--wait-for-schema SECONDS
Type: Float
Default: null
Range: ≥1.0
Maximum time in seconds to wait for the API schema to become available. Useful when testing services that take time to start up.
$ st run https://api.example.com/openapi.json --wait-for-schema 5.0
--warnings WARNINGS
Type: String or comma-separated list
Default: All warnings enabled
Possible values: off, missing_auth, base_url_mismatch, missing_test_data, validation_mismatch, missing_deserializer, unused_openapi_auth, unsupported_regex, method_not_allowed, constants_extraction, unmatched_filter, unresolvable_reference, low_valid_rate, rate_limited, dictionary_mismatch, timeout_units, unsupported_field, not_served
Control which warnings are displayed during test execution. Warnings help identify test configuration issues but don't stop execution. See the Warnings reference for what each one signals.
# Disable all warnings
$ st run openapi.yaml --warnings off
# Enable only authentication warnings
$ st run openapi.yaml --warnings missing_auth
# Enable multiple specific warnings
$ st run openapi.yaml --warnings missing_auth,validation_mismatch
Validation
-c, --checks CHECKS
Type: Comma-separated list
Default: All checks enabled
Possible values: not_a_server_error, status_code_conformance, content_type_conformance, response_headers_conformance, response_schema_conformance, negative_data_rejection, positive_data_acceptance, missing_required_header, unsupported_method, allow_header_conformance, use_after_free, ensure_resource_availability, ignored_auth, object_level_authorization, all
Specifies which checks to run against API responses. See the Checks reference for what each one validates.
$ st run openapi.yaml --checks not_a_server_error,response_schema_conformance
--exclude-checks CHECKS
Type: Comma-separated list
Default: []
Possible values: not_a_server_error, status_code_conformance, content_type_conformance, response_headers_conformance, response_schema_conformance, negative_data_rejection, positive_data_acceptance, missing_required_header, unsupported_method, allow_header_conformance, use_after_free, ensure_resource_availability, ignored_auth, object_level_authorization, all
Specifies which checks to skip during testing.
$ st run openapi.yaml --checks all --exclude-checks response_schema_conformance
--max-failures COUNT
Type: Integer
Default: null
Range: ≥1
Terminates the test suite after reaching a specified number of failures or errors.
$ st run openapi.yaml --max-failures 5
--max-time SECONDS
Type: Integer
Default: null
Range: ≥1
Time budget for the whole run. Each phase gets a share of it, then fuzzing and stateful testing repeat with fresh data until the budget is spent.
$ st run openapi.yaml --max-time 600
--continue-on-failure
Type: Flag
Default: false
When enabled, continues executing all test cases within a scenario, even after encountering failures.
$ st run openapi.yaml --continue-on-failure
--baseline PATH
Type: String
Default: null
File recording the failures you have accepted. Failures it lists are reported but do not fail the run, and a run pointed at a path that does not exist creates the file. An entry is keyed on the operation, the check, the failure class and a signature, so a second, genuinely different failure of the same shape on the same operation is absorbed by it. Equivalent to setting baseline in the config file. See the Baseline guide.
$ st run openapi.yaml --baseline schemathesis-baseline.json
--baseline-update
Type: Flag
Default: false
Merges the failures of this run into an existing baseline file, preserving annotations you added by hand. Requires a baseline path from --baseline or the config file.
$ st run openapi.yaml --baseline-update
--baseline-prune
Type: Flag
Default: false
Drops baseline entries this run tested and did not reproduce. Entries for operations the run never reached are kept. Requires a baseline path from --baseline or the config file.
$ st run openapi.yaml --baseline-prune
--max-response-time SECONDS
Type: Float
Default: null
Range: >0.0
Maximum allowed API response time in seconds. Responses exceeding this limit will be reported as failures.
$ st run openapi.yaml --max-response-time 2.5
Filtering
Schemathesis provides various ways to filter which operations are tested. TYPE is one of path, method, name, tag, or operation-id.
--include-TYPE VALUE / --exclude-TYPE VALUE
Type: String (multiple allowed)
Include or exclude operations by exact match on path, method, name, tag, or operation-id.
$ st run openapi.yaml --include-tag users
$ st run openapi.yaml --exclude-method DELETE
--include-TYPE-regex PATTERN / --exclude-TYPE-regex PATTERN
Type: String (regex pattern)
Include or exclude operations matching a regular expression pattern on path, method, name, tag, or operation-id.
$ st run openapi.yaml --include-path-regex "/api/v1/.*"
$ st run openapi.yaml --exclude-tag-regex "admin|internal"
--include-by EXPR / --exclude-by EXPR
Type: String (expression)
Include or exclude operations using a custom expression. The expression must start with a JSON Pointer.
$ st run openapi.yaml --include-by "/tags/0 == 'user'"
--exclude-deprecated
Type: Flag
Default: false
Skip deprecated API operations.
$ st run openapi.yaml --exclude-deprecated
Network
The following options control how Schemathesis makes network requests to the API under test:
-H, --header NAME:VALUE
Type: String (multiple allowed)
Add custom HTTP headers to all API requests. This option can be specified multiple times.
$ st run openapi.yaml \
--header "X-API-Key: abcdef123456" \
--header "Accept-Language: en-US"
-a, --auth USER:PASS
Type: String
Authenticate all API requests with basic authentication.
$ st run openapi.yaml --auth username:password
--auth-wfc PATH
Type: String
Authenticate all API requests using a Web Fuzzing Commons auth file.
Equivalent to setting auth.wfc.path in the config file.
$ st run openapi.yaml --auth-wfc ./market-auth.yaml
--auth-wfc-user NAME
Type: String
Default: null
Name of the entry to use when the auth file defines several users. When omitted and the file lists more than one entry, Schemathesis tries each entry in document order per operation, moving on from the ones an operation rejects with 403, and keeping the first entry the operation admits.
$ st run openapi.yaml --auth-wfc ./market-auth.yaml --auth-wfc-user admin
--proxy URL
Type: String
Set the proxy for all network requests.
$ st run openapi.yaml --proxy http://localhost:8080
--tls-verify TEXT
Type: String or Boolean
Default: true
Path to CA bundle for TLS verification, or 'false' to disable TLS verification.
$ st run openapi.yaml --tls-verify false
$ st run openapi.yaml --tls-verify /path/to/ca-bundle.pem
--rate-limit TEXT
Type: String
Format: <limit>/<duration>
Specify a rate limit for test requests. Supports 's' (seconds), 'm' (minutes), and 'h' (hours) as duration units.
Pass auto instead of a fixed limit to send requests without throttling and wait for the duration in the Retry-After header whenever the API responds with 429.
$ st run openapi.yaml --rate-limit 100/m
$ st run openapi.yaml --rate-limit 5/s
$ st run openapi.yaml --rate-limit auto
--max-redirects INTEGER
Type: Integer
Default: 30
Range: >=0
Maximum number of redirects to follow for each network request during tests. Set to 0 to disable redirect following entirely. Redirects to another host are never followed.
$ st run openapi.yaml --max-redirects 5
--request-timeout SECONDS
Type: Float
Default: 10.0
Range: >0.0
Timeout limit, in seconds, for each network request during tests. This is the maximum time to wait for a response before aborting the request.
$ st run openapi.yaml --request-timeout 5.0
--request-retries N
Type: Integer
Default: 0
Range: >=0
Number of times to retry a request on network-level failures (connection errors, timeouts). Uses exponential back-off between attempts. N retries mean N+1 total attempts.
$ st run openapi.yaml --request-retries 3
--request-cert PATH
Type: String (file path)
File path of unencrypted client certificate for authentication. The certificate can be bundled with a private key (e.g., PEM) or used with a separate private key.
$ st run openapi.yaml --request-cert /path/to/client-cert.pem
--request-cert-key PATH
Type: String (file path)
Specify the file path of the private key for the client certificate when not bundled together.
$ st run openapi.yaml \
--request-cert /path/to/client-cert.crt \
--request-cert-key /path/to/private-key.key
Output
These options control the reporting and output format of test results:
--report FORMAT
Type: Comma-separated list
Possible values: junit, vcr, har, ndjson, json, wfc, pytest, allure, html
Generate test reports in specified formats as a comma-separated list.
$ st run openapi.yaml --report junit,har
--report-dir DIRECTORY
Type: String
Default: schemathesis-report
Directory to store all report files.
$ st run openapi.yaml --report junit --report-dir ./test-reports
--report-junit-path FILENAME
Type: String
Custom path for JUnit XML report.
$ st run openapi.yaml --report-junit-path ./custom-junit.xml
--report-vcr-path FILENAME
Type: String
Custom path for VCR cassette.
$ st run openapi.yaml --report-vcr-path ./custom-vcr.yaml
--report-har-path FILENAME
Type: String
Custom path for HAR file.
$ st run openapi.yaml --report-har-path ./custom-har.json
--report-ndjson-path FILENAME
Type: String
Custom path for NDJSON events file. This format exports all engine events as newline-delimited JSON, useful for analysis and tooling integration. Not applicable to the pytest plugin.
$ st run openapi.yaml --report-ndjson-path ./events.ndjson
--report-json-path FILENAME
Type: String
Custom path for the JSON run report. This format exports the run's verdict as a single JSON document — operation counts, phase statuses, grouped failures and errors, and warnings — so CI can read what a run was worth without scraping the terminal. Not applicable to the pytest plugin.
$ st run openapi.yaml --report-json-path ./report.json
--report-wfc-path FILENAME
Type: String
Custom path for a Web Fuzzing Commons Report. Schemathesis exports REST findings using WFC fault codes. Checks without an upstream WFC code use Schemathesis-specific 9xx codes: 904 for invalid input accepted with a non-2xx status, 905 for unsupported-method responses without a matching WFC code, and 906 for object-level authorization bypasses. Schemathesis writes a shell script with curl commands that reproduce each reported failure next to the report, named after it (e.g. wfc-report.sh).
$ st run openapi.yaml --report-wfc-path ./wfc-report.json
--report-pytest-path FILENAME
Type: String
Custom path for a pytest file with one test per reported failure. Each test sends the recorded requests with requests and asserts the status codes the run observed, so it passes while the bug exists and the server holds the data the run saw, and fails once the behavior changes. Stateful failures replay the whole chain with the recorded values. The default file name, test_schemathesis_<timestamp>.py, matches pytest's test discovery. Sensitive values are masked unless --output-sanitize false is set. Not applicable to the pytest plugin.
$ st run openapi.yaml --report-pytest-path ./test_regressions.py
--report-allure-path DIRECTORY
Type: String (directory path)
Directory for Allure result files. Requires the allure extra (pip install schemathesis[allure]). See the Allure Integration guide.
$ st run openapi.yaml --report-allure-path ./allure-results
--report-html-path DIRECTORY
Type: String (directory path)
Directory for the HTML report: an index.html page with the verdict, warnings, failures with commands to reproduce them, and the run's settings. The page works offline: store it as a CI artifact and open it from the file system.
$ st run openapi.yaml --report-html-path ./html-report
--report-preserve-bytes
Type: Flag
Default: false
Retain exact byte sequence of payloads in cassettes, encoded as base64.
$ st run openapi.yaml --report vcr --report-preserve-bytes
--output-sanitize BOOLEAN
Type: Boolean
Default: true
Enable or disable automatic output sanitization to obscure sensitive data.
$ st run openapi.yaml --output-sanitize false
--output-truncate BOOLEAN
Type: Boolean
Default: true
Truncate schemas and responses in error messages for improved readability.
$ st run openapi.yaml --output-truncate false
Data Generation
These options control how Schemathesis generates test data for API testing:
-m, --mode MODE
Type: String
Default: all
Possible values: positive, negative, all
Test data generation mode. Controls whether Schemathesis generates valid data, invalid data, or both.
$ st run openapi.yaml --mode all
-n, --max-examples COUNT
Type: Integer
Range: ≥1
Caps the number of generated test cases. The effect depends on the test phase:
- In fuzzing phase: Caps the cases generated per API operation
- In stateful phase: Caps the number of distinct API call sequences
- In examples and coverage phases: Has no effect, as these use predetermined test cases
Schemathesis generates diverse examples based on your API schema, distributed across enabled generation modes (e.g., positive and negative test cases). See Data Generation for details.
$ st run openapi.yaml --max-examples 100
--seed INTEGER
Type: Integer
Random seed for reproducible test runs. Setting the same seed value will result in the same sequence of generated test cases.
$ st run openapi.yaml --seed 42
--no-shrink
Type: Flag
Default: false
Disable test case shrinking. Makes test failures harder to debug but improves performance.
$ st run openapi.yaml --no-shrink
--generation-deterministic
Type: Flag
Default: false
Enables deterministic mode, which eliminates random variation between tests.
$ st run openapi.yaml --generation-deterministic
--generation-allow-x00 BOOLEAN
Type: Boolean
Default: true
Whether to allow the generation of 'NULL' bytes within strings.
$ st run openapi.yaml --generation-allow-x00 false
--generation-codec TEXT
Type: String
Default: utf-8
The codec used for generating strings. Defines the character encoding for string generation.
$ st run openapi.yaml --generation-codec ascii
--generation-maximize METRIC
Type: String
Possible values: response_time
Guide input generation to values more likely to expose bugs via targeted property-based testing.
$ st run openapi.yaml --generation-maximize response_time
--generation-with-security-parameters BOOLEAN
Type: Boolean
Default: true
Whether to generate security parameters during testing.
$ st run openapi.yaml --generation-with-security-parameters false
--generation-graphql-allow-null BOOLEAN
Type: Boolean
Default: true
Whether to use null values for optional arguments in GraphQL queries. Applicable only for GraphQL API testing.
$ st run openapi.yaml --generation-graphql-allow-null false
--generation-database TEXT
Type: String
Default: .hypothesis/examples
Storage for examples discovered by Schemathesis. Use none to disable, :memory: for temporary storage, or specify a file path for persistent storage.
$ st run openapi.yaml --generation-database ":memory:"
$ st run openapi.yaml --generation-database ./schemathesis_examples.db
--generation-unique-inputs
Type: Flag
Default: false
Force the generation of unique test cases. When enabled, Schemathesis will ensure that no duplicate test inputs are used within a single test phase.
$ st run openapi.yaml --generation-unique-inputs
fuzz
The fuzz command continuously generates multi-step API scenarios.
$ st fuzz [OPTIONS] SCHEMA
st fuzz accepts all options from st run except --phases, --no-shrink, and --max-examples.
Fuzzing Options
--max-time SECONDS
Type: Integer
Default: null
Stop fuzzing after this many seconds. Without this option, st fuzz runs until the first failure or interrupted.
$ st fuzz openapi.yaml --max-time 3600
replay
The replay command re-runs cases that failed a previous run or fuzz. Failing cases are recorded automatically as crash files under the project cache directory; see Replaying Failures.
$ st replay [OPTIONS] [PATH]
Optional Parameter
PATH: What to replay. Omit it to replay every recorded crash for the project. Otherwise pass a crash file, a directory of crash files, or a case ID (as printed in the Reproduce with: block of a failing run).
$ st replay
$ st replay Xt9Kp2
$ st replay .schemathesis/myapi/cache/crashes/abc123.json
Options
--url URL
Type: String
Default: null
Override the base URL recorded in the crash file, for replaying against a different environment.
$ st replay --url https://staging.example.com
--schema-location TEXT
Type: String
Default: null
Override the schema location used to reload operations. Required when the location recorded in the crash file is unreachable (e.g. crash files copied from CI).
$ st replay --schema-location ./openapi.json
--keep
Type: Flag
Default: false
Retain crash files for cases that now pass. By default, fixed crashes are removed so the directory reflects only what is still broken.
$ st replay --keep
-H, --header NAME:VALUE
Type: String (multiple allowed)
Add custom HTTP headers to every replayed request, overriding headers from the config file. Use it to supply credentials that were masked in the crash file.
$ st replay --header "Authorization: Bearer $TOKEN"
-a, --auth USER:PASS
Type: String
Authenticate every replayed request with basic authentication.
$ st replay --auth username:password
--auth-wfc PATH
Type: String
Authenticate every replayed request using a Web Fuzzing Commons auth file.
$ st replay --auth-wfc ./market-auth.yaml
--auth-wfc-user NAME
Type: String
Default: null
Name of the entry to use when the auth file defines several users.
$ st replay --auth-wfc ./market-auth.yaml --auth-wfc-user admin
explain
The explain command prints what a failure code means, the checks that report it, common causes and fixes, and how to allow or turn it off. Every failure in the output starts with its code, and reports carry it too: the code field in NDJSON and JSON, the message attribute in JUnit.
$ st explain [OPTIONS] [CODE]
Required Parameter
CODE (unless --list is given): A failure code (ST108 or 108, any case) or a check name (response_schema_conformance, which lists the codes the check reports).
$ st explain ST108
$ st explain response_schema_conformance
An unknown value exits with code 2 and suggests a close match when one exists.
--list
Type: Flag
Default: false
List every failure code with its title and summary, grouped by the code's hundreds digit.
$ st explain --list
--force-color
Type: Flag
Default: false
Color the output even when it is not a terminal.
Exit codes
Schemathesis uses predictable exit codes so automation can interpret results:
0— All configured checks passed1— At least one check failed or a bug was reported2: Schemathesis could not do its job: invalid options or configuration, a schema that fails to load, an internal error, or a run that tested nothing (the schema defines no operations, no operations matched the filters, or every selected operation was skipped)130: The run was interrupted with Ctrl+C before it finished, even if it had already found failures