API Reference
Complete reference for all Divctor API endpoints. All endpoints return SVG images.
Base URL
Base
https://api.divct.workers.dev
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET POST | /chart | Generate an SVG chart (8 types supported). GET takes the options in the URL, POST takes the same options as JSON. Same result either way. |
| POST | /graph | Generate an SVG flowchart from nodes and links |
| GET | /saved/:id | Retrieve a saved chart by UUID |
| GET | /health | Health check (returns service status) |
Chart API
GET
GET /chart?type={type}&data={data}&apikey={key}
Core Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| type | string | ✅ | - | bar, line, pie, area, stacked-bar, donut, scatter, radar |
| data | string | ✅ | - | Comma-separated values (max 100) |
| labels | string | No | - | Comma-separated labels |
| title | string | No | - | Chart title |
| apikey | string | ✅ | - | Your API key |
Example
GET
GET /chart?type=bar&data=45,52,38,65&labels=Q1,Q2,Q3,Q4&apikey=YOUR_KEY
Result
bar
Graph API
POST
POST /graph?apikey={key}
Content-Type: application/json
Request Body
| Field | Type | Description |
|---|---|---|
| nodes | array | Array of {"id":"...", "label":"..."} objects (max 50) |
| links | array | Array of {"source":"...", "target":"..."} objects (max 100) |
| options | object | Optional: nodeColor, strokeColor, textColor, bgColor |
Example
POST
POST /graph?apikey=YOUR_KEY
Content-Type: application/json
{
"nodes": [
{"id":"start","label":"Submit"},
{"id":"review","label":"Review"},
{"id":"done","label":"Done"}
],
"links": [
{"source":"start","target":"review"},
{"source":"review","target":"done"}
]
}
Result
flowchart
Saved Charts
GET
GET /saved/{id}
Retrieve a saved chart by its UUID (from a save=true response).
Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | INVALID_TYPE | Unknown chart type |
| 400 | INVALID_DATA | Malformed data |
| 401 | UNAUTHORIZED | Missing or invalid API key |
| 403 | DOMAIN_NOT_ALLOWED | API key restricted to specific domains |
| 403 | INVALID_SIGNATURE | Request signature verification failed |
| 403 | FORBIDDEN | Request blocked (e.g., restricted key usage) |
| 403 | ACCOUNT_SUSPENDED | Account has been suspended |
| 404 | NOT_FOUND | Resource not found |
| 429 | RATE_LIMITED | Too many requests |
| 429 | QUOTA_EXCEEDED | Points quota exhausted (includes Retry-After header) |
| 500 | INTERNAL_ERROR | Internal server error |
| 503 | SERVICE_UNAVAILABLE | Chart generation service down |
OpenAPI Specification
Download the full OpenAPI spec for use with Swagger UI, Postman, or code generators.
Download openapi.yaml