Sequence Diagram Examples & Templates

Sequence diagrams show how objects interact in a particular sequence of time, displaying the order of messages exchanged between objects or components.

When to Use Sequence Diagrams

Use sequence diagrams to model the flow of logic within your system, show how different parts of a system interact with each other, and document API interactions or user authentication flows.

Common Use Cases:

  • User authentication and login flows
  • Payment processing workflows
  • API request/response patterns
  • Microservice communication
  • System integration scenarios

Featured Sequence Diagram Examples

Explore 3 real-world sequence diagram examples with detailed explanations and PlantUML source code.

UserLogin FormWeb ServerAuth ServiceUser DBUserUserLogin FormLogin FormWeb ServerWeb ServerAuth ServiceAuth ServiceUser DBUser DBEnter credentialsPOST /auth/loginValidate credentialsQuery userUser dataVerify passwordAuth tokenLogin success + tokenRedirect to dashboard

User Login Flow

A sequence diagram showing the complete user authentication process from login form submission to successful authentication and session creation.

View Example
Contactless Payment at a Vending MachineContactless Payment at a Vending MachineUserVending MachineCard.PhonePayment GatewayIssuing BankUserUserVending MachineVending MachineCard/Phone(NFC Device)Card/Phone(NFC Device)Payment GatewayPayment GatewayIssuing BankIssuing BankItem SelectionSelect itemCalculate total amountDisplay total & prompt for paymentPayment InitiationTap card/phone on NFC readerTransmit payment informationCapture payment dataAuthorization ProcessRequest Authorization(amount, card details)Route transaction detailsCheck account funds& fraud indicatorsalt[Transaction Approved]Authorization ApprovedForward approval responsePayment Success FlowDisplay "Payment Successful"Activate dispensing mechanismDispense selected itemItem dispensedTransaction Complete(finalize fund transfer)[Transaction Declined]Authorization DeclinedForward decline responsePayment Failure FlowDisplay "Payment Failed"Cancel transaction

Contactless Payment at a Vending Machine

A sequence diagram illustrating the rapid, automated communication that happens when a user pays for an item at a modern vending machine using contactless payment (NFC card or mobile phone).

View Example
ATM Cash Withdrawal ProcessATM Cash Withdrawal ProcessUserATMBank ServerAccount DatabaseUserUserATMATMBank ServerBank ServerAccount DatabaseAccount DatabaseCard AuthenticationInsert cardRequest PIN entryEnter PINvalidatePIN(cardInfo, pin)authSuccessCash Withdrawal RequestRequest withdrawal amountdebitRequest(account, amount)getBalance(account)currentBalanceBalance Validationalt[Sufficient Funds]updateBalance(account, newBalance)balanceUpdatedauthorizationApprovedCash DispensingDispense cashCash dispensedTransaction receipt[Insufficient Funds]authorizationDenied("Insufficient Funds")Display error messageSession CleanupEject card"Thank you for using our service"Security validations:- PIN verification- Card status check- Daily limit validation- Fraud detectionTransaction logging:- Timestamp- Amount withdrawn- ATM location- Account balance

ATM Cash Withdrawal

A sequence diagram illustrating the step-by-step process of withdrawing cash from an ATM, showing the interaction between user, ATM machine, bank server, and account database with validation steps and potential failure scenarios.

View Example

How to Create Sequence Diagrams in PlantUML

With Plantdiagrams AI-powered editor, you can create professional sequence diagrams in seconds. Simply describe what you want to diagram, and our AI will generate the PlantUML code for you.

1

Open the Editor

Start with our free online PlantUML editor - no installation required.

2

Describe Your Diagram

Use our AI assistant to generate sequence diagram code from natural language.

3

Customize & Export

Edit the diagram with live preview, then export or share with your team.

Need More Examples?

Explore our full gallery of PlantUML diagram examples across all diagram types and industries.