← All diagram types

Mermaid sequence diagram syntax: participants, messages and notes with examples

Mermaid sequence diagram syntax with rendered examples: participants and aliases, message arrows, notes, actors, and numbered message flows.

Sequence diagrams show who talks to whom, and in what order: an API request and its response, a checkout flow, an authentication dance. Vertical lifelines are the participants; horizontal arrows are the messages between them.

Everything on this page is rendered by makesPDF's own Mermaid renderer, so a ```mermaid block in your markdown produces exactly this in the PDF.

Participants and messages

participant A as Alice declares a participant and its display name (the alias is optional). A->>B: sends a solid message; B-->>A: draws the reply dashed.

mermaid
sequenceDiagram
  participant A as Alice
  participant B as Bob
  A->>B: Hello Bob
  B-->>A: Hi Alice

Participants are laid out left to right in order of first appearance, unless you declare them explicitly — declare them first to control the order.

Numbering

autonumber prefixes each message with its sequence number — useful for protocols and test scripts you want to discuss line by line:

mermaid
sequenceDiagram
  autonumber
  participant U as User
  participant S as Server
  U->>S: POST /api/v1/render
  S-->>U: 200 OK
  U->>S: GET /api/v1/artifacts
  S-->>U: artifact list

Notes

A Note attaches an annotation to one participant (Note over A, Note right of A, Note left of A) or spans several (Note over A,B):

mermaid
sequenceDiagram
  participant A as Alice
  participant B as Bob
  Note over A,B: Both see this
  A->>B: Ping
  Note right of B: B decides
  B-->>A: Pong

Actors and self-messages

actor draws a stick figure for a human participant. A message to yourself — API->>API: — is drawn as a looped arrow:

mermaid
sequenceDiagram
  actor U as User
  participant API
  U->>API: request
  API->>API: validate template
  API-->>U: PDF

Not supported in makesPDF yet: loop, alt/else, opt, par, critical and break blocks render their messages in order, but the labelled frame around them is not drawn. activate/deactivate activation bars and box groupings are not rendered either.