Schemathesis logo

Schemathesis

Property-based fuzzing for OpenAPI, Swagger and GraphQL APIs: it generates hostile inputs from your own spec. Free, Python CLI.

Overview

Schemathesis generates property-based API tests from an API schema and explores edge cases that ordinary example-based tests may miss. It is useful for finding contract violations and unexpected server behavior in APIs you own or are authorized to test.

Key features

Schema-driven test generation; OpenAPI and GraphQL support; reproducible cases; CI integration.

Install & first run


# Python package - the CLI is `st` (with `schemathesis` as an alias)
python3 -m pip install --user schemathesis

# or
pipx install schemathesis

# Fuzz a live API using its OpenAPI document
st run https://lab.example.com/openapi.json --checks all

# Local schema file against a local server
st run ./openapi.yaml --url http://127.0.0.1:8000

# CI-friendly: cap examples and return non-zero on failures
st run https://lab.example.com/openapi.json --max-examples 50

--stateful=links chains requests (create then read then delete) to catch sequence bugs. Docs: https://schemathesis.readthedocs.io/

Real-world example

Run schema-based tests against a local or staging API and investigate reproducible failures before release.

Common questions

Does Schemathesis replace manual API security testing?

No. It complements authorization, business-logic and abuse-case testing.

What does it find that unit tests miss?

Inputs nobody thought of: negative numbers in IDs, huge strings, wrong content types, and 500s raised where the spec promised 400.

Does it need a running server?

Yes - it talks to the live API, or to a WSGI/ASGI app through the Python integration for in-process testing.

Can I use it with any framework?

Anything that publishes OpenAPI, Swagger 2.0 or GraphQL. The spec is the contract; Schemathesis attacks that contract.

Kiterunner

API route brute forcing that matches full REST path shapes and methods, not just directory names. Free, open source, prebuilt binaries.


Keep exploring: browse every assessment phase in the Pentest Hub.

Authorized testing only — only ever test systems you own or have explicit written permission to assess.