Skip to content

Sequence diagrams ​

Use type=sequence to explain the order of calls, responses, retries, and asynchronous work. Participant columns are authored; time always advances downward.

Create a job{"languageVersion":1,"diagramId":"main","diagrams":["main"],"manifest":[{"id":"main","diagramType":"sequence","status":"selected","reason":null,"annotations":[],"span":{"start":0,"end":387,"line":1,"column":1,"endLine":10,"endColumn":2}}],"targets":[],"diagnostics":[],"diagram":{"declaration":"diagram","attributes":{"type":{"value":{"type":"choice","value":"sequence"},"span":{"start":28,"end":41,"line":1,"column":29,"endLine":1,"endColumn":42},"valueSpan":{"start":33,"end":41,"line":1,"column":34,"endLine":1,"endColumn":42},"nameSpan":{"start":28,"end":32,"line":1,"column":29,"endLine":1,"endColumn":33}}},"path":null,"authoredId":null,"documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"objects":{"object:[\"api\"]":{"declaration":"participant","attributes":{},"path":["api"],"authoredId":"api","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"object:[\"user\"]":{"declaration":"actor","attributes":{},"path":["user"],"authoredId":"user","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"object:[\"worker\"]":{"declaration":"participant","attributes":{},"path":["worker"],"authoredId":"worker","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}}},"relationships":{"relationship:\"connection-2\"":{"declaration":"message","attributes":{},"path":null,"authoredId":"connection-2","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"relationship:\"connection-4\"":{"declaration":"message","attributes":{"type":{"value":{"type":"choice","value":"reply"},"span":{"start":375,"end":385,"line":9,"column":55,"endLine":9,"endColumn":65},"valueSpan":{"start":380,"end":385,"line":9,"column":60,"endLine":9,"endColumn":65},"nameSpan":{"start":375,"end":379,"line":9,"column":55,"endLine":9,"endColumn":59}}},"path":null,"authoredId":"connection-4","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"relationship:\"enqueue\"":{"declaration":"message","attributes":{"delivery":{"value":{"type":"choice","value":"async"},"span":{"start":306,"end":320,"line":8,"column":50,"endLine":8,"endColumn":64},"valueSpan":{"start":315,"end":320,"line":8,"column":59,"endLine":8,"endColumn":64},"nameSpan":{"start":306,"end":314,"line":8,"column":50,"endLine":8,"endColumn":58}}},"path":null,"authoredId":"enqueue","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"relationship:\"request\"":{"declaration":"message","attributes":{},"path":null,"authoredId":"request","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}}}}Copyright © 2017 IBM Corp. with Reserved Font Name "Plex" This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL ----------------------------------------------------------- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ----------------------------------------------------------- PREAMBLE The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. DEFINITIONS "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. "Reserved Font Name" refers to any names specified as such after the copyright statement(s). "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. PERMISSION & CONDITIONS Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. TERMINATION This license becomes null and void if any of the above conditions are not met. DISCLAIMER THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.Create a jobUseractorAPIWorkerAuthorize before dispatch.SubmitValidateQueue work202 Accepted
text
diagram main "Create a job" type=sequence {
  actor user "User"
  participant api "API"
  participant worker "Worker"
  message request ::user -> ::api "Submit"
  message connection-2 ::api -> ::api "Validate"
  note "Authorize before dispatch." over=::api
  message enqueue ::api -> ::worker "Queue work" delivery=async
  message connection-4 ::api -> ::user "202 Accepted" type=reply
}

Participants require explicit IDs and can have titles, tones, roles, links, alignment, mono headers, and text direction. Actors use the same header with an actor role. Participant bodies are not supported.

Messages and notes ​

SyntaxMeaning
message call a -> b "Call"Message from A to B
message notify a -> b "Notify" delivery=asyncOpen asynchronous arrowhead
message response b -> a "Response" type=replyDashed return arrow
message validate a -> a "Validate"Self-call loop
note "Text" over=aNote over one lifeline
note "Text" between=[a, b]Note spanning two participants
note "Text"Note spanning the diagram

Messages accept style, palette, paint properties and positional captions.\nUse label=style to request a style’s default caption. Repeated messages are separate chronological events, so retry calls do not trigger duplicate-transition lint warnings. participant-direction=left reverses columns; right is the default. Up/down flow and graph routing ports do not apply.

Loops, options, and alternatives ​

Poll for a result{"languageVersion":1,"diagramId":"main","diagrams":["main"],"manifest":[{"id":"main","diagramType":"sequence","status":"selected","reason":null,"annotations":[],"span":{"start":0,"end":541,"line":1,"column":1,"endLine":18,"endColumn":2}}],"targets":[],"diagnostics":[],"diagram":{"declaration":"diagram","attributes":{"type":{"value":{"type":"choice","value":"sequence"},"span":{"start":33,"end":46,"line":1,"column":34,"endLine":1,"endColumn":47},"valueSpan":{"start":38,"end":46,"line":1,"column":39,"endLine":1,"endColumn":47},"nameSpan":{"start":33,"end":37,"line":1,"column":34,"endLine":1,"endColumn":38}}},"path":null,"authoredId":null,"documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"objects":{"object:[\"api\"]":{"declaration":"participant","attributes":{},"path":["api"],"authoredId":"api","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"object:[\"browser\"]":{"declaration":"participant","attributes":{},"path":["browser"],"authoredId":"browser","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}}},"relationships":{"relationship:\"connection-1\"":{"declaration":"message","attributes":{},"path":null,"authoredId":"connection-1","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"relationship:\"connection-2\"":{"declaration":"message","attributes":{"type":{"value":{"type":"choice","value":"reply"},"span":{"start":312,"end":322,"line":8,"column":64,"endLine":8,"endColumn":74},"valueSpan":{"start":317,"end":322,"line":8,"column":69,"endLine":8,"endColumn":74},"nameSpan":{"start":312,"end":316,"line":8,"column":64,"endLine":8,"endColumn":68}}},"path":null,"authoredId":"connection-2","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"relationship:\"connection-3\"":{"declaration":"message","attributes":{"type":{"value":{"type":"choice","value":"reply"},"span":{"start":420,"end":430,"line":11,"column":65,"endLine":11,"endColumn":75},"valueSpan":{"start":425,"end":430,"line":11,"column":70,"endLine":11,"endColumn":75},"nameSpan":{"start":420,"end":424,"line":11,"column":65,"endLine":11,"endColumn":69}}},"path":null,"authoredId":"connection-3","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}}}}Copyright © 2017 IBM Corp. with Reserved Font Name "Plex" This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL ----------------------------------------------------------- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ----------------------------------------------------------- PREAMBLE The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. DEFINITIONS "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. "Reserved Font Name" refers to any names specified as such after the copyright statement(s). "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. PERMISSION & CONDITIONS Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. TERMINATION This license becomes null and void if any of the above conditions are not met. DISCLAIMER THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.Poll for a resultBrowserAPIloop: Until completealt: Job statusbranch: Completebranch: Pendingopt: Notify the userDisplay the completed result.GET /jobs/:id200 + result200 + pending
text
diagram main "Poll for a result" type=sequence {
  participant browser "Browser"
  participant api "API"
  loop "Until complete" {
    message connection-1 ::browser -> ::api "GET /jobs/:id"
    alternatives "Job status" {
      branch "Complete" {
        message connection-2 ::api -> ::browser "200 + result" type=reply
      }
      branch "Pending" {
        message connection-3 ::api -> ::browser "200 + pending" type=reply
      }
    }
  }
  optional "Notify the user" {
    note "Display the completed result." over=::browser
  }
}

Fragments have a quoted label and nonempty event body. alternatives needs at least two branch blocks. Nesting reserves room for headings and frames; deeply nested fragments can need a wider canvas.

Diagram Loading renderer…
Your diagram appears here. The renderer loads once and runs in your browser.

Ctrl+Enter renders now · Tab moves focus · Click a diagnostic to select its source · Expand for pan, zoom and presentation controls

Use your own fallback fonts

CJK uses your system fonts by default. Choose standalone .ttf/.otf faces for exact measurement and embedding. Files stay in this browser; share links do not include fonts.

Labels, notes, and roles wrap with measured fonts. CJK and Arabic/Hebrew work with the same fallback policy as graphs. These fragments organize the explanation; they do not repeat events during playback. Activation bars, participant creation/destruction, parallel fragments, and timing axes are future work.

For a talk, keep participant lifelines visible and reveal individual messages with explicit show connections=[…] steps. Try the request/retry presentation.

MIT OR Apache-2.0 · Bundled fonts: SIL OFL 1.1