Check results
GET
https://us-central1-aiavatar-01.cloudfunctions.net/businessApi/jobs/{job_id}Tells you whether your photos are ready. When they are, it gives you a link to each photo.
What to send
| Header / path | Required? | What to send |
|---|---|---|
X-Api-Key | Required | Your API key, as a header. |
job_id | Required | The job_id you got back when you made the request. It goes in the address, like /jobs/8f21c0e2-… |
When to call it
Photos take about 1–3 minutes. Don't keep your user waiting — tell them their photos are being made, and check back from your server in the background.
Check once every 15 seconds — don't keep calling
Wait 15 seconds between checks of the same job. Please don't call it in a loop or every second: it won't make the photos any faster, and a job checked more often than every 10 seconds gets a 429 TOO_MANY_REQUESTS answer until you slow down.
// Node.js — check a job once every 15 seconds until it's done
async function waitForPhotos(jobId) {
while (true) {
const res = await fetch(`${BASE}/jobs/${jobId}`, { headers: { "X-Api-Key": KEY } });
const job = await res.json();
if (job.status === "completed" || job.status === "failed") return job;
await new Promise((r) => setTimeout(r, 15000)); // wait 15 seconds before the next check
}
}
Example request
curl "https://us-central1-aiavatar-01.cloudfunctions.net/businessApi/jobs/8f21c0e2-…" \
-H "X-Api-Key: cp_live_xxxxxxxxxxxxxxxx"
Example response
{
"job_id": "8f21c0e2-…",
"status": "completed", // queued → processing → completed (or failed)
"type": "product",
"user_id": "u_1042",
"model_id": null,
"count": 4, // photos you asked for
"completed": 4, // photos made so far
"size": 1,
"images": [ // your photos — download and save these
{ "url": "https://…", "width": 1024, "height": 1024, "position": 0 }
],
"warnings": null, // says so here if some photos couldn't be made
"error": null, // why it failed, if status is "failed"
"created_at": 1790611200000,
"completed_at": 1790611337000,
"expires_at": 1793203200000, // the photos are deleted after this time
"balance": { "images_left": 246 }
}
What the status means
| Status | Meaning |
|---|---|
queued | Waiting to start. Check again later. |
processing | Being made right now. Check again later. |
completed | Done. Download the photos in images. |
failed | No photo could be made. Nothing was charged — error says why. |
Save your photos
Photos are deleted 30 days after they're made (see expires_at). Download them to your own storage as soon as the status is completed — don't link to our URLs from your app.
List your requests
GET
https://us-central1-aiavatar-01.cloudfunctions.net/businessApi/jobsYour recent requests, newest first, 50 per page. Handy if you lost a job_id.
| Query | Required? | What to send |
|---|---|---|
user_id | Optional | Only show this user's requests. |
status | Optional | Only show queued, processing, completed or failed requests. |
type | Optional | Only show product or clothing requests. |
page | Optional | Which page to show, starting at 1. |
curl "https://us-central1-aiavatar-01.cloudfunctions.net/businessApi/jobs?user_id=u_1042&page=1" \
-H "X-Api-Key: cp_live_xxxxxxxxxxxxxxxx"
{
"jobs": [ … ], // each one looks like the response above
"page": 1, // the page you're on
"pages": 3, // how many pages there are
"total": 131, // how many requests in total
"page_size": 50
}
