For developers
Integrate Photo to CAD API
Convert any image (photos, drawings, scans, or PDFs) into CAD-ready DXF, SVG, and PDF vector files — programmatically, from your own code with a simple REST API.
The same AI raster-to-vector engine behind PhotoCAD. Start with 5 free conversions.
curl -X POST https://photocad.ai/api/v1/convert \
-H "Authorization: Bearer pcad_live_..." \
-F "image_file=@roof-photo.jpg"1. Send an image
POST a photo, drawing, or PDF page. JPEG, PNG, WebP, TIFF, HEIC, and PDF are accepted.
2. Poll for the result
Conversion is asynchronous; most complete in 60–120 seconds.
3. Download the files
DXF, SVG, PDF, and raw geometry JSON, at any physical size you specify. Same drawing, any size, no extra charge.
Quickstart
- Open your dashboard and turn on Developer mode to reveal the API section — this link does it for you. New here? Create a free account first; email only, no card.
- Create an API key — you get 5 free conversions to start. It's shown once, so store it securely.
- Convert.
It's a plain REST API — call it from Python, Node, or any language. Here's the full convert-and-poll flow:
curl -X POST https://photocad.ai/api/v1/convert \
-H "Authorization: Bearer $PHOTOCAD_API_KEY" \
-F "image_file=@photo.jpg"
# → { "id": "…", "status": "processing" } X-Credits-Charged: 0.0# Python
import requests, time
r = requests.post(
"https://photocad.ai/api/v1/convert",
headers={"Authorization": f"Bearer {API_KEY}"},
files={"image_file": open("photo.jpg", "rb")},
)
conversion = r.json()
while True:
time.sleep(5)
s = requests.get(
f"https://photocad.ai/api/v1/conversions/{conversion['id']}",
headers={"Authorization": f"Bearer {API_KEY}"},
).json()
if s["status"] != "processing":
break
if s["status"] == "complete":
dxf = requests.get(s["files"]["dxf"], headers={"Authorization": f"Bearer {API_KEY}"})
open("drawing.dxf", "wb").write(dxf.content)// Node.js
const form = new FormData()
form.append("image_file", new Blob([await fs.readFile("photo.jpg")]))
const kickoff = await fetch("https://photocad.ai/api/v1/convert", {
method: "POST",
headers: { Authorization: `Bearer ${API_KEY}` },
body: form,
}).then(r => r.json())
let status
do {
await new Promise(r => setTimeout(r, 5000))
status = await fetch(`https://photocad.ai/api/v1/conversions/${kickoff.id}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
}).then(r => r.json())
} while (status.status === "processing")Free to start
Free to start. Every new key comes with 5 free conversions — real DXF/SVG/PDF output, so you can judge the results on your own images and hand a real file to whoever will use it. No card required.
Sandbox. To test your integration itself — polling, parsing, error handling — call the endpoint with a sample file. It returns a real, pre-generated drawing instantly and never spends a credit, so you can wire up your code before spending anything.
curl -X POST https://photocad.ai/api/v1/convert \
-H "Authorization: Bearer $PHOTOCAD_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "sample": "car" }'
# → { "id": "…", "status": "complete" } — instant, free; samples: car, building, dogWhen your 5 free conversions are used, add a card and you're billed $2.00 per conversion, with automatic refunds if one fails.
Pricing
One credit converts one image into every output format. Start with 5 free conversions, then a flat $2.00 per credit — no tiers, no commitment, credits never expire.
Free to start
5 conversions, no card.
$2.00 / credit
Prepaid, auto-refill so your integration never stalls.
Volume or compliance needs?
DPA, security review, dedicated support, committed volume.
Prefer email? sales@photocad.ai
- Auto top-up keeps your integration running unattended — off by default, one toggle in your dashboard.
- Failed conversions are refunded automatically — you pay only for delivered drawings.
- Your API credits also work on photocad.ai — same account, same balance, code or browser.
POST /api/v1/convert
Starts a conversion. Returns 202 with the conversion id immediately; the work runs in the background (see Polling).
Send the image one of three ways
| Mode | How | Limit |
|---|---|---|
| image_file | multipart/form-data binary | ~4 MB |
| image_file_b64 | JSON, base64 (data URLs accepted) | ~3 MB |
| image_url | JSON, we fetch it | 50 MB |
Images are resized to 2,400 px on the long edge on arrival, so anything larger gains nothing — pre-resize or use image_url for big files.
Accepted formats: JPEG, PNG, WebP, TIFF, GIF, HEIC/HEIF, SVG — and PDF: a single-page PDF converts directly; for multi-page PDFs pass page (1-based) to choose the page. One page per request.
Options
| Field | Type | Default | |
|---|---|---|---|
| detailed | boolean | true | Maximum detail. Set false for a simplified drawing. |
| remove_background | boolean | false | Isolate the subject before conversion. |
| sample | string | — | Sandbox: returns a pre-generated sample drawing instantly, free. Values: car, building, dog. JSON only; send instead of an image. |
| page | integer | — | PDF input only: which page to convert. |
Options travel with the image — as extra form fields (multipart) or JSON keys:
# multipart — options as extra -F fields:
curl -X POST https://photocad.ai/api/v1/convert \
-H "Authorization: Bearer $PHOTOCAD_API_KEY" \
-F "image_file=@photo.jpg" \
-F "remove_background=true" -F "detailed=true"# JSON — options alongside the image:
{ "image_url": "https://example.com/photo.jpg",
"remove_background": true, "detailed": true }Response 202
{ "id": "0f6f…", "status": "processing", "credits_remaining": 19 }The X-Credits-Chargedheader reports this request's exact ledger movement (1.0, or 0.0 for free and sandbox conversions).
GET /api/v1/conversions/{id}
Poll until status is terminal.
{
"id": "0f6f…",
"status": "complete",
"title": "Gable Roof Plan",
"width_mm": 300, "height_mm": 227.1,
"preview_url": "https://photocad.ai/api/v1/conversions/0f6f…/files/preview",
"files": {
"dxf": "…/files/dxf", "svg": "…/files/svg",
"pdf": "…/files/pdf", "geometry": "…/files/geometry"
},
"credits_remaining": 19
}Failed conversions return status: "failed" with an error object — and the credit has already been refunded automatically.
GET /api/v1/conversions/{id}/files/{format}
Formats: dxf · svg · pdf · geometry · preview. Files are generated on demand from the stored geometry — the URLs never expire, and output options apply per download. Same drawing, many sizes, no extra charge.
Output options (query parameters)
| Param | Applies to | |
|---|---|---|
| longest | dxf, svg, pdf, geometry | Longest edge of the drawing (e.g. longest=200). |
| max_width, max_height | dxf, svg, pdf, geometry | Fit-within bounds. Aspect ratio is always preserved — the drawing scales to the largest size that fits. |
| units | all size params | Unit for every size value: mm (default), cm, m, km, in, ft, yd, mi. |
| margin | dxf, svg, pdf | Blank page border per side. Defaults to 0 when you specify a size ("the size you specify is the size of the drawing"), 5 mm otherwise. |
| stroke | svg, pdf | Line width (line weight), in mm 0.01–5 — respects units. DXF deliberately ships hairline line weight, so CAM software reads paths as centerlines. |
geometryreturns JSON: every vector path as point coordinates in mm (Y-up, origin bottom-left — the same convention as the DXF), plus the drawing's width and height.
Size limits:DXF, SVG, and geometry have no size limit — export a bracket at 40 mm or a building at 1:1. PDF is capped at ~5 m per side (the PDF page format's own ceiling); for anything larger, use DXF or SVG.
GET /api/v1/account
{
"credits": { "total": 42, "subscription": 0, "api": 42 },
"plan": "free",
"ceiling": { "limit": null, "used": 3 },
"free_conversions": { "granted": 5, "remaining": 2 }
}Call once at startup, then track your balance locally via X-Credits-Charged; credits_remaining on conversion responses is always authoritative.
Recipes
A DXF at an exact physical size
The drawing's longest edge measures exactly 200 mm — no margin, edge to edge.
GET /api/v1/conversions/{id}/files/dxf?longest=200One photo, two deliverables at different sizes
Convert once with the subject isolated at maximum detail, then pull each format at its own size — no re-charge. Here: a 3,000 mm DXF for fabrication and a 150 mm PDF at 0.13 mm line weight for the spec sheet.
# 1. Convert once — subject isolated, maximum detail:
POST /api/v1/convert
{ "image_url": "https://example.com/photo.jpg",
"remove_background": true, "detailed": true }
# 2. Poll to complete, then pull each format at its own size:
GET /api/v1/conversions/{id}/files/dxf?longest=3000
GET /api/v1/conversions/{id}/files/pdf?longest=150&stroke=0.13Page 3 of a plan-set PDF
Host the PDF (up to 50 MB) and point us at it — no client-side rasterizing.
POST /api/v1/convert
{ "image_url": "https://example.com/plans.pdf", "page": 3 }Coordinates for your own pipeline
Skip file parsing entirely — every vector path as millimeter point sets, ready to consume.
GET /api/v1/conversions/{id}/files/geometry?longest=100
// → { "units": "mm", "width": 100, "height": 75.9,
// "layers": [ { "paths": [ { "closed": true, "points": [[14.7, 94.8], …] } ] } ] }Polling & latency
Conversion is asynchronous by nature — this is generative drawing, not millisecond inference. Poll GET /api/v1/conversions/{id} every 3–5 seconds. Typical completion is 60–120 seconds; occasional conversions take up to ~3 minutes. Your credit is only kept if the conversion succeeds.
Errors
Every error returns the same envelope, and no credits are charged for failed requests:
{ "errors": [ { "code": "out_of_credits", "title": "Out of credits", "detail": "…" } ] }| HTTP | Code | Meaning |
|---|---|---|
| 401 | unauthorized | Missing, invalid, or revoked key |
| 402 | out_of_credits | Free conversions used and balance empty — add credits |
| 403 | account_suspended | Account suspended |
| 403 | monthly_ceiling_reached | Monthly usage ceiling hit — contact us to raise it |
| 404 | not_found | No such conversion on your account |
| 409 | conversion_not_ready | Files requested before completion |
| 413 | payload_too_large | Inline image too big — use image_url |
| 422 | invalid_image / invalid_parameters | Undecodable input or bad option values |
| 429 | rate_limited | Slow down — honor Retry-After |
| 503 | service_unavailable | Briefly paused — retry after Retry-After |
Retry guidance: back off exponentially on 5xx; on 429/503 wait the Retry-After seconds. Do not retry 4xx errors unchanged.
Rate limits
20 conversions/minute per key, 60/minute on read endpoints. Standard X-RateLimit-* headers on every response. Limits are per key.
FAQ
- What is the PhotoCAD API?
- A REST API that converts any photo, drawing, scan, or PDF into CAD-ready DXF, SVG, PDF, and raw-geometry files from your own code — the same engine behind photocad.ai.
- What file formats does the API output?
- DXF, SVG, PDF, and raw geometry as JSON, all from a single conversion. You can request each format at any physical size, with no extra charge.
- What can I send the API?
- JPEG, PNG, WebP, TIFF, GIF, HEIC/HEIF, and SVG images, plus PDF (pass a page number for multi-page files). Send the image inline, as base64, or as a URL we fetch (up to 50 MB).
- Can I export drawings at real-world scale?
- Yes. Set the physical size with longest or max_width/max_height in whatever unit suits the drawing — mm, cm, m, km, or in, ft, yd, mi. DXF and SVG have no size limit, so a building can be exported 1:1; PDF is capped at about 5 m per side by the format itself.
- How much does the API cost?
- Start free with 5 conversions on your first key, then a flat $2.00 per credit — one credit converts one image into every format. No tiers, no commitment, and credits never expire.
- Is there a free way to test my integration?
- Yes. Send a sample instead of an image and the sandbox returns a real, pre-generated drawing instantly, with no credit spent — so you can wire up polling, parsing, and downloads before spending anything.
- How long does a conversion take?
- Conversion is asynchronous: you POST an image, get an id, and poll every 3–5 seconds. Most conversions finish in 60–120 seconds; occasional ones take up to about three minutes.
- Are failed conversions charged?
- No. If a conversion fails, the credit is refunded automatically — you pay only for delivered drawings.
- Is there a webhook?
- Not yet — polling is the v1 pattern. Completion webhooks are planned.
Changelog
- Jul 2026 — Free to start. 5 free conversions with your first key, flat $2.00/credit, sample-backed sandbox (replaces test mode).
- Jul 10, 2026 — v1. Initial release: convert, status, files with output options, geometry format, account; PDF/HEIC input; auto top-up.
- Planned. Completion webhooks — polling is the v1 pattern.
By creating an API key you agree to the API Terms. Questions? support@photocad.ai