Import OpenAPI, Swagger and HAR
Turn an API description or a browser capture into a collection of ready-made requests.
Which file do you have?
| File | What it is | Result |
|---|---|---|
OpenAPI 3.0 or 3.1 (.json, .yaml, .yml) | A description of an API: its paths, parameters and bodies. | One collection, one request per operation. |
Swagger 2.0 (.json, .yaml, .yml) | The older version of the same format. | One collection, one request per operation. |
HAR (.har) | A recording of the requests a web page made, saved from the browser's developer tools. | One collection, one request per recorded call. |
All three use the same Import dialog as Postman files. See Import from Postman for the preview and for importing into an existing collection or folder.
Import an OpenAPI or Swagger file
Select Import on the icon rail, or press Ctrl + O.
Select Choose files and pick the
.json,.yamlor.ymlfile. Or paste the JSON or YAML into the box and select Add.Check the preview. It shows the format, for example "OpenAPI 3.0", and counts the folders and requests.
Choose the destination under Import into, then select Import.
What you get
- A collection named after the document's title, with its description.
- Folders by tag. Each operation goes into the folder of its first tag.
- One request per operation, with path variables, query params and headers filled with example values, and an example body built from the schema.
- A
baseUrlcollection variable holding the first server address. Request URLs start with{{baseUrl}}, so you change the server in one place. - Auth for Bearer, Basic, Digest, API key (in a header or the query) and OAuth 2.0 security schemes.
- Response examples from the document, saved as examples on each request.
Path parameters written as /pets/{id} become /pets/:id, which gives them a row in the path variables table under Params.
Notes the preview may show
| Note | What to do |
|---|---|
| The document does not say where the API runs. | Set the baseUrl variable of the collection, for example https://api.example.com. |
| The server address is relative. | Set baseUrl to the full address. |
| The document lists more servers. | Change baseUrl to use another one. |
| Several security options are listed. | Only the first one ApiWorkbench can send is set up as the auth. |
| References to other files or URLs are not followed. | The parts they describe are left out of bodies and parameters. Fill those in by hand, or import a single-file version of the document. |
| TRACE operations were skipped, or webhooks are not imported. | Nothing to do. These parts are left out. |
Security schemes with no equivalent, such as OpenID Connect, mutual TLS or an API key in a cookie, are imported with the auth left empty. Set the auth yourself on the collection or request. See Authorization.
Only OpenAPI 3.x and Swagger 2.0 are supported. A YAML file with a syntax mistake is listed with the parser's message.
Import a HAR file
Save a HAR file from your browser
Open your browser's developer tools and go to the Network tab.
Use the web page so that the calls you want are recorded.
Right-click in the request list and choose Save all as HAR.
Import it
Select Import on the icon rail, or press Ctrl + O.
Select Choose files and pick the
.harfile.Leave Skip static assets (images, fonts, CSS, JS) on to import only the API calls. Turn it off to import everything the page loaded.
Check the preview, choose the destination, then select Import.
What you get
- A collection named HAR import with the date.
- One request per recorded call, with its method, URL, headers and body.
- The recorded response saved as an example on the request.
- Repeats of the same request (same method, URL, query and body) merged into one. A repeat whose response differs adds another example, up to five per request.
Left out: static assets (while the option is on), entries that are not HTTP calls such as WebSocket traffic, and headers the app computes itself, such as Content-Length and Host. Response bodies over 512 KB and binary responses are not kept in examples.
DANGER
A HAR file holds everything the browser sent, including Authorization headers and cookies of your signed-in session. They are imported as recorded, and the preview tells you so. Do not share a HAR file, or a collection made from one, before removing them.