JSON schema reference
Every object of the workspace format, generated from c4.schema.json (JSON Schema 2020-12) when this site is built. All objects are closed: an unknown field is an error.
Point your editor to the schema for completion and validation: "$schema": "path/to/schema/c4.schema.json". Rules the schema cannot express are listed in Validation rules .
On this page:
Workspace ·
Model · Person · Software system · Container · Component · Relationship ·
Views ·
Dynamic step · Layout · Styles · Element style · Relationship style ·
Common types
Structure
workspace
├── version, name, description, include[]
├── model
│ ├── people[] person
│ ├── softwareSystems[] softwareSystem
│ │ └── containers[] container
│ │ └── components[] component
│ └── relationships[] relationship
├── views[] view (by type)
└── styles
├── elements[] elementStyle
└── relationships[] relationshipStyle
Workspace and model
Workspace (root)
C4 model (context, container and component levels) and its views. Derived from the Structurizr DSL. A file included via include uses the same schema.
Field Type Description
$schemastring Path or URL of this JSON Schema, for editor support. Ignored by the runtime.
version required 1Format version.
namestring Workspace name, used as the page title. Must not be empty.
descriptionstring Workspace description, shown under the page title.
includearray of relative path Files merged into this workspace. Paths are relative to the current file; remote URLs are not allowed.
modelmodel The elements and their relationships.
viewsarray of view Diagrams to render, in page order.
stylesstyles Element and relationship styles, matched by tag.
Model
Field Type Description
impliedRelationshipsboolean Derive relationships between parents from relationships between their children (Structurizr default behaviour). Default: true.
peoplearray of person People: the users or roles that interact with the software systems.
softwareSystemsarray of softwareSystem Software systems, internal or external, with their containers.
relationshipsarray of relationship Every relationship of the model, between any two elements.
Person
Field Type Description
id required id Identifier referenced by relationships, views and steps. Unique across the whole workspace.
name required string Name shown on the diagram. Must not be empty.
descriptionstring Who this person or role is, shown on the diagram.
externalboolean Element outside the organisation or team scope (rendered grey, per C4 notation). Default: false.
groupstring Name of a group. Elements sharing a group are drawn inside a dashed frame. Must not be empty.
tagstags User tags. Default tags (Element, Person, Software System, Container, Component, Relationship) are implicit.
urlURL Link opened when the element is clicked. http and https only.
propertiesproperties Free-form metadata, not rendered.
Software system
Field Type Description
id required id Identifier referenced by relationships, views and steps. Unique across the whole workspace.
name required string Name shown on the diagram. Must not be empty.
descriptionstring What the system does, shown on the diagram.
externalboolean Element outside the organisation or team scope (rendered grey, per C4 notation). Default: false.
groupstring Name of a group. Elements sharing a group are drawn inside a dashed frame. Must not be empty.
tagstags User tags. Default tags (Element, Person, Software System, Container, Component, Relationship) are implicit.
urlURL Link opened when the element is clicked. http and https only.
propertiesproperties Free-form metadata, not rendered.
containersarray of container Containers of the system (C4 level 2).
Container
Field Type Description
id required id Identifier referenced by relationships, views and steps. Unique across the whole workspace.
name required string Name shown on the diagram. Must not be empty.
descriptionstring Responsibility of the container, shown on the diagram.
technologystring Main technology choice (e.g. "Go", "React", "PostgreSQL 16"), shown under the name.
groupstring Name of a group. Elements sharing a group are drawn inside a dashed frame. Must not be empty.
tagstags User tags. Default tags (Element, Person, Software System, Container, Component, Relationship) are implicit.
urlURL Link opened when the element is clicked. http and https only.
propertiesproperties Free-form metadata, not rendered.
componentsarray of component Components of the container (C4 level 3).
Component
Field Type Description
id required id Identifier referenced by relationships, views and steps. Unique across the whole workspace.
name required string Name shown on the diagram. Must not be empty.
descriptionstring Responsibility of the component, shown on the diagram.
technologystring Main technology choice (e.g. "Go", "React", "PostgreSQL 16"), shown under the name.
groupstring Name of a group. Elements sharing a group are drawn inside a dashed frame. Must not be empty.
tagstags User tags. Default tags (Element, Person, Software System, Container, Component, Relationship) are implicit.
urlURL Link opened when the element is clicked. http and https only.
propertiesproperties Free-form metadata, not rendered.
Relationship
Field Type Description
idid Optional. Only needed to target the relationship in include/exclude.
from required id Id of the source element: the one that initiates the interaction.
to required id Id of the destination element.
descriptionstring What the source does with the destination, as a verb phrase (e.g. "Places orders using").
technologystring Protocol and format (e.g. "HTTPS/JSON", "gRPC", "SQL").
tagstags User tags. Default tags (Element, Person, Software System, Container, Component, Relationship) are implicit.
urlURL Link opened when the relationship is clicked. http and https only.
propertiesproperties Free-form metadata, not rendered.
Views
A view is one of the five objects below, chosen by its type. See Views for what each one shows.
systemLandscape view
Landscape: every person and software system, with no central system.
Field Type Description
type required systemLandscapeView type.
key required id Unique view identifier (used as the HTML anchor).
titlestring Title shown above the diagram and in the page navigation. Defaults to the key.
descriptionstring Text shown under the title.
includearray of selector Defaults to ["*"].
excludearray of selector Selectors removed from the selection. Removing an element also removes its relationships.
layoutlayout Automatic layout options.
systemContext view
Level 1: a software system and its direct surroundings.
Field Type Description
type required systemContextView type.
key required id Unique view identifier (used as the HTML anchor).
scope required id Id of a softwareSystem.
titlestring Title shown above the diagram and in the page navigation. Defaults to the key.
descriptionstring Text shown under the title.
includearray of selector Defaults to ["*"].
excludearray of selector Selectors removed from the selection. Removing an element also removes its relationships.
layoutlayout Automatic layout options.
container view
Level 2: the containers of a software system.
Field Type Description
type required containerView type.
key required id Unique view identifier (used as the HTML anchor).
scope required id Id of a softwareSystem.
titlestring Title shown above the diagram and in the page navigation. Defaults to the key.
descriptionstring Text shown under the title.
includearray of selector Defaults to ["*"].
excludearray of selector Selectors removed from the selection. Removing an element also removes its relationships.
layoutlayout Automatic layout options.
component view
Level 3: the components of a container.
Field Type Description
type required componentView type.
key required id Unique view identifier (used as the HTML anchor).
scope required id Id of a container.
titlestring Title shown above the diagram and in the page navigation. Defaults to the key.
descriptionstring Text shown under the title.
includearray of selector Defaults to ["*"].
excludearray of selector Selectors removed from the selection. Removing an element also removes its relationships.
layoutlayout Automatic layout options.
dynamic view
Dynamic: a numbered sequence of interactions, each step being an instance of a relationship of the model (declared or implied).
Field Type Description
type required dynamicView type.
key required id Unique view identifier (used as the HTML anchor).
scopeid Id of a softwareSystem (steps between containers) or a container (steps between components). Omit it for steps between people and software systems.
titlestring Title shown above the diagram and in the page navigation. Defaults to the key.
descriptionstring Text shown under the title.
steps required array of dynamicStep Steps, numbered from 1 in array order. Must not be empty.
layoutlayout Automatic layout options.
View details and styles
Dynamic step
One interaction. A relationship from from to to must exist in the model.
Field Type Description
from required id Id of the source element.
to required id Id of the destination element.
descriptionstring What happens at this step. Defaults to the description of the relationship; also selects the relationship when several link the same elements.
Layout
Automatic layout options.
Field Type Description
directionTB | BT | LR | RLRank direction: TB top to bottom, BT bottom to top, LR left to right, RL right to left. Default: TB.
rankSeparationinteger ≥ 0 Space between ranks, in pixels (default 64).
nodeSeparationinteger ≥ 0 Space between elements of the same rank, in pixels (default 48).
Styles
Field Type Description
elementsarray of elementStyle Element styles. An element takes the styles of its tags, in tag order; later ones win, property by property.
relationshipsarray of relationshipStyle Relationship styles, applied like element styles.
Element style
Style applied to elements with the tag. No shadows: no property allows them.
Field Type Description
tag required string Tag the style applies to. Default tags (Element, Person, Software System, Container, Component) work too. Must not be empty.
shapebox | roundedBox | person | cylinder | pipe | component | webBrowser | mobileDevicePortrait | folderShape of the element. Default: person for people, roundedBox otherwise.
iconstring Embedded image only (data URI), to stay self-contained.
widthinteger ≥ 1 Width in pixels (default 240).
heightinteger ≥ 1 Minimum height in pixels (default 120). The box grows to fit its text.
backgroundcolour Fill colour. Default: C4 blue by level, grey for external elements.
colorcolour Text colour.
strokecolour Border colour.
strokeWidthinteger, 1–10 Border width in pixels (default 1).
bordersolid | dashed | dottedBorder line style (default solid).
opacityinteger, 0–100 Opacity in % (default 100).
fontSizeinteger ≥ 1 Font size of the name, in pixels (default 14). Metadata and description are slightly smaller.
metadataboolean Show the element type and technology (default true).
descriptionboolean Show the description (default true).
Relationship style
Field Type Description
tag required string Tag the style applies to. The default tag Relationship works too. Must not be empty.
colorcolour Colour of the line and its label.
thicknessinteger, 1–10 Line width in pixels.
stylesolid | dashed | dottedLine style (default solid).
routingdirect | orthogonal | curvedorthogonal (default): right angles with rounded corners; curved: fully rounded corners; direct: straight line.
fontSizeinteger ≥ 1 Font size of the label, in pixels (default 11).
widthinteger ≥ 1 Maximum label width, in pixels (default 160).
positioninteger, 0–100 Label position along the line, in % from the source (default 50).
opacityinteger, 0–100 Opacity in % (default 100).
Common types
id
Identifier unique across the whole workspace (included files too). Pattern: ^[A-Za-z][A-Za-z0-9_-]*$.
relative path
Path relative to the declaring file. Absolute paths and URLs are not allowed.
colour
Colour in #RRGGBB hexadecimal notation.
selector
Used in include and exclude. One of:
Form Selects
*The default selection of the view type.
"<id>"One element, by id.
{ "tag": … }Every element with this tag. In exclude, relationships with this tag are removed too.
{ "relationship": … }A relationship by id. In include, adds both of its ends; in exclude, removes the relationship.
Property
Field Type Description
name required string Property name. Must not be empty.
value required string Property value.