BYTETOOLS

Kroki API

Free diagram-as-code API with no key: send Graphviz, Mermaid, PlantUML or 25 other diagram languages as text and get back SVG, PNG or PDF. Tested curl example included.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 21 Aug 2026

What is the Kroki API?

Kroki is a free, key-free API that turns diagram source text into images. You POST a JSON body containing the diagram source, its language (Graphviz, Mermaid, PlantUML, D2, BPMN and about 25 others) and an output format, and Kroki returns the rendered SVG, PNG or PDF directly.

Kroki solves a problem every documentation site eventually hits: you want diagrams stored as text in Git, but rendering them means installing Graphviz, a JVM for PlantUML, Node for Mermaid and a different binary for every other syntax. Kroki puts all of them behind one HTTP endpoint, so your build pipeline needs nothing but the ability to make a request.

There are two ways to call it. The POST form used below takes a plain JSON body and is by far the easier one to write by hand. The GET form encodes the diagram source into the URL path using deflate plus URL-safe base64, which is what makes Kroki links embeddable straight into a Markdown image tag — useful, but you need a compression step to build the URL.

Quick facts

Base URL
https://kroki.io
Authentication
No API key and no signup for the public instance at kroki.io. Kroki is open source and self-hostable via Docker if you would rather not send diagram source to a third party.
Rate limit
No published hard limit on the public instance. Heavy or commercial use is expected to self-host.
Pricing
Free and open source (MIT). The hosted instance is community-run.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the Kroki API

Every request below was executed against the live API on 21 Aug 2026, and the response shown is the real body it returned — not an illustration.

1. Render a Graphviz diagram as SVG

POST https://kroki.io/

curl
curl -X POST 'https://kroki.io/' \
  -H 'Content-Type: application/json' \
  -d '{"diagram_source":"digraph G {Hello->World}","diagram_type":"graphviz","output_format":"svg"}'
JavaScript (fetch)
const res = await fetch("https://kroki.io/", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"diagram_source":"digraph G {Hello->World}","diagram_type":"graphviz","output_format":"svg"}),
});
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

headers = {
    "Content-Type": "application/json",
}

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

res = requests.post("https://kroki.io/", headers=headers, json=payload, timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 14.1.3 (20260303.0454)
 -->
<!-- Title: G Pages: 1 -->
<svg width="89pt" height="116pt"
 viewBox="0.00 0.00 89.00 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="gr

Parameters

ParameterTypeRequiredDescription
diagram_sourcestringRequiredThe diagram source code, exactly as you would write it in a file. Sent in the JSON body. digraph G {Hello->World}
diagram_typestringRequiredWhich diagram language the source is written in. graphviz
output_formatstringOptionalOutput format. `svg` is supported by every diagram type; `png`, `pdf` and `jpeg` depend on the renderer. Defaults to SVG. svg
diagram_optionsobjectOptionalRenderer-specific options, for example a Mermaid theme.

Response fields

(body)image
The rendered diagram itself, returned as the raw response body rather than wrapped in JSON. Check `Content-Type` to know what you received.
Content-Typeheader
`image/svg+xml`, `image/png`, `application/pdf` or `image/jpeg`, matching the `output_format` you asked for.

What you can build with the Kroki API

  • Render architecture diagrams during a docs build without installing Graphviz or a JVM
  • Add live Mermaid or PlantUML previews to a wiki or CMS editor
  • Generate PNG diagrams for a PDF report pipeline
  • Embed a diagram in a GitHub README as a plain image URL

Common errors and how to fix them

400

The diagram source failed to parse, or `diagram_type` does not match the syntax you sent.

Fix: The response body carries the renderer's own error text — read it, it usually points at the offending line.

404

Unknown `diagram_type`, or an `output_format` that renderer does not support.

Fix: Check the supported matrix in the docs; not every diagram type can emit PNG or PDF.

413

Diagram source too large.

Fix: Split the diagram, or self-host with a raised limit.

Kroki API — frequently asked questions

Is the Kroki API free and does it need an API key?

Kroki is free and needs no API key or account. The hosted instance at kroki.io is community-run, and the whole project is MIT-licensed so you can run your own copy in Docker if you would rather not send diagram source off-site.

Which diagram languages does Kroki support?

Around 25, including Graphviz, Mermaid, PlantUML, D2, BPMN, C4, Ditaa, Excalidraw, Nomnoml, Structurizr, Vega, Vega-Lite and WaveDrom. Every one of them accepts the same POST body shape — only `diagram_type` changes.

What is the difference between the GET and POST forms?

POST takes the diagram source as plain text in a JSON body, which is easy to write by hand. GET encodes the source into the URL using deflate plus URL-safe base64, which produces a stable image URL you can drop straight into Markdown but requires a compression step to build.

Can I call Kroki from browser JavaScript?

Yes. It sends permissive CORS headers, so a fetch() from front-end code works. For SVG output you can insert the returned markup directly into the DOM.

Tools that pair with this API

Alternatives to Kroki API

If Kroki does not fit, these developer & testing apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.

APIWhat it doesAuthCORSLast verified
GitHub REST APIGitHub REST API with no key for public data: repository details, users, issues, releases and commits. 60 req/hour unauthenticated, 5,000 with a token.No keyYes19 Aug 2026
JSONPlaceholderFree fake REST API for testing and prototyping. Posts, comments, users and todos with full GET, POST, PUT and DELETE support. No key. Real curl examples.No keyYes19 Aug 2026
Postman EchoPostman Echo reflects your HTTP request back as JSON: headers, body, query params and auth. Free, no key, ideal for debugging clients. Real POST example.No keyNo19 Aug 2026
DummyJSONFree fake REST API with realistic products, users, carts, recipes and auth. Supports search, pagination, sorting and POST. No key. Tested GET and POST examples.No keyYes19 Aug 2026
Maven Central SearchSearch Maven Central for Java artifacts, latest versions and coordinates with no API key. Solr-backed query syntax, tested example and the epoch-milliseconds trap.No keyNo21 Aug 2026
Mermaid.inkTurn Mermaid diagram source into a PNG, JPEG, SVG or PDF with a single URL. No key, no JavaScript, works in READMEs and email. Verified example included.No keyYes21 Aug 2026
All Developer & Testing APIs

Kroki is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 21 Aug 2026; always check the official documentation before relying on this API in production, as terms and limits can change.