Skip to content

Kroki!

Kroki provides a unified API with support for BlockDiag (BlockDiag, SeqDiag, ActDiag, NwDiag), C4 (with PlantUML), Ditaa, Erd, GraphViz, Mermaid, Nomnoml, PlantUML, SvgBob and UMLet... and
more to come!

Kroki provides an HTTP API to convert plain text diagrams to images.
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:

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:

Looking for inspiration? Visit the examples page.

The following diagram types and output formats are available:

The following diagram types will soon be available:

You don't see your favorite diagram tool in this list, please let us know ? hello@kroki.io.

Kroki is available as a Self-Managed instance.
We are also actively looking for sponsors to provide Kroki as a free service.

Self-Managed

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

Please note that Kroki Self-Managed requires Linux experience to install.

Please refer to the documentation to install Kroki.

Free service

We are actively looking for sponsors to provide Kroki as a free service.

If you are interested, please ? contact us.

We also provide a server for demonstration purpose at: https://demo.kroki.io.

Please note that the demonstration server usage is restricted to reasonable, non-commercial use-cases.
We provide no guarantee regarding uptime or latency.

0
sfy39587p00