Kroki provides a unified API with support for BlockDiag (BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag, RackDiag), BPMN, Bytefield, C4 (with PlantUML), Ditaa, Erd, GraphViz, Mermaid, Nomnoml, PlantUML, SvgBob, UMLet, Vega, Vega-Lite, WaveDrom... and more to come!

You don't see your favorite diagram tool in this list, please let us know 👋 [email protected] .

The following diagram types and output formats are available:

If you are interested, please 👋 contact us .

Thanks to Exoscale , which has kindly offered two servers, we can provide Kroki as a free service! However, some parts of the infrastructure are still host on other providers, so we are still looking for sponsors to cover all the expenses.

Please refer to the documentation to install Kroki .

Select this option if you want to download and install Kroki on your own infrastructure or in a cloud environment.

Kroki is available as a Free Service and as a Self-Managed instance.

Kroki provides an HTTP API to create diagrams from textual descriptions. Kroki handles both GET and POST requests. When using GET requests, your diagram must be encoded in the URL using a deflate + base64 algorithm. But don't worry, if you're not familiar with deflate or base64 (or if you don't want to use them), you can also send your diagram as plain text using POST requests (see below).

Let's take an example with a GraphViz "Hello World":

hello.dot

digraph G { Hello->World }

Here, we are using a Python one-liner to encode our diagram using deflate + base64:

cat hello.dot | python -c "import sys; import base64; import zlib; print(base64.urlsafe_b64encode(zlib.compress(sys.stdin.read(), 9)))"

In the documentation , we provide code examples that demonstrate how to encode a diagram in Node.js, JavaScript, Java, Python and Go.

The above command will return a value that you can copy in the URL:

GET /graphviz/svg/eNpLyUwvSizIUHBXqPZIzcnJ17ULzy_KSanlAgB1EAjQ

And here's the result:

G Hello Hello World World Hello->World

You can also call Kroki with POST :

POST /

{ "diagram_source": "digraph G {Hello->World}", "diagram_type": "graphviz", "output_format": "svg" }

In this case, you don't need to encode your diagram.

It's also possible to send your diagram as plain text using the Content-Type header. The output format will be specified using the Accept header and the diagram source will be sent as the request body:

POST /graphviz

Accept: image/svg+xml Content-Type: text/plain digraph G { Hello->World }

You can also define the output format in the URL if you don't want to add an Accept header:

POST /graphviz/svg

Content-Type: text/plain digraph G { Hello->World }

The same concept applies when sending the diagram as JSON :

POST /graphviz/svg

{ "diagram_source": "digraph G {Hello->World}" }

Please note that you can interact with the API using any HTTP client.

If you want to learn more, head to our documentation. In particular, check out the Usage section to find out how to send requests to the Kroki API using: