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.
sequenceDiagram
participant A as Alice
participant B as Bob
A->>B: Hello Bob
B-->>A: Hi AliceParticipants 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:
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 listNotes
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):
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: PongActors and self-messages
actor draws a stick figure for a human participant. A message to yourself — API->>API: — is drawn as a looped arrow:
sequenceDiagram
actor U as User
participant API
U->>API: request
API->>API: validate template
API-->>U: PDFNot supported in makesPDF yet:
loop,alt/else,opt,par,criticalandbreakblocks render their messages in order, but the labelled frame around them is not drawn.activate/deactivateactivation bars andboxgroupings are not rendered either.