API docs
Send a picture or an idea from your own app, get a job id, and download the GLB, OBJ and STL when it is done.
Sign in to create a key Submit a job · Poll status · Callbacks · Errors
Your key
Create a key on your Account page. It is shown once, so save it. Send it with every request:
Authorization: Bearer YOUR_KEY
You can have several keys, name them, and revoke any of them on the same page. A revoked key stops working at once.
Credits
The API uses the credits of your account. One model costs 10 credits, taken when the job is accepted. If the model cannot be made, the credits come back by themselves.
1. Submit a model job
POST https://2d.io/api/v1/models
From a picture, as multipart/form-data:
curl https://2d.io/api/v1/models \ -H "Authorization: Bearer YOUR_KEY" \ -F image=@chair.png \ -F triangles=30000 \ -F callback_url=https://example.com/hooks/2d
From a text idea, as JSON:
curl https://2d.io/api/v1/models \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"idea": "a small wooden rowing boat with two oars"}'| Field | What it is |
|---|---|
image | The picture file: PNG, JPG or WebP, up to 10 MB. One object, whole thing in view, plain background works best. |
idea | Instead of a picture: 3 to 200 characters describing one object. We draw the picture first. |
triangles | Optional. One of 2,000, 5,000, 10,000, 20,000, 30,000, 50,000, 100,000. Without it you get 30,000. |
callback_url | Optional. A public web address we call when the model is done or has failed. |
Answer:
{"id": "82fd789a4c32", "status": "waiting"}2. Poll the job status
GET https://2d.io/api/v1/models/ID
curl https://2d.io/api/v1/models/82fd789a4c32 \ -H "Authorization: Bearer YOUR_KEY"
The status moves through waiting → picture → building → finishing → done, or ends as failed. A model takes about 2 minutes; asking every 10 seconds is plenty.
{"id": "82fd789a4c32", "status": "done", "name": "wooden chair", "triangles": 30000,
"glb": "https://2d.io/files/82fd789a4c32/wooden-chair-82fd78.glb",
"obj": "https://2d.io/files/82fd789a4c32/wooden-chair-82fd78.obj.zip",
"stl": "https://2d.io/files/82fd789a4c32/wooden-chair-82fd78.stl"}{"id": "82fd789a4c32", "status": "failed", "reason": "That reads like a real person, a famous character or a brand. Try an idea of your own."}3. Download the files
The file addresses need the same key:
curl -L -o chair.glb \ -H "Authorization: Bearer YOUR_KEY" \ https://2d.io/files/82fd789a4c32/wooden-chair-82fd78.glb
GLB keeps the colours. OBJ is a zip with the shape and its texture. STL is the bare shape for slicing.
Callback
If you sent a callback_url, we POST the same JSON as step 2 to it when the model is done or failed. Answer with any 2xx status. If your server does not answer with 2xx within 10 seconds we try again after 1 minute, 5 minutes, 30 minutes and 2 hours, then stop.
Each call carries two headers so you can check it came from us:
X-2d-Timestamp: 1795211636 X-2d-Signature: sha256=HEX
The signature is HMAC-SHA256 of timestamp + "." + raw body, using the callback secret shown next to your key when you created it.
// Node.js
const crypto = require("crypto");
function fromTwoD(req, rawBody, secret) {
const want = "sha256=" + crypto.createHmac("sha256", secret)
.update(req.headers["x-2d-timestamp"] + "." + rawBody).digest("hex");
const got = String(req.headers["x-2d-signature"] || "");
return got.length === want.length && crypto.timingSafeEqual(Buffer.from(got), Buffer.from(want));
}More calls
GET /api/v1/models | Your last 50 models, newest first, each in the same shape as step 2. |
GET /api/v1/account | Your credit balance (credits), the current cost of one model (credits_per_model) and the free library downloads of the account: how many it gets in total (free_library_downloads) and how many are left (free_library_downloads_left). |
HTTP errors
Errors come back as JSON with one error sentence you can show or log.
| Status | Meaning |
|---|---|
| 400 | Something in the request is not right: no picture or idea, a file that is not a picture, a triangle count that is not in the list. |
| 401 | The key is missing, wrong, or revoked. |
| 402 | Not enough credits for a model. |
| 404 | No model with that id on your account. |
| 413 | The picture is larger than 10 MB. |
| 429 | Too many requests, or the account reached its daily safety limit. Wait and try again. |
| 503 | Making models is paused or not available right now. Nothing was charged; try again later. |
The rules
- Your own pictures only.
- No real people without their OK.
- No famous characters or brands.
They apply to every request. Pictures and ideas that break them are refused, the job ends as failed with the reason, and the credits come back.