Getting started with the API
Generation is asynchronous: you submit a job, then poll for the result. A typical job takes about 5 minutes: roughly a minute to read the product from each angle, about three minutes to build and texture the mesh, and a final minute to refine it. We optimize for realism, not speed.
1. Authenticate
Create an API key from the dashboard, then pass it as a bearer token:
Authorization: Bearer sk-<your-key>
The raw key is shown only once, at creation. Store it in an environment variable or secrets manager.
2. Submit a photo
const form = new FormData();
form.append("images", imageFile); // up to 4 images
form.append("options", JSON.stringify({ tier: "pro" }));
const res = await fetch("https://api.2dto3d.app/api/v1/public/generate", {
method: "POST",
headers: { Authorization: "Bearer sk-..." },
body: form,
});
const { data } = await res.json();
// data.id, data.embedHtml: show embedHtml right away, it renders a loading state
3. Poll for the result
async function waitForModel(id, apiKey) {
const res = await fetch(`https://api.2dto3d.app/api/v1/public/status/${id}`, {
headers: { Authorization: `Bearer ${apiKey}` },
});
const { data } = await res.json();
return data; // data.status: "pending" | "completed" | "failed"
}
Or provide a webhookUrl in options to get a POST callback instead of polling.
Next
See the embed guide for the viewer snippet, or the full interactive API reference for every endpoint, request and response schema, webhooks, rate limits, and error codes.