Sequence diagram examples

Sequence Diagram Examples: Login, Payment, API, and More

Real sequence diagram examples — user login with JWT, payment processing, REST API call chain, OAuth 2.0 flow, and database read — with prompt templates for generating each with AI.

How to read a sequence diagram

A sequence diagram shows how objects or systems interact over time. Reading one from top to bottom follows the chronological order of events. Each vertical line is a lifeline — a participant (actor, service, database, or system). Horizontal arrows are messages — synchronous calls (solid arrow with filled head), asynchronous calls (solid arrow with open head), return values (dashed arrow). Activation bars (narrow rectangles on a lifeline) show when the participant is actively processing. The diagram reads left-to-right for participants and top-to-bottom for time.

How to create a sequence diagram examples diagram with AI

flow-chart.io generates sequence diagram examples diagrams from plain language in four steps. No notation knowledge required — describe what you need and the AI handles the symbols, layout, and relationships.

Step 1

Describe what you need

Open flow-chart.io and type a plain-language description of the sequence diagram examples diagram you want. Name the key actors, systems, steps, or relationships. The more specific your description, the more accurate the generated diagram — but even a rough outline produces a solid first draft. You do not need to know any syntax or notation rules.

Step 2

Review the generated diagram

The AI generates a fully editable diagram in seconds, using the correct notation for your domain. Review the nodes, connectors, and labels. Check that the relationships are accurate and the layout is readable. The diagram is a scene graph — every element is an independent object, not a flat image.

Step 3

Edit any element directly

Click any node to rename it, change its type, or update its style. Drag nodes to reposition them. Add new nodes by describing what to add in the refinement panel. Remove elements you do not need. The AI can also refine the diagram for you: "add an error handling path," "split this step into two," "change the data store to a cloud icon."

Step 4

Export in the format you need

Export the finished diagram as SVG for web and design tools, PNG at 2× or 4× resolution for presentations and documentation, PDF for print and client deliverables, JSON to version-control the editable scene graph alongside your code, or Mermaid (.mmd) to embed the diagram as text in GitHub or Notion.

What you can create

Synchronous calls: solid arrow, filled arrowhead — the sender waits for a response
Asynchronous messages: solid arrow, open arrowhead — the sender continues without waiting
Return messages: dashed arrow — shows the response from a called method
Activation bars: narrow rectangle on a lifeline, showing active processing duration
Combined fragments: loop, alt, opt, par, ref — conditional and parallel flow notation

Example prompts for sequence diagram examples diagrams

These example prompts give you a starting point. Adjust them to match your specific system, process, or domain. The AI interprets natural language — you do not need to follow a rigid format.

Sequence diagram for user login with JWT: Actor User, Browser, Auth API, UserDB. User submits login form → Browser sends POST /login to Auth API → Auth API queries UserDB for user record → UserDB returns user data → Auth API validates password hash → Auth API generates JWT → returns 200 + JWT to Browser → Browser stores JWT in localStorage
Sequence diagram for Stripe payment: Actor Customer, Frontend, Backend API, Stripe API, OrderDB. Customer clicks Pay → Frontend calls POST /checkout → Backend creates PaymentIntent via Stripe API → Stripe returns clientSecret → Backend returns clientSecret to Frontend → Frontend calls stripe.confirmPayment() → Stripe processes payment → Stripe sends webhook to Backend → Backend updates OrderDB → Backend returns success
Sequence diagram for OAuth 2.0 authorization code flow: Actor User, Client App, Auth Server, Resource Server. User clicks Login with GitHub → Client App redirects to Auth Server /authorize → User authenticates and approves → Auth Server redirects to Client App with authorization code → Client App exchanges code for access token at Auth Server /token → Client App requests user data from Resource Server with access token → Resource Server validates token → returns user profile

When to use sequence diagram examples diagrams

The following situations are the highest-value applications for sequence diagram examples diagrams in professional environments. Each represents a context where a well-constructed diagram reduces miscommunication, speeds decision-making, or produces a deliverable that would otherwise take hours to create manually.

In each case, the diagram is not decoration — it is the primary artifact that the team or stakeholder actually uses to make a decision, approve a design, or onboard a new member.

Best practices for sequence diagram examples diagrams

Experienced practitioners consistently apply a small set of principles that separate diagrams people actually use from ones that get ignored after the meeting. Apply these to every sequence diagram examples diagram you create.

  1. Start with the happy path — the primary successful flow through the sequence diagram examples — before adding error handling, edge cases, and alternative routes. A diagram that shows the happy path clearly is immediately useful; one that tries to show every edge case first becomes unreadable.
  2. Name every element specifically. "Process order" is more useful than "Process" and "Validate payment with Stripe" is more useful than "Payment validation." Specific names let readers understand the diagram without needing a separate explanation.
  3. Use the right level of detail for your audience. A sequence diagram examples diagram for a business stakeholder should show roles and outcomes, not implementation details. A diagram for engineers should show system boundaries, technologies, and data flows. When in doubt, create two versions.
  4. Export a JSON copy of every diagram you want to maintain over time. The JSON export contains the complete typed scene graph — you can re-import it to continue editing after weeks or months. This is your version-controllable source of truth.

AI sequence diagram examples generation vs. manual diagramming

Both approaches produce editable diagrams, but they differ significantly in where time is spent and what expertise is required. Use this comparison to decide which approach fits your team's workflow.

Aspectflow-chart.io (AI)Manual diagramming
Time to first draftUnder 60 seconds from a plain-language description20–60 minutes drawing and connecting shapes
Notation accuracyStandards enforced automatically (gateway rules, C4 zoom levels, ERD cardinality)Depends on practitioner knowledge; violations are common
EditabilityEvery element is a live object — click to edit any node or connectorAll elements are already individually editable by design
Iteration speedDescribe the change in plain language; AI updates the diagram in secondsManual drag, delete, and reconnect for each change
Export formatsSVG, PNG 2×/4×, PDF, JSON, Mermaid — all from one clickDepends on the tool; some require additional steps per format
Learning curveNone — describe in English, AI handles notationNotation-specific for each diagram type (BPMN, UML, C4)

Related guides

These guides cover diagram types that are commonly used alongside sequence diagram examples diagrams, or that share similar audiences and use cases.

Sequence Diagram GeneratorUML Diagram TypesAPI DiagramMicroservices Diagram

Frequently asked questions

What is a sequence diagram?
A sequence diagram is a UML behavioral diagram that shows how objects, services, or actors interact over time. It arranges participants as vertical lifelines and shows messages as horizontal arrows between them, ordered top-to-bottom chronologically. Sequence diagrams are used to document API flows, login processes, payment flows, microservice call chains, and any scenario where the order of messages matters.
When should I use a sequence diagram vs. a flowchart?
Use a sequence diagram when the interaction involves multiple distinct participants (services, users, databases) exchanging messages in a specific order. The sequence diagram shows who sends what to whom and when. Use a flowchart when you are modeling the logic of a single process or algorithm from one participant's perspective — decision branches, loops, and step sequences within one actor's responsibility.
What is the difference between a synchronous and asynchronous message in a sequence diagram?
A synchronous message (solid arrow, filled arrowhead) means the sender waits for the receiver to complete processing before continuing. A return message (dashed arrow) shows the response. An asynchronous message (solid arrow, open arrowhead) means the sender continues without waiting for a response — the receiver processes independently. Asynchronous messages are used for event-driven systems, message queues, and fire-and-forget calls.
What is a combined fragment in a sequence diagram?
A combined fragment is a box that groups part of the interaction to show conditional or repeating behavior. Common types: alt (alternative — like an if/else), opt (optional — like an if without else), loop (repeating), par (parallel execution), ref (reference to another diagram). The fragment type is written in a small box in the top-left corner of the combined fragment.
How do I show a database query in a sequence diagram?
Add the database as a participant (usually shown as a database cylinder icon or labeled 'DB'). The service that queries it sends a synchronous message: 'SELECT user WHERE email = ?' The database returns the query result via a dashed return arrow. If the database call can fail, wrap the exchange in an 'alt' combined fragment with a 'success' path and a 'not found / error' path.
Generate your first sequence diagram examples diagram free.

Start free — no credit card required. Generate, edit, and export your first diagram in under two minutes.

Get started free →