Reference

API documentation

Everything the buttons do is an HTTP call. One bearer token, JSON in and out.

Bearer authJSON in/outIdempotent
01Reference

Getting started

Your API key is in your dashboard. It is shown once at creation — we store only a one-way hash, so a lost key is replaced rather than recovered. Send it as a bearer token:

Authorization: Bearer ds_live_…
Content-Type: application/json

Base URL: https://thinkrai.cloud

02Reference

Idempotency

Every request that spends credits requires an Idempotency-Key header. Reuse the same key when retrying and you get the original result back, charged once. Without this, a reply lost to a flaky connection would be paid for twice — so it is required rather than optional.

03Reference

Errors

StatusMeaning
401Unknown or missing key, or a deactivated account
402Out of credits
409The same idempotency key is already being processed
422The request body cannot be used
429Rate limited — retry shortly
502Generation failed. The credit was refunded

A 502 always means you were not charged — the credit is returned before the response is sent.

04Reference

Endpoints

GET/v1/balance

How many credits are left.

curl https://thinkrai.cloud/v1/balance \
  -H "Authorization: Bearer ds_live_…"

{ "credits": 72, "lowWater": 5 }
POST/v1/generate/description1 credit

Writes a description from the product data and photographs you supply. Up to four images; more angles means less guessing.

curl https://thinkrai.cloud/v1/generate/description \
  -H "Authorization: Bearer ds_live_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "brand": "Nike",
    "title": "Free RN Flyknit Crimson",
    "price": 2499,
    "mrp": 3499,
    "sizes": ["6","7","8","9"],
    "imageUrls": ["https://…/front.jpg"]
  }'

{
  "description": "Nike Free RN Flyknit in Crimson. The upper is…",
  "warnings": [],
  "creditsCharged": 1,
  "creditsRemaining": 71
}

warnings lists any claim that survived our checks and could not be verified from the photographs. Show it to whoever approves the copy.

POST/v1/generate/descriptions/batch1 credit each

Up to 200 products at once, at half the token cost to us and the same price to you. Asynchronous — poll the returned job until it is ready.

curl https://thinkrai.cloud/v1/generate/descriptions/batch \
  -H "Authorization: Bearer ds_live_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "items": [
      { "id": "sku-1", "brand": "Nike", "title": "…", "imageUrls": ["https://…"] },
      { "id": "sku-2", "brand": "Puma", "title": "…", "imageUrls": ["https://…"] }
  ] }'

{ "batchId": "…", "items": 2, "creditsCharged": 2, "pollAfterSeconds": 60 }
curl https://thinkrai.cloud/v1/generate/descriptions/batch/{batchId} \
  -H "Authorization: Bearer ds_live_…"

{
  "ready": true,
  "succeeded": 2,
  "errored": 0,
  "results": [{ "id": "sku-1", "description": "…" }],
  "creditsRefunded": 0
}

Charged up front, refunded per item that fails. Forty submitted and thirty-eight written costs thirty-eight.

POST/v1/enhance/photo5 credits

Cleans up one photograph. Your original is untouched; you get a new image back. The download link expires — save the file, not the URL.

curl https://thinkrai.cloud/v1/enhance/photo \
  -H "Authorization: Bearer ds_live_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "imageUrl": "https://…/front.jpg", "presetId": "white-background" }'

{
  "url": "https://…",
  "expiresInSeconds": 3600,
  "creditsCharged": 5,
  "creditsRemaining": 67
}

Presets: white-background, studio-grey, cleanup. Or send customPrompt instead of presetId — up to 300 characters describing the background or design you want. Send exactly one of the two, never both. Either way the product itself is never altered — only the backdrop changes, described by you or picked from a preset.

POST/v1/generate/banner1 credit

A decorative backdrop for an occasion, in a given shape. GET the same path for the full list.

curl https://thinkrai.cloud/v1/generate/banner \
  -H "Authorization: Bearer ds_live_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "occasion": "diwali", "format": "hero" }'

{
  "url": "https://…",
  "occasion": "diwali",
  "format": "hero",
  "aspect": "21:9",
  "expiresInSeconds": 3600,
  "creditsCharged": 1,
  "creditsRemaining": 66
}

Occasions: plain-studio, sale, diwali, rakshabandhan, holi, eid, navratri, wedding-season, independence-day, christmas, new-year. Formats: hero (21:9), wide (16:9), square (1:1), story (9:16).

Something missing?

Email support@thinkrai.cloud and tell us what you are building. We would rather add the endpoint than have you work around its absence.