OpenAPI to sequence diagram converter

Paste an OpenAPI or Swagger spec, pick the endpoints, and get a Mermaid sequence diagram of the calls and their responses, including error branches and an auth step. Free and runs in your browser.

sequenceDiagram
    autonumber
    actor Client
    participant API as Pet Store
    Client->>+API: GET /pets/{petId} (Get a pet)
    alt 200
        API-->>Client: 200 The pet
    else 404
        API-->>Client: 404 Pet not found
    end
    deactivate API
Loading the tool…

How to do it

  1. Step 1

    Paste your spec

    Paste an OpenAPI or Swagger document in JSON or YAML, or upload it.

  2. Step 2

    Pick the operations

    Tick the operations you want, in the order they happen.

  3. Step 3

    Choose the detail

    Turn error responses and the auth step on or off.

  4. Step 4

    Use it

    Copy the Mermaid, or open it in the editor.

Why turn a spec into a sequence diagram

Reference docs list endpoints alphabetically. A sequence diagram shows them as a conversation, which is how people actually use an API: authenticate, create something, poll for it, handle the error. It is the picture a new integrator asks for first.

Text that changes

Semicolons end a message in Mermaid sequence diagrams and # starts an entity, so both are removed from summaries and descriptions. Everything else is kept as written.

What this does not do

  • Calls run in the order you select them; the spec does not say which call follows which.
  • Request and response bodies are not drawn, only methods, paths, summaries and status codes.
  • External $ref files are not fetched; paste a bundled spec.

Frequently asked questions

Which spec versions are supported?

OpenAPI 3.0 and 3.1, and Swagger 2.0, in JSON or YAML. Paste the whole document; the converter reads info.title and every operation under paths.

What does the diagram show?

Each selected operation becomes a call from the client to the API, followed by its success response. With "Show error responses" on, the other documented status codes become alt and else branches. If the operation is secured, an optional auth server step shows the credentials being checked.

How should I choose operations?

Pick the operations for one user journey, such as create an order, then fetch it, then pay, in the order they happen. A sequence diagram of every endpoint at once is long and tells no story.

Why are internal services not shown?

An OpenAPI document describes endpoints one at a time, not the calls your API makes to other services. Add those participants in the editor after converting.

More Mermaid tools

All tools