OpenAPI / Swagger to .http file converter

Paste an OpenAPI 3.0 or 3.1 or Swagger 2.0 definition, in YAML or JSON, or choose the file. You get one .http file per tag with a ready-to-send request for every operation: example bodies, required parameters, auth headers and a status check. Server URLs, path parameters and credentials go into an http-client.env.json. The files work in REST Client, Plainwire, httpYac and the JetBrains HTTP Client.

The conversion runs in this page with the same code as the Plainwire extension and CLI. Your definition is not uploaded or stored, and the page makes no network requests.

Examples:

        
        
      

What you get

In the definitionIn the .http files
Operations (path + method)One ### request each, titled with the summary; operationId becomes # @name so you can chain requests
TagsOne file per first tag (pets.http, orders.http); untagged operations are grouped by their first path segment
servers (or Swagger’s host + basePath){{baseUrl}} in every URL; the first server in $shared, and one named environment per server when there are several. Server variables use their defaults
Path parameters{{petId}} in the URL, with the example value in $shared
Required query, header and cookie parametersWritten with their example, else default, else a value made from the schema; optional query parameters are listed in a comment
Request bodiesThe media type’s example, else a body generated from the schema ($ref, allOf, first oneOf/anyOf, readOnly fields left out). JSON, form (a[b]= for nested fields), multipart with < ./file parts
Security schemesBearer → Authorization: Bearer {{token}}; Basic; API keys in a header, query or cookie; OAuth 2 and OpenID Connect → Bearer {{accessToken}} (to fetch it automatically, set up $auth.token). Empty values are created in $shared for you to fill in
Exactly one documented 2xx response# @assert status == 200 (or 201, 204…), so the run-all report and the CLI check every endpoint
description, deprecatedA one-line comment above the request

Not converted: external $refs to other files (bundle the definition first, for example with redocly bundle), XML bodies without an example, and callbacks/webhooks. Each is listed under “Notes”.

Example

### Create a pet
# @name createPet
# @assert status == 201
POST {{baseUrl}}/pets
Content-Type: application/json
Authorization: Bearer {{token}}

{
  "name": "Rex",
  "tag": "dog"
}

### Get a pet
# @name getPet
# @assert status == 200
GET {{baseUrl}}/pets/{{petId}}
Authorization: Bearer {{token}}

with http-client.env.json:

{
  "$shared": { "baseUrl": "https://api.example.com/v1", "token": "", "petId": "1" },
  "production": { "baseUrl": "https://api.example.com/v1" },
  "sandbox": { "baseUrl": "https://sandbox.example.com/v1" }
}

In VS Code, Cursor or VSCodium

With the Plainwire extension, run Plainwire: Import OpenAPI / Swagger… and pick a file or paste the definition’s URL (such as https://petstore3.swagger.io/api/v3/openapi.json): the .http files are written into your workspace and open in a form editor with a response viewer, environments and a test runner. No account, no request limits, nothing leaves your machine except the requests you send.

In a terminal or CI, the free CLI does the same and can then run every request with its status check:

plainwire import openapi.yaml --out http/
plainwire run http/ --var baseUrl=https://staging.example.com --junit report.xml

plainwire import also takes the URL of a definition. A relative server URL such as /api/v3 then resolves against that URL, so the requests point at the right host straight away:

plainwire import https://petstore3.swagger.io/api/v3/openapi.json --out petstore/
plainwire run petstore/ --grep "Finds Pets by status"

FAQ

Is my API definition sent anywhere?

No. The converter is a script on this page (source). It parses the YAML or JSON in memory and lets you copy or download the result. Nothing is uploaded and nothing is stored after you close the tab.

Why are values like "string" or 1 in the bodies?

When an operation has no example, the body is generated from its schema: strings become "string" (or a sample matching the format, such as an email, a date or a UUID), numbers 1, booleans true. Add examples to your definition and they are used instead.

Where do I put my token?

In http-client.env.json (the converter creates the empty token, apiKey or accessToken entries), or better in http-client.private.env.json, which you keep out of git. Values there override the shared ones.

Why is my server URL http://localhost/...?

The definition uses a relative server URL such as /api/v3, which only means something relative to where the file was served from. Set baseUrl in http-client.env.json to the real host, or import the definition from its URL in the extension or with plainwire import https://…, which resolves the relative URL for you.

Can it convert Postman or Thunder Client collections too?

Yes, on the Postman, Thunder Client & cURL converter. Going the other way, the .http to cURL and code converter turns requests into cURL, fetch, Python and 8 more.