Browse and analyze OpenAPI documentation from your terminal.
Install with pipx
(recommended):
- Install pipx
- Run
pipx install api-browser
Or install with pip
:
pip install api-browser
Start a local server to view the OpenAPI documentation in a web browser using Redoc. The page will automatically refresh when the OpenAPI file changes.
Display a summary table of all API endpoints in the terminal, showing:
- Path
- HTTP Method
- Operation ID
- Status Code
- Request Schema
- Response Schema
Example output:
Title: Test API
Description: A test API description
+--------+----------+----------------+----------+------------------+-------------------+
| Path | Method | Operation ID | Status | Request Schema | Response Schema |
+========+==========+================+==========+==================+===================+
| /pets | GET | listPets | 200 | (none) | PetList |
+--------+----------+----------------+----------+------------------+-------------------+
Display a schema from the OpenAPI file in a tree format. Shows:
- Property names (required properties marked with *)
- Property types and references
- Nested object structures
- Array types
- Where the schema is used (requests, responses, and other schemas)
Example output:
Schema: User
Referenced by: Address, Pet
Requests: createUser, updateUser
Responses: getUser, listUsers
├── id* (integer)
├── name* (string)
├── email (string)
├── address (Address)
│ ├── street* (string)
│ ├── city (string)
│ └── country (string)
└── pets (array[Pet])
├── name* (string)
└── age (integer)
Display a tree view of URL segments, showing the API's hierarchical structure and available operations at each endpoint.
Example output:
├── customers (createCustomer, listCustomers)
│ ├── search (searchCustomers)
│ └── {id} (deleteCustomer, getCustomer, updateCustomer)
│ └── orders (createCustomerOrder, listCustomerOrders)
│ └── {orderId} (deleteCustomerOrder, getCustomerOrder, updateCustomerOrder)
└── orders (createOrder, listOrders)
└── {id} (deleteOrder, getOrder, updateOrder)
Validate an OpenAPI file against the OpenAPI 3.0 specification. Shows a checkmark (✓) if valid or outputs validation errors if there are issues.
Example of valid file:
✓ OpenAPI specification is valid
Example of invalid file:
'title' is a required property
Failed validating 'required' in schema['properties']['info']:
{'$comment': 'https://spec.openapis.org/oas/v3.1.0#info-object',
'type': 'object',
'properties': {'title': {'type': 'string'},
'summary': {'type': 'string'},
'description': {'type': 'string'},
'termsOfService': {'type': 'string', 'format': 'uri'},
'contact': {'$ref': '#/$defs/contact'},
'license': {'$ref': '#/$defs/license'},
'version': {'type': 'string'}},
'required': ['title', 'version'],
'$ref': '#/$defs/specification-extensions',
'unevaluatedProperties': False}
On instance['info']:
{}
To contribute to api-browser:
- Clone the repository
- Install development dependencies:
pip install -e ".[test]"
- Run tests:
pytest
- Update snapshots when output changes:
Or update specific test snapshots:
pytest --snapshot-update
pytest -k "test_name" --snapshot-update