API and MCP

Send a PNG or JPEG image from a script, a plugin or an AI agent and get an SVG back. The API uses Homotope’s server processing: same engine, same queue, same credits and same image limit as the workshop.

Full description (OpenAPI 3.1): /api/v1/openapi.json.

Getting started in 3 steps

  1. Create a key in the workshop, “My account” → “API keys”. It starts with hmt_live_ and is shown only once: keep it in a secrets manager, never in a repository or a URL.
  2. Send an image: POST /api/v1/jobs answers straight away with 202 and the job’s identifier, without waiting for it to finish.
  3. Poll, then download: query GET /api/v1/jobs/{id} every 2 to 5 seconds until the state is done, then fetch GET /api/v1/jobs/{id}/svg, or GET /api/v1/jobs/{id}/result?format=pdf (svg, pdf, dxf or eps).

Examples with curl

The key goes in the Authorization: Bearer … header, and only there.

export HOMOTOPE_KEY="hmt_live_…"

# Check the key
curl -sS https://homotope.example/api/v1/me \
  -H "Authorization: Bearer $HOMOTOPE_KEY"

# Send an image (optional options: preset, name, settings)
curl -sS https://homotope.example/api/v1/jobs \
  -H "Authorization: Bearer $HOMOTOPE_KEY" \
  -F [email protected] \
  -F 'options={"preset":"logo","name":"Logo","options":{"export":{"precision":2}}}'
# → 202 {"id":"…","state":"queued","links":{…}}

# Fixed palette: trace with YOUR colours (2 to 64, distinct), no other colour is invented
curl -sS https://homotope.example/api/v1/jobs \
  -H "Authorization: Bearer $HOMOTOPE_KEY" \
  -F [email protected] \
  -F 'options={"preset":"logo","palette":["#E30613","#0057B8","#FFFFFF"]}'

# Poll until "state": "done"
curl -sS https://homotope.example/api/v1/jobs/ID \
  -H "Authorization: Bearer $HOMOTOPE_KEY"

# Download the SVG
curl -sS -o logo.svg https://homotope.example/api/v1/jobs/ID/svg \
  -H "Authorization: Bearer $HOMOTOPE_KEY"

# The same result as PDF, EPS or DXF (cutting; tolerance: flattened curves, in px)
curl -sS -OJ "https://homotope.example/api/v1/jobs/ID/result?format=dxf&tolerance=0.05" \
  -H "Authorization: Bearer $HOMOTOPE_KEY"

# Separations: one layer per colour (layered SVG, DXF layers; ZIP for PDF and EPS)
curl -sS -OJ "https://homotope.example/api/v1/jobs/ID/result?format=svg&layers=1" \
  -H "Authorization: Bearer $HOMOTOPE_KEY"
# … or one file per colour, as a ZIP
curl -sS -OJ "https://homotope.example/api/v1/jobs/ID/result?format=pdf&layers=zip" \
  -H "Authorization: Bearer $HOMOTOPE_KEY"

# Ready to cut? Check the DXF (0.3 mm tool, shared borders merged)
curl -sS "https://homotope.example/api/v1/jobs/ID/cutcheck?tool_mm=0.3&merge_shared=true" \
  -H "Authorization: Bearer $HOMOTOPE_KEY"
# → {"id":"…","report":{"blocking":0,"check":2,"totals":{…},"issues":[…],…}}

# Latest jobs (20 by default, 100 at most; "nextCursor" for the next page)
curl -sS "https://homotope.example/api/v1/jobs?limit=50" \
  -H "Authorization: Bearer $HOMOTOPE_KEY"

# Cancel a queued job, or delete a result
curl -sS -X DELETE https://homotope.example/api/v1/jobs/ID \
  -H "Authorization: Bearer $HOMOTOPE_KEY"

Presets: logo, illustration, pixel-art, line-art, centerline (single stroke: single-pass stroke paths, for lasers, plotters or embroidery), photo. The accepted settings and their bounds are those of the workshop’s “Advanced” panel, described in the OpenAPI document (JobOptions).

Result formats

Ready to cut?

GET /api/v1/jobs/{id}/cutcheck analyses the DXF that …/result?format=dxf would produce (same tolerance, include_background, merge_shared), read-only, and returns a JSON report:

Entitlements

Limits

Errors

Every error has the shape {"error": {"code": "…", "message": "…"}}, with a human-readable message in the language of the Accept-Language header (English by default); rely on the code.

Status Codes What to do
401 invalid_api_key Key missing, unknown or revoked.
402 payment_required No Pro quota or credit left: buy a pack or upgrade to Pro.
404 not_found Unknown job (or one from another account).
408 upload_timeout Upload too long or too slow: the limit is max(60 s, announced size ÷ 256 KB/s), and the rate must stay at 32 KB/s at least. Check the connection, then try again.
409 not_ready SVG requested too early: poll until done.
410 gone Result deleted (retention or deletion).
413 payload_too_large, too_large, quota_exceeded File too heavy, image too large, or storage full.
415 unsupported_media_type Neither PNG nor JPEG (file signature, never its name or declared type).
422 stacked_separations, too_complex, unconvertible One file per colour requested on a stacked result (choose the “cut out” mode); conversion or cut check too long or too heavy (simplify the trace); result that cannot be converted. Retrying as is will not help.
429 rate_limited, too_many_jobs, too_many_uploads Wait for the Retry-After delay, without looping.
503 busy, storage_unavailable, unavailable Conversion slots taken (busy, with Retry-After), or service temporarily unavailable: try again later.

MCP server (AI agents)

Homotope exposes an MCP (Model Context Protocol) server, a thin front for this API, over the “Streamable HTTP” transport:

Example configuration for an MCP client (the key stays with you):

{
  "mcpServers": {
    "homotope": {
      "type": "http",
      "url": "https://homotope.example/mcp",
      "headers": { "Authorization": "Bearer hmt_live_…" }
    }
  }
}

Tools offered to the agent:

A tool error carries the API’s status and code (402, 413, 429…) and a human-readable message. An image_url must be public: https, port 443, no private or local address, 3 redirects at most, read within 15 seconds.

No OAuth: the API key is enough. No stdio transport: the server is remote. The server keeps no session between two requests.