Integration
API Reference
Hosted HTTP API for browser, server, automation, and AI-agent integrations.
The hosted API powers the browser editor and can also be called directly from scripts, internal portals, CI jobs, or AI agents.
Request format
http
POST https://dac.moretes.com/api/generate
Content-Type: application/json
{
"yaml": "Diagram:\n ...",
"format": "pdf"
}Response types
| Mode | Content-Type | Body |
|---|---|---|
| png | image/png | Raw PNG bytes |
| application/pdf | Single-page PDF document | |
| drawio | application/xml | mxGraphModel XML |
| error | application/json | {"error":"message"} |
curl example
bash
curl -X POST https://dac.moretes.com/api/generate \
-H "Content-Type: application/json" \
-d '{"yaml":"Diagram:\n DefinitionFiles:\n - Type: URL\n Url: \"https://raw.githubusercontent.com/fernandofatech/diagram-as-code/main/definitions/definition-for-aws-icons-light.yaml\"\n Resources:\n Canvas:\n Type: AWS::Diagram::Canvas\n Children:\n - Bucket\n Bucket:\n Type: AWS::S3::Bucket","format":"pdf"}' \
--output diagram.pdfTypeScript example
ts
const yaml = `Diagram:
DefinitionFiles:
- Type: URL
Url: "https://raw.githubusercontent.com/fernandofatech/diagram-as-code/main/definitions/definition-for-aws-icons-light.yaml"
Resources:
Canvas:
Type: AWS::Diagram::Canvas
Children: [Bucket]
Bucket:
Type: AWS::S3::Bucket`
const response = await fetch('https://dac.moretes.com/api/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ yaml, format: 'drawio' }),
})
if (!response.ok) {
const { error } = await response.json()
throw new Error(error)
}
const xml = await response.text()Integration notes
- The request body expects a DAC YAML string, not a file upload.
- Format defaults to png when omitted. Use pdf for document output or drawio for editable output.
- When generation fails, the endpoint returns a JSON error payload.
- The endpoint is suitable for browser, server-to-server, and agent workflows.