bru import converts an API specification into a Bruno collection without opening the desktop app. Point it at a local file or a URL and it writes a ready-to-run collection, which makes it a good fit for CI pipelines that regenerate the collection whenever the spec changes.
Usage
<type> is the format of the specification you are importing:
For the full reference of every flag used below, see Options.
Importing OpenAPI specifications
Collection format (--collection-format)
When you import OpenAPI into a directory (--output), you choose how the collection is laid out on disk:
Use one of:
Option 1: Import to a Bruno collection folder
This imports the OpenAPI specification (YAML or JSON) and writes a collection under the output directory. OpenCollection layout (default):copy
copy
.bru layout:
copy
<your-openapi.yaml>: Path or URL to your OpenAPI spec (YAML or JSON)<preferred-location>: Directory for the generated collection--collection-name: Display name for the collection--collection-format: Optional;opencollection(default) orbru
-s / -o / -n as shorthand for --source, --output, and --collection-name.
Option 2: Import to a single JSON file
This imports the OpenAPI specification and writes one Bruno collection JSON file at the given path.copy
<your-openapi.yaml>: Path or URL to your OpenAPI spec (YAML or JSON)<preferred-location>.json: Path for the exported collection file--collection-name: Custom name for the collection
Import from a URL
--source accepts an http:// or https:// URL as well as a file path. The CLI fetches the spec, converts it, and writes the collection:
copy
--insecure when the URL is served with a self-signed certificate and you want to skip TLS verification.
Group requests by tag or path
By default, imported requests are grouped into folders by their OpenAPI tags. Use--group-by path to build the folder structure from URL paths instead:
copy
Importing WSDL (SOAP APIs)
This imports a WSDL file and generates a Bruno collection in the output directory.copy
<your-service.wsdl>: Path or URL to your WSDL file<preferred-location>: Directory where the collection should be created--collection-name: Optional name for the collection
Keep a collection in sync with the spec in CI
Because the command is non-interactive, you can regenerate the collection on every change to the specification and run it in the same job:Next steps
- Options - the full reference for every
bru importflag - bru run - run the collection you just imported
- bru docs - generate HTML API documentation from it
- Import collections in the app - the same importers in the Bruno desktop app
- OpenCollection YAML - the default on-disk format for imported collections