API Documentation
Build with DevDiagrams.
The DevDiagrams API lets you generate syntax diagrams programmatically from your own applications, scripts, and CI pipelines. API access requires a Professional subscription.
Three steps to your first diagram.
1. Get a Professional subscription
API access requires a Professional subscription. View pricing →
2. Generate an API key
Go to your Account page and generate an API key in the API Keys section. Copy the key immediately — it won't be shown again.
3. Make your first request
Include your API key in the X-Api-Key header of every request.
Example request — curl
curl -X POST https://devdiagrams.com/api/SyntaxDiagram/Render \ -H "X-Api-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "grammarText": "expr : term (\"+\" term | \"-\" term)* ;", "grammarSyntax": "antlr" }'
API key authentication.
All API requests must include your API key in the X-Api-Key header. Keys can be generated and revoked from your Account page. You can have up to 10 active API keys at a time.
Header
X-Api-Key: dd_your_api_key_here
Keep your API keys secure. Do not commit them to source control or expose them in client-side code. If a key is compromised, revoke it immediately from your Account page and generate a new one.
All requests go here.
Base URL
https://devdiagrams.com/api
Available API endpoints.
POST /api/SyntaxDiagram/Render Render a syntax diagram
Request body
Field Type Required Description
grammarText string required The grammar text to render. Supports ANTLR4 and BNF syntax.
grammarSyntax string optional The grammar format. Valid values: antlr, bnf. If not specified, your saved preference is used.
Response — 200 OK
Field Type Description
rules array Array of rendered diagram rules.
rules[].name string The rule name.
rules[].svg string The rendered SVG diagram as an HTML string.
rules[].ruleText string The original grammar text for this rule.
rules[].references string[] Names of rules this rule references.
rules[].description string Description extracted from comments above the rule, if present.
errors string[] Any errors encountered during rendering. Empty on success.
Example response
{ "rules": [ { "name": "expr", "svg": "<svg ...>...</svg>", "ruleText": "expr : term (\"+\" term | \"-\" term)* ;", "references": ["term"], "description": "" } ], "errors": [] }
Response headers
Header Description
X-RateLimit-Limit Maximum requests allowed per day.
X-RateLimit-Remaining Requests remaining today.
X-RateLimit-Reset UTC timestamp when the daily limit resets (midnight UTC).
What went wrong.
All error responses use the following format:
Error response format
{ "error": "Human-readable error message.", "code": "ERROR_CODE" }
Status Code Description
400 MISSING_GRAMMAR_TEXT The grammarText field is missing or empty.
400 INVALID_GRAMMAR_SYNTAX The grammarSyntax value is not recognized. Valid values are antlr and bnf.
401 MISSING_API_KEY The X-Api-Key header is missing from the request.
401 INVALID_API_KEY The provided API key is invalid or has been revoked.
403 INSUFFICIENT_TIER API access requires a Professional subscription.
429 RATE_LIMIT_EXCEEDED The daily request limit of 1000 has been exceeded. Resets at midnight UTC.
500 An unexpected server error occurred. Please try again.
1000 requests per day.
API usage is limited to 1000 requests per day per API key. The limit resets at midnight UTC. Monitor your usage with the X-RateLimit-Remaining response header. When the limit is exceeded you will receive a 429 response until the limit resets.
Try the API in your browser.
Open Swagger UI →