Turn an API collection into an OpenAPI spec

Plenty of APIs were never designed spec-first. They grew, and the only complete list of endpoints is the collection the team uses to call them. When someone finally asks for an OpenAPI file (for a gateway, a code generator, a partner portal), writing it from scratch is days of work. Exporting the collection gets you most of the way in a minute.

Export

In the app, right-click a collection or folder ▸ Export as… ▸ OpenAPI 3.0. Before the file is saved, Requestarium lists what the format can't hold.

From the CLI:

Terminal
requestarium export "Users API" --format openapi3 --yaml --out users.openapi.yaml
requestarium export "Users API" --folder Admin --format swagger2 --out admin.swagger.json

--format swagger2 writes Swagger 2.0 for older tools.

What maps to what

In the collectionIn the spec
Collection name and descriptioninfo.title, info.description
Base URLservers
Foldera tag (nested folders as Parent / Child when names repeat)
Request namesummary
Request's Docs tabdescription
{{userId}} in the pathpath parameter {userId}
Query params and headersparameters
JSON bodyrequestBody with an example and a schema inferred from it

Only HTTP and GraphQL requests are exported. gRPC, WebSocket and the rest are listed in the description, since OpenAPI can't describe them.

Several requests, one endpoint

Collections often have Create user (admin) and Create user (invalid email) as separate requests to the same POST /users. OpenAPI has one operation per method and path, so they share it: the first request's docs, every request's parameters, and each body as a named example. The export lists which requests were merged, and importing the file back into Requestarium splits them into separate requests again.

What a collection can't tell the spec

Response schemas. A collection stores what you send, not a contract for what comes back, so each operation gets a generic 200 and default response. Add real ones before you generate clients or validate against the spec:

users.openapi.yaml
responses:
  '200':
    description: The user
    content:
      application/json:
        schema:
          $ref: '#/components/schemas/User'
  '404':
    description: No user with this id

Also left out on purpose: auth values, scripts and variables. Add securitySchemes by hand; a spec should describe the scheme, not carry your token.

Then keep them in step

Once the spec exists, decide which one is the source of truth. If it's the spec from now on, link the collection to it so changes in the spec flow back into the requests: see Keep an API collection in sync with its OpenAPI spec.