AI Fashion Clothing API
Generate AI fashion visuals from your own product with a REST API, or straight from Claude with our MCP. Every workflow of the studio, one endpoint.
/v1/workflowsWorkflows catalogue (48)
Every studio workflow is callable by its versioned endpoint name. The route returns the live catalogue — named image parameters, fields, variants, formats and prices; the table below is rendered from the same data.
| Method | Workflow key | Title | Mode | Standard | Pro | Max refs |
|---|---|---|---|---|---|---|
| POST | virtual_try_on-v1 | Virtual Try-On | image | 1 cr | 3 cr | 5 |
| POST | product_to_model-v1 | Product to Model | image | 1 cr | 3 cr | 5 |
| POST | create_design-v1 | Create a Product | image | 1 cr | 3 cr | 3 |
| POST | freeform_video-v1 | Create video from text or image | video | 2.2 cr/s | 4.4 cr/s | 1 |
| POST | reimagine_scene-v1 | Reimagine your Model | image | 1 cr | 3 cr | 1 |
| POST | ugc_video-v1 | UGC Videoplan | video | 2.2 cr/s | 4.4 cr/s | 3 |
| POST | edit_video-v1 | Edit videoplan | video | 2.8 cr/s | 3.7 cr/s | 1 |
| POST | model_walk-v1 | Model Walkplan | video | 2.2 cr/s | 4.4 cr/s | 1 |
| POST | product_360-v1 | Product 360plan | video | 2.2 cr/s | 4.4 cr/s | 3 |
| POST | model_360-v1 | Model 360plan | video | 2.2 cr/s | 4.4 cr/s | 2 |
| POST | swap_models-v1 | Swap Model | image | 1 cr | 3 cr | 1 |
| POST | face_swap-v1 | Face Swap | image | 1 cr | 1 cr | 2 |
| POST | fabric_to_design-v1 | Fabric to Image | image | 1 cr | 3 cr | 1 |
| POST | image_to_fabric-v1 | Image to Fabric | image | 1 cr | 3 cr | 1 |
| POST | text_to_textile-v1 | Text to Textile | image | 1 cr | 3 cr | 3 |
| POST | image_to_ghost_mannequin-v1 | Image to Ghost Mannequin | image | 1 cr | 3 cr | 1 |
| POST | image_to_flat_lay-v1 | Image to Flat Lay | image | 1 cr | 3 cr | 1 |
| POST | change_color-v1 | Change a Color | image | 1 cr | 3 cr | 1 |
| POST | swap_fabrics-v1 | Swap Fabrics | image | 1 cr | 3 cr | 2 |
| POST | logo_placement-v1 | Add a Logo | image | 1 cr | 3 cr | 2 |
| POST | text_to_sketch-v1 | Text to Sketch | image | 1 cr | 3 cr | 3 |
| POST | sketch_to_image-v1 | Sketch to Image | image | 1 cr | 3 cr | 1 |
| POST | image_to_sketch-v1 | Image to Sketch | image | 1 cr | 3 cr | 1 |
| POST | sketch_to_svg-v1 | Sketch to SVG | image | 1 cr | 1 cr | 1 |
| POST | vectorize_image-v1 | Vectorize Image | image | 1 cr | 1 cr | 1 |
| POST | insert_fabric_on_sketch-v1 | Insert Fabric on Sketch | image | 1 cr | 3 cr | 2 |
| POST | create_similar_outfits-v1 | Create Similar Outfits | image | 1 cr | 3 cr | 1 |
| POST | create_design_variations-v1 | Create Design Variations | image | 1 cr | 3 cr | 1 |
| POST | change_background-v1 | Change Background | image | 1 cr | 3 cr | 2 |
| POST | remove_background-v1 | Remove Background | image | 0.5 cr | 0.5 cr | 1 |
| POST | ad_creative-v1 | Ad Creative | image | 1 cr | 3 cr | 1 |
| POST | enhance_photo_to_hd-v1 | Enhance Photo to HD (2K/4K)plan | image | 1 cr | 3 cr | 1 |
| POST | enhance_video_to_hd-v1 | Enhance Video to HDplan | video | 2.3 cr/s | 2.3 cr/s | 3 |
| POST | ai_stylist-v1 | AI Stylist | image | 1 cr | 3 cr | 1 |
| POST | outpaint_new_ratio-v1 | Extend Image | image | 1 cr | 3 cr | 1 |
| POST | retouch-v1 | Retouch a Zone | image | 1 cr | 3 cr | 1 |
| POST | freeform_image-v1 | Create or edit images | image | 1 cr | 3 cr | 3 |
| POST | create_3d_models-v1 | Image to 3D | 3d | 10 cr | 10 cr | 1 |
| POST | tryon_video-v1 | Virtual Try-On Videoplan | video | 2.2 cr/s | 4.4 cr/s | 2 |
| POST | outfit_transition-v1 | Outfit Transitionplan | video | 2.2 cr/s | 4.4 cr/s | 2 |
| POST | fashion_ad-v1 | Fashion Adplan | video | 2.2 cr/s | 4.4 cr/s | 3 |
| POST | detail_closeup-v1 | Detail Close-upplan | video | 2.2 cr/s | 4.4 cr/s | 1 |
| POST | editorial_video-v1 | Editorial Lookbookplan | video | 2.2 cr/s | 4.4 cr/s | 1 |
| POST | remove_video_background-v1 | Remove Video Backgroundplan | video | 0.71 cr/s | 0.71 cr/s | 1 |
| POST | reframe_video-v1 | Reframe Videoplan | video | 2.2 cr/s | 4.4 cr/s | 1 |
| POST | change_video_background-v1 | Change Video Backgroundplan | video | 2.8 cr/s | 3.7 cr/s | 1 |
| POST | change_video_outfit-v1 | Edit Outfit in Videoplan | video | 2.8 cr/s | 3.7 cr/s | 1 |
| POST | swap_video_model-v1 | Swap Model in Videoplan | video | 2.8 cr/s | 3.7 cr/s | 2 |
Publishing catalogue (5)
Send what you create where it sells, by API — keys with the publish scope. One documentation page per platform.
| Platform | Endpoints | Publishes | Status |
|---|---|---|---|
| Shopify | /v1/shopify/products · /v1/shopify/publish | Images & videos onto product pages | live |
| /v1/publish · /v1/publish/accounts | Images & videos as feed posts, stories, carousels, reels | live | |
| TikTok | /v1/publish · /v1/publish/accounts | Videos & photo posts | live |
| X | /v1/publish · /v1/publish/accounts | Images & videos as posts | live |
| /v1/publish · /v1/publish/accounts | Images & videos as pins, onto a board | live | |
| YouTube | /v1/publish · /v1/publish/accounts | Videos as Shorts | live |
/v1/media · /v1/projects · /v1/techpacks · /v1/moodboards · /v1/elementsCreations catalogue (8)
Read back what the account has created — keys with the read scope. Every listing accepts ?project=<id> to filter by project. PDF exports return a JSON { url } — public but unguessable, the same regime as every creation URL.
| Resource | Endpoints | Returns | Status |
|---|---|---|---|
| Media | GET/v1/media | Your images & videos — URLs, thumbnails, project | live |
| Projects | GET/v1/projects | Your projects — the filter of every listing | live |
| Tech packs | GET/v1/techpacks · /v1/techpacks/{id}/pdf | The list, and each pack as a PDF | live |
| Moodboards | GET/v1/moodboards · /v1/moodboards/{id}/pdf | The list, and each board as a PDF | live |
| Elements | GET/v1/elements | Your starred pot — creations, presets, uploads | live |
| Upload | POST/v1/media/upload | multipart `file` (JPG, PNG, WebP, 15 MB) + optional `project` → { media_id, url } — a picture of yours, hosted by us, for any image parameter | live |
List, then export — two calls and a downloadable file:
curl "https://thenewblack.ai/api/v1/techpacks" \ -H "Authorization: Bearer tnb_live_XXXXXXXXXXXX"
{
"techpacks": [
{
"id": "3f1c9a6e-8b21-4f7d-9c1e-2a7b5d4e8f01",
"name": "Short sleeves",
"project": "b2cefb2b-3d48-48c1-9f2a-6e1c0d7a9b34",
"cover": "https://cloud.thenewblack.ai/storage/v1/object/public/media/...",
"updated_at": "2026-08-21T14:03:22Z"
}
]
}curl "https://thenewblack.ai/api/v1/techpacks/3f1c9a6e-8b21-4f7d-9c1e-2a7b5d4e8f01/pdf" \ -H "Authorization: Bearer tnb_live_XXXXXXXXXXXX"
{
"url": "https://cloud.thenewblack.ai/storage/v1/object/public/media/exports/.../8c4e21d7-....pdf",
"name": "Short sleeves"
}/v1/account · /v1/ledger · /v1/brand-dnaAccount (3)
The account as its AI agent reads it, for your own program: everything in one reading, what it spent and received, and its Visual DNA profiles with the analysis the vision model wrote. read scope; nothing is debited.
| Action | Endpoints | Returns | Status |
|---|---|---|---|
| Read the account | GET/v1/account | Username, credits, team, Visual DNA profiles, projects with their counts, library counts, tech packs, Shopify product count | live |
| Read the ledger | GET/v1/ledger?days=30&lines=60 | The credit lines of the period, signed, and the usage by team member | live |
| Visual DNA | GET/v1/brand-dna · /v1/brand-dna/{id} | The profiles; one in full with its references and its analysis text | live |
curl "https://thenewblack.ai/api/v1/account" \ -H "Authorization: Bearer tnb_live_XXXXXXXXXXXX"
{
"id": "a1e259ae-...", "username": "maison-k", "credits": 206.5,
"team": { "role": "leader", "members": [{ "id": "3edf...", "username": "lea" }] },
"brand_dna": [{ "id": "7c1a...", "name": "SS27", "focus": "womenswear", "analysed": true, "references": 12 }],
"library": { "creations": 1000, "favourites": 3, "archived": 3 },
"projects": [{ "id": "7763...", "name": "Linen capsule", "creations": 41, "archived": 0, "last_creation": "2026-09-11T16:02:00Z" }],
"counts": { "shopify_products": 18, "techpacks": 4 },
"techpacks": [{ "id": "8363...", "name": "Custom Print Crew Neck T-Shirt", "pages": 2, "project": null, "template": false, "origin": "ai", "updated_at": "2026-09-10T09:14:00Z" }]
}/v1/techpacks/{id} · /v1/techpacks/{id}/sections · /v1/techpacks/from-photosTech packs (5)
A tech pack whole — pages, sections, data — read and written back, exactly as the account's AI agent does it. The list and the PDF export live in the Creations catalogue above. Reading takes the read scope; writing takes generate, the scope that creates and changes things in the studio. Editing costs nothing; Start with AI costs 1 credit for the reading plus 1 per sketch, like the button.
| Action | Endpoints | Returns | Status |
|---|---|---|---|
| Read a tech pack | GET/v1/techpacks/{id} | The pack whole: pages in order, sections with id, kind and data (canvas summarised) | live |
| Rename | PATCH/v1/techpacks/{id} | { name } | live |
| Add a section | POST/v1/techpacks/{id}/sections | { page_id, kind, at_index? } → the page’s sections after the change, with the new id | live |
| Write a section | PUT/v1/techpacks/{id}/sections/{sectionId} | { data } — the whole data of the section in its kind’s shape; the canvas is not writable | live |
| Start with AI | POST/v1/techpacks/from-photos | { images, back?, description?, product?, size_range?, unit?, sketch?, project_id? } → the new pack’s id, up to three minutes | live |
Read a section first, then write back the same keys with your changes — never drop a column or a cell the person made. Shapes by kind: header { cells: [{ key, label, value }] }; descriptions { blocks: [{ key, label, body }] }; size_chart and bom { columns: [{ key, label }], rows: [{ <columnKey>: "text" }], unit?, note? }; end_notes { block: { key, label, body } }.
curl -X PUT "https://thenewblack.ai/api/v1/techpacks/3f1c9a6e-.../sections/9a1d..." \
-H "Authorization: Bearer tnb_live_XXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "data": { "columns": [{ "key": "item", "label": "Item" }, { "key": "supplier", "label": "Supplier" }],
"rows": [{ "item": "Linen 180 g", "supplier": "Libeco" }] } }'{ "ok": true, "section_id": "9a1d...", "kind": "bom" }Start with AI takes photos hosted by us — URLs from /v1/media or from a generation — front first; the model writes the header, the description and the size chart, and the BOM stays empty (a supplier is not in a photo). With sketch it draws the flat(s) on the canvas.
curl -X POST "https://thenewblack.ai/api/v1/techpacks/from-photos" \
-H "Authorization: Bearer tnb_live_XXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "images": ["https://cloud.thenewblack.ai/.../front.jpg"], "size_range": "XS-XL", "unit": "cm", "sketch": "front" }'{ "id": "6b3e...", "status": "done", "note": "Created. Read it (GET /v1/techpacks/{id}) to check the values; the BOM is empty by design." }/v1/agents/{id}/messagesAI agents (10)
Talk to the account's AI agents exactly as in the app — keys with the agentsscope, Business plan and above. An agent has one thread: a message sent here appears in its chat, marked with your key's name, and the agent works with the same tools, the same permissions and the same credits as when you write to it yourself. Its permissions are set in the app and only read here. Its calendar — what it does later or again — and the account's Files are read and written through the same door.
| Action | Endpoints | Returns | Status |
|---|---|---|---|
| List agents | GET/v1/agents | Each agent: name, role, status, permissions, whether it is busy or waiting for your answer | live |
| Send a message | POST/v1/agents/{id}/messages | 202 and a task id; 409 “working” while the agent is busy | live |
| Read the thread | GET/v1/agents/{id}/messages?since= | The messages, each of the agent’s with its typed results (media, post, shopify_media, techpack, file) | live |
| Stop | POST/v1/agents/{id}/stop | Stops the running task; what was done stays | live |
| Calendar | GET/v1/agents/{id}/schedules | What the agent will do later or again: rhythm, next run, last outcome | live |
| Schedule | POST/v1/agents/{id}/schedules | { request, kind: single | recurring, time, date? | every?, day_of_week?, day_of_month?, may_publish? } — each run is an ordinary task, in the agent’s zone | live |
| Cancel | DELETE/v1/agents/{id}/schedules/{scheduleId} | Takes the line off the calendar; nothing already done is undone | live |
| Files | GET/v1/files?query=&folder= | The account’s Files, as the agents see them: paths, descriptions, kinds | live |
| Read a file | GET/v1/files/{id or path}?page=&sheet=&picture= | One page of a pdf, docx, xlsx, pptx, text file or picture; pdf and pictures cost a fraction of a credit | live |
| Describe a file | PATCH/v1/files/{id or path} | { description } — the one line the index shows | live |
Say something, then read the thread until the agent is free. A message can carry pictures from your gallery (media_ids, from /v1/media); an Idempotency-Key header makes a retried request harmless.
curl -X POST "https://thenewblack.ai/api/v1/agents/3f1c9a6e-.../messages" \
-H "Authorization: Bearer tnb_live_XXXXXXXXXXXX" \
-H "Idempotency-Key: order-8812" \
-H "Content-Type: application/json" \
-d '{ "message": "Make three on-model visuals of this product and publish them to Instagram.", "media_ids": ["6f2a9c1b-..."] }'{ "status": "accepted", "task_id": "0c4e...", "message_id": "9a1d...", "created_at": "2026-09-09T15:02:11Z" }
// while the agent works, the same call answers:
{ "status": "working", "task_id": "0c4e...", "since": "2026-09-09T15:02:11Z", "on": "Make three on-model visuals..." }curl "https://thenewblack.ai/api/v1/agents/3f1c9a6e-.../messages?since=2026-09-09T15:02:11Z" \ -H "Authorization: Bearer tnb_live_XXXXXXXXXXXX"
{
"agent": { "id": "3f1c9a6e-...", "name": "Mila", "busy": false, "awaiting": null },
"messages": [
{ "role": "tool", "results": [
{ "kind": "media", "id": "8b2d...", "url": "https://cloud.thenewblack.ai/.../8b2d.webp", "type": "image", "status": "done" },
{ "kind": "post", "id": "p_44...", "platform": "instagram", "status": "to_validate", "at": "2026-09-10T09:00:00Z" }
] },
{ "role": "agent", "kind": "answer", "text": "Three visuals are ready; the Instagram post waits in Posts › To validate.", "results": [] }
]
}When the agent needs your answer before going on, its message is typed question and carries the replies it expects (options); the agent's state reads awaiting: "answer". Your next message is the answer. A post or a Shopify visual keeps living after the message — read its current state through /v1/publish/{id} and /v1/shopify/products.
Introduction
The API is asynchronous, like the studio it drives: you submit a generation, credits are debited atomically at submission, and you collect the result by polling — or let us call your webhook when it settles. A generation that fails is refunded automatically.
Base URL https://thenewblack.ai/api/v1 Format JSON in, JSON out Auth Authorization: Bearer tnb_live_...
The whole API is described in OpenAPI 3.1, publicly and without a key, generated at the instant of the call: GET /api/v1/openapi.json — every route, every workflow as a body schema of /generate, every error code. Point a code generator, an agent or an SDK builder at it. The catalogue alone is at GET /api/v1/catalog (every workflow's contract and prices) and GET /api/v1/catalog/presets (the stock preset shelves). The Claude connector and the CLI build themselves from these.
Authentication
Create up to three keys from your account's API / MCP tab. A key is shown once at creation and stored only as a hash — keep it server-side, never in a browser. Keys belong to the paying account: on a team, they spend the leader's credits.
Each key carries scopes chosen at creation: generate (create with the workflows and edit tech packs — spends credits), read (poll generations, list workflows, check credits, read the account, the ledger, the Visual DNA and everything in the Creations catalogue), agents (talk to the AI agents, their calendar and the Files — spends credits like the chat), publish (post to connected platforms — Shopify and the social platforms).
curl https://thenewblack.ai/api/v1/credits \ -H "Authorization: Bearer tnb_live_XXXXXXXXXXXX"
Errors
Errors are JSON with a stable code and a human message:
{ "error": { "code": "insufficient_credits", "message": "Not enough credits — this needs 3." } }| Parameter | Type | ||
|---|---|---|---|
| 401 | status | required | missing_key · invalid_key — no key, or an unknown/revoked one. |
| 402 | status | required | insufficient_credits — the account balance cannot cover the generation. |
| 403 | status | required | missing_scope — the key exists but lacks the scope for this action. |
| 404 | status | required | unknown_workflow · not_found — no such workflow, or no such generation on this account. |
| 502 | status | required | generation_refused — the provider refused the job; any debited credit is refunded. |
/v1/generateCreate a generation
Requires the generate scope. Credits are debited when the request is accepted; if the balance is short nothing starts and nothing is charged. Returns 202 with the generation id.
| Parameter | Type | ||
|---|---|---|---|
| workflow | string | required | A versioned endpoint from the catalogue, e.g. create_design-v1. The version is part of the name — earlier versions keep being served under theirs. |
| prompt | string | optional | What to create — in English for best results (workflows that take one). |
| <named images> | string | optional | Each workflow declares its image parameters by name, exactly like its panel — sketch_image, fabric_image, model_image… — listed on its endpoint page and in the catalogue. Positional arrays are not accepted. |
| fields | object | optional | The workflow's panel fields by name, options validated — see its endpoint page. |
| variant | string | optional | Workflows with tabs: the variant by its visible title. |
| tier | string | optional | "standard" (default) or "pro". |
| ratio | string | optional | From the workflow's offered ratios. |
| duration | string | optional | Video workflows: seconds of output, from the allowed durations. |
| webhook_url | string | optional | Optional — we POST the outcome here when the generation settles. Without it, poll the URL returned in the response until the status settles. |
curl -X POST https://thenewblack.ai/api/v1/generate \
-H "Authorization: Bearer tnb_live_XXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"workflow": "product_to_model-v1",
"prompt": "AI model wearing the handbag, studio light",
"tier": "standard",
"ratio": "4:5",
"product_images": ["https://example.com/handbag.jpg"],
"webhook_url": "https://example.com/hooks/tnb"
}'// 202 Accepted
{
"generation_id": "3f1c9a6e-...",
"status": "running",
"poll": "/api/v1/generations/3f1c9a6e-..."
}/v1/generations/{id}Retrieve a generation
Requires the read scope. Poll every few seconds until status is succeeded or failed. A failed generation is refunded automatically.
// 200 OK
{
"generation_id": "3f1c9a6e-...",
"workflow": "product_to_model",
"status": "succeeded",
"result": {
"type": "image",
"url": "https://.../result.webp",
"thumbnail": "https://.../thumb.webp"
}
}Webhooks
Pass webhook_url when creating a generation and we POST the outcome — success or failure — to your endpoint the moment it settles, instead of being polled. Answer with any 2xx; we try once, with a 5-second timeout, and your poll endpoint always remains the source of truth.
// POST to your webhook_url
{
"generation_id": "3f1c9a6e-...",
"status": "succeeded",
"result": { "type": "image", "url": "https://...", "thumbnail": "https://..." }
}/v1/creditsCredits
The account's live balance. Generation costs are per workflow and tier — see the catalogue; video is billed per second of output. Top up or subscribe on the pricing page.
// 200 OK
{ "credits": 142 }Claude MCP
The same capabilities inside a conversation: connect The New Black AI to Claude as a Model Context Protocol server and generate from your chat — no code, same keys, same credits. The connector builds its tools from the live catalogue. Setup and details on the MCP page.
Building your integration with Claude Code? Install our skill and Claude knows the whole contract — auth, the async loop, every workflow read live from the catalogue, the CLI — before it writes a line:
npx skills add newblackai/claude-skill --skill thenewblack
Command line
The same API as a program — for an AI coding agent (Claude Code, Codex, Cursor), a script, a cron or a CI job. One command per workflow, generated from the live catalogue, and one per route of this page; local pictures uploaded once, --wait and --out do the plumbing. In a conversation, add the connector; in a project of code, install the CLI. Everything on the CLI page.
npx @thenewblack/cli --help tnb generate virtual_try_on --product_images dress.jpg --model_image model.jpg --ratio 4:5 --wait --out ./renders/
Migrating from the legacy API
When the platform migration completes, the legacy endpoints are retired and answer with a notice pointing here. Keys are not carried over: create a new key from your API / MCP tab, point your integration at /api/v1, and retire the old key with the old endpoints. The concepts are unchanged — submit, poll or webhook, 48-hour storage — with one endpoint now covering every workflow of the studio.