Skip to main content

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

The bru import openapi command supports various options:

Import Methods

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 variables

Import 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
Running the import:
Creates this structure:
Generated request file:
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:
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

Maintain your OpenAPI specification separately and re-import when it changes. This ensures your tests stay synchronized with your API documentation.
Commit both the OpenAPI spec and the generated Bruno collection to Git:
The import creates a foundation. Add:
  • Test assertions
  • Pre-request scripts
  • Post-response scripts
  • Example data
  • Documentation notes
Bruno automatically handles circular references in OpenAPI schemas, converting them to simplified structures.
Add meaningful tags to your OpenAPI spec to get better folder organization:

Troubleshooting

Error: Failed to parse OpenAPI specificationEnsure your OpenAPI file is valid YAML or JSON. Use a validator like Swagger Editor to check for syntax errors.
Missing authentication in requestsCheck that your OpenAPI spec includes a security section. Bruno can only import authentication if it’s defined in the specification.
Large specificationsFor very large OpenAPI specs (100+ endpoints), consider importing to a JSON file first, then selectively extracting the endpoints you need.

Next Steps

After importing your OpenAPI specification: