A sample booking API that demonstrates how Schemathesis automatically discovers various types of bugs that manual testing typically misses.
📚 The CLI Tutorial (20 minutes) and Pytest Tutorial (15 minutes) use this API.
- Hotel booking creation and retrieval
- Bearer token authentication
- Room type validation with an intentional bug
- Open API 3.1 schema provided by FastAPI
Start the API:
docker compose up -dVerify it's running:
Open http://localhost:8080/docs to see the interactive API documentation.
The API will be available at:
-
Base URL: http://localhost:8080
-
OpenAPI Schema: http://localhost:8080/openapi.json
All booking endpoints require bearer token authentication.
Authorization: Bearer secret-tokenuvx schemathesis run http://localhost:8080/openapi.json \
--header 'Authorization: Bearer secret-token'Schemathesis will discover an edge case that causes a 500 error.
Create a booking:
curl -X POST "http://localhost:8080/bookings" \
-H "Authorization: Bearer secret-token" \
-H "Content-Type: application/json" \
-d '{
"guest_name": "John Doe",
"room_type": "deluxe",
"nights": 3
}'Retrieve booking:
curl -H "Authorization: Bearer secret-token" \
http://localhost:8080/bookings/42