Conversion API
Integrate LayerBack to convert diagram images into editable VSDX, PPTX, draw.io, and SVG files through the API.
Authentication
Create a key under Settings → API Keys, then send it with every request:
x-api-key: <your key>Conversions are billed to the key owner's credit balance (10 credits per conversion, all formats included). Failed conversions are refunded automatically.
Create a conversion
Send raw image bytes (PNG, JPEG, or WebP) for images under 4 MB:
curl -X POST https://layerback.com/api/v1/convert \
-H "x-api-key: $LAYERBACK_KEY" \
-H "Content-Type: application/octet-stream" \
--data-binary @diagram.png{ "job_id": "5c048e6f-ec4d-43ad-9eee-0697414d5cef" }Returns 402 when the balance is empty, 413 when the body is too large
(use the upload flow below), 415 for unsupported bytes, and 429 when the
hourly rate limit is hit.
Images larger than 4 MB
Request bodies are capped at about 4.5 MB, so upload bigger images (up to
20 MB) to storage first, then start the conversion with the returned key:
# 1. Get an upload URL (free, valid for 15 minutes)
curl -X POST https://layerback.com/api/v1/uploads \
-H "x-api-key: $LAYERBACK_KEY" \
-H "Content-Type: application/json" \
-d '{"content_type": "image/jpeg"}'{
"key": "uploads/…/mhx2k1-a8f3c9d2",
"upload_url": "https://…",
"method": "PUT",
"headers": { "Content-Type": "image/jpeg" },
"expires_in": 900
}# 2. Upload the image with the same Content-Type
curl -X PUT "$UPLOAD_URL" -H "Content-Type: image/jpeg" --data-binary @photo.jpg
# 3. Start the conversion (billed here, same as above)
curl -X POST https://layerback.com/api/v1/convert \
-H "x-api-key: $LAYERBACK_KEY" \
-H "Content-Type: application/json" \
-d '{"key": "uploads/…/mhx2k1-a8f3c9d2"}'Step 3 returns the same job_id response and accepts callback_url too. It
returns 404 if the image was not uploaded and 413 over 20 MB.
Poll job status
curl https://layerback.com/api/v1/jobs/$JOB_ID \
-H "x-api-key: $LAYERBACK_KEY"{
"job_id": "5c048e6f-…",
"status": "succeeded",
"total_seconds": 46.9,
"formats": ["vsdx", "pptx", "drawio", "svg", "ir", "preview"],
"input_kind": "diagram"
}status moves through queued → running → succeeded or failed.
Poll every few seconds; conversions typically finish in 30–60 seconds.
input_kind tells you what the upload was classified as: diagram and
infographic are rebuilt as editable shapes; document, table_receipt and
screenshot keep the image and replace its text with editable text; photo
and id_document are embedded as an image. A blank image fails with
"error_code": "blank_input" and is refunded.
Download artifacts
curl -L "https://layerback.com/api/v1/jobs/$JOB_ID/download?format=vsdx" \
-H "x-api-key: $LAYERBACK_KEY" -o diagram.vsdxformat accepts vsdx, pptx, drawio, svg, ir (the structured diagram
JSON), or preview (PNG). Downloads are free and repeatable.
The endpoint may respond with a 302 redirect to a short-lived download URL,
so keep the -L flag (or follow redirects in your HTTP client).
Completion webhook
Skip polling: pass callback_url when starting a conversion and we POST
the result to it when the job finishes (success or failure).
curl -X POST "https://layerback.com/api/v1/convert?callback_url=https://your.app/hooks/layerback" \
-H "x-api-key: $LAYERBACK_KEY" \
--data-binary @diagram.pngThe webhook body:
{
"job_id": "…",
"status": "succeeded",
"total_seconds": 31.2,
"error": null,
"error_code": null,
"formats": ["vsdx", "pptx", "drawio", "svg", "ir", "preview"],
"input_kind": "diagram"
}callback_url must be a public https URL. Delivery is attempted twice;
verify important results by calling the job endpoint. Polling keeps
working whether or not you use webhooks.
OpenAPI
The full machine-readable spec lives at layerback.com/openapi.yaml — import it into Postman, or generate a typed client for your language.
Limits
- Images up to 20 MB (over 4 MB: use the upload flow), formats PNG / JPEG / WebP
- Rate limit: 20 conversions per hour per account — building something bigger (batch migration, automation pipelines)? Email davie@daviechen.com for higher limits and volume pricing
- Artifacts are retained for at least 72 hours — download promptly or re-convert when needed
LayerBack Docs