Overview
Bruno supports importing OpenAPI (formerly Swagger) specifications to quickly generate API collections. Convert your API documentation into testable requests with a single command.Importing OpenAPI Specifications
Basic Import
Import an OpenAPI file to a Bruno collection:Import Options
Thebru import openapi command supports various options:
Import Methods
- From Local File
- From URL
- Export as JSON
Import from a local OpenAPI file:
Programmatic Usage
Use the@usebruno/converters package in your code:
Installation
Convert OpenAPI to Bruno
What Gets Imported
Bruno’s OpenAPI importer extracts the following:1
Endpoints
All API endpoints with their HTTP methods (GET, POST, PUT, DELETE, etc.)
2
Parameters
- Path parameters
- Query parameters
- Header parameters
- Request bodies
3
Authentication
- API Key authentication
- Bearer token authentication
- Basic authentication
- OAuth2 flows
4
Organization
Requests are grouped by:
- Tags (if defined in OpenAPI spec)
- Paths (automatic grouping by path structure)
5
Server URLs
Base URLs from the
servers section are converted to environment variablesImport Grouping Strategies
Bruno supports different ways to organize imported endpoints:Tag-Based Grouping
Groups endpoints by OpenAPI tags:
Path-Based Grouping
Groups endpoints by URL path structure:
Example OpenAPI Import
Given this OpenAPI specification:openapi.yaml
Users/GET List all users.bru
Environment Variables
Imported collections automatically create environment variables:environments/Production.bru
environments/Staging.bru
Authentication Import
Bruno maps OpenAPI security schemes to authentication types:- Bearer Token
- API Key
- Basic Auth
- OAuth2
OpenAPI:Bruno:
Request Body Mapping
OpenAPI request bodies are converted to Bruno body formats:Supported Formats
Bruno supports importing from multiple API specification formats:OpenAPI 3.0
Full support for OpenAPI 3.0.x specifications in YAML or JSON format.
Postman Collections
Insomnia
WSDL
Post-Import Steps
1
Review Generated Requests
Open the collection in Bruno and review all imported requests for accuracy.
2
Update Environment Variables
Fill in authentication tokens and other environment-specific values:
3
Add Tests
Enhance requests with test assertions:
4
Customize Request Bodies
Update example values with real test data:
5
Organize Folders
Reorganize requests into a structure that makes sense for your team.
CI/CD Integration
Automate OpenAPI imports in your pipeline:.github/workflows/import-openapi.yml
Best Practices
Keep OpenAPI spec as source of truth
Keep OpenAPI spec as source of truth
Maintain your OpenAPI specification separately and re-import when it changes. This ensures your tests stay synchronized with your API documentation.
Version control your imports
Version control your imports
Commit both the OpenAPI spec and the generated Bruno collection to Git:
Customize after import
Customize after import
The import creates a foundation. Add:
- Test assertions
- Pre-request scripts
- Post-response scripts
- Example data
- Documentation notes
Handle circular references
Handle circular references
Bruno automatically handles circular references in OpenAPI schemas, converting them to simplified structures.