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
Bar Chart

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
Flowchart

Saved Charts

GET
GET /saved/{id}

Retrieve a saved chart by its UUID (from a save=true response).

Error Codes

Status Code Description
400INVALID_TYPEUnknown chart type
400INVALID_DATAMalformed data
401UNAUTHORIZEDMissing or invalid API key
403DOMAIN_NOT_ALLOWEDAPI key restricted to specific domains
403INVALID_SIGNATURERequest signature verification failed
403FORBIDDENRequest blocked (e.g., restricted key usage)
403ACCOUNT_SUSPENDEDAccount has been suspended
404NOT_FOUNDResource not found
429RATE_LIMITEDToo many requests
429QUOTA_EXCEEDEDPoints quota exhausted (includes Retry-After header)
500INTERNAL_ERRORInternal server error
503SERVICE_UNAVAILABLEChart generation service down

OpenAPI Specification

Download the full OpenAPI spec for use with Swagger UI, Postman, or code generators.

Download openapi.yaml