OpenAPI generator — a 3.1 spec skeleton from a list of endpoints

Type your endpoints as plain lines such as "GET /books List books" and the tool builds an OpenAPI 3.1.0 document in YAML or JSON, with paths, operation IDs, path parameters, tags and standard responses.

Live demo · real result from this tool
Format

openapi.yaml

openapi: 3.1.0info:  title: Bookshop API  version: 1.0.0  description: Manage books and orders.servers:  - url: https://api.example.com/v1tags:  - name: books  - name: orderspaths:  /books:    get:      summary: List books      operationId: getBooks      tags:        - books      responses:        '200':          description: Successful response          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
        '401':
          description: Missing or invalid credentials
    post:
      summary: Create a book
      operationId: postBooks
      tags:
        - books
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
        '401':
          description: Missing or invalid credentials
  /books/{id}:
    get:
      summary: Get a book
      operationId: getBooksById
      tags:
        - books
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
        '401':
          description: Missing or invalid credentials
        '404':
          description: Not found
    patch:
      summary: Update a book
      operationId: patchBooksById
      tags:
        - books
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
        '401':
          description: Missing or invalid credentials
        '404':
          description: Not found
    delete:
      summary: Delete a book
      operationId: deleteBooksById
      tags:
        - books
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No content
        '401':
          description: Missing or invalid credentials
        '404':
          description: Not found
  /orders/{orderId}:
    get:
      summary: Get an order
      operationId: getOrdersByOrderId
      tags:
        - orders
      parameters:
        - name: orderId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
        '401':
          description: Missing or invalid credentials
        '404':
          description: Not found
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
security:
  - bearerAuth: []

Request and response schemas are placeholders ({ type: object }); describe your real payloads under components/schemas.

Processed on your device — nothing is uploaded.

How to use the OpenAPI generator

  1. Fill in API title, Version and Description.
  2. Enter the Server URL, the base address every path is added to. Leave it blank to omit servers.
  3. In Endpoints, write one per line: method, path, then a short summary, for example PATCH /books/{id} Update a book.
  4. Keep Bearer token authentication ticked if your API expects an Authorization: Bearer … header.
  5. Choose Format, YAML or JSON, and save the file as openapi.yaml or openapi.json.

What it does and when to use it

Starting an OpenAPI file by hand means a lot of nested boilerplate before you describe anything useful. This tool writes that structure from a simple endpoint list. Use it when planning a new API, documenting an existing one that has no spec, or giving a frontend team something to mock against.

The skeleton is a start, not the finished contract. Draft the payload schemas with the JSON Schema generator, switch formats later with JSON to YAML, and tidy hand edits with the YAML formatter.

How it works

Each line is matched as METHOD /path summary. For every endpoint the tool adds:

  • an operationId made from the method and path words, such as getBooksById;
  • a tag taken from the first fixed path segment (books, orders);
  • a requestBody for POST, PUT and PATCH;
  • a success response: 201 for POST, 204 for DELETE, 200 otherwise. A GET without path parameters returns an array;
  • a 404 response when the path has parameters, and a 401 when bearer auth is on.

With bearer auth, components.securitySchemes gets an HTTP bearer scheme (format JWT) applied to the whole API. The structure follows the OpenAPI 3.1.0 specification.

Worked examples

The bookshop sample. Six endpoints produce /books, /books/{id} and /orders/{orderId}. Part of the YAML:

  /books/{id}:
    get:
      summary: Get a book
      operationId: getBooksById
      tags:
        - books
      parameters:
        - name: id
          in: path
          required: true

A small notes API as JSON. Four lines, bearer off. DELETE /notes/:noteId becomes /notes/{noteId} with "operationId": "deleteNotesByNoteId" and a 204 response. The line “fetch everything” is not an endpoint, so the tool reports it as skipped.

No valid lines. “list all books” alone gives the message “Add endpoints as “METHOD /path summary”, e.g. GET /users List users.”

Limits and tips

  • Query parameters, headers, examples and error bodies are not generated; add them yourself.
  • Path parameters are always typed as strings. Change them to integer where that is true.
  • Rename any operationId you do not like before generating client code, because generators use it for method names.

Frequently asked questions

Is the output OpenAPI 3.0 or 3.1?
It is OpenAPI 3.1.0. Most current tools read 3.1. If an older tool insists on 3.0, change the version line to 3.0.3; the simple structure this tool writes is valid in both.
Can I use Express-style paths like /users/:id?
Yes. A segment such as :orderId is rewritten to {orderId}, the form OpenAPI uses, and a required string path parameter is added for it.
Which HTTP methods are accepted?
GET, POST, PUT, PATCH, DELETE, HEAD and OPTIONS, in upper or lower case. Lines that do not start with one of these followed by a path beginning with / are skipped and listed in a warning. Lines starting with # are treated as comments.
Why do all my request and response bodies say type object?
The tool only knows your paths, not your data. Each body is a placeholder; replace it with a real schema under components/schemas. The JSON Schema generator can draft one from a sample payload.
Can I open the result in Swagger UI or Redoc?
Yes. The document is valid OpenAPI, so viewers and code generators can load it. They will show the placeholder bodies until you describe them.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close