AI Fashion Clothing API
Generate AI fashion visuals from your own product with a REST API, or straight from Claude or ChatGPT with our MCP. Every workflow of the studio, one endpoint.
/v1/workflowsWorkflows catalogue (77)
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 | Ultra | Max refs |
|---|---|---|---|---|---|---|---|
| POST | freeform_image-v1 | Free Prompt Image | image | 1 cr | 3 cr | 7 cr | 3 |
| POST | freeform_video-v1 | Free Prompt Video | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 1 |
| POST | virtual_try_on-v1 | Virtual Try-On | image | 1 cr | 3 cr | 7 cr | 5 |
| POST | product_to_model-v1 | Product to Model | image | 1 cr | 3 cr | 7 cr | 5 |
| POST | image_to_ghost_mannequin-v1 | Image to Ghost Mannequin | image | 1 cr | 3 cr | 7 cr | 1 |
| POST | change_color-v1 | Change a Color | image | 1 cr | 3 cr | 7 cr | 1 |
| POST | create_design-v1 | Create a Product | image | 1 cr | 3 cr | 7 cr | 3 |
| POST | enhance_photo_to_hd-v1 | Enhance Photo to HD (2K/4K) | image | 1 cr | 3 cr | — | 3 |
| POST | retouch-v1 | Edit an Area | image | 1 cr | 3 cr | — | 16 |
| POST | reimagine_scene-v1 | Reimagine your Model | image | 1 cr | 3 cr | 7 cr | 1 |
| POST | edit_video-v1 | Edit video | video | 3.3 cr/s | 4.3 cr/s | — | 1 |
| POST | motion_design-v1 | Motion Design | video | 4 cr | 4 cr | — | 4 |
| POST | model_walk-v1 | Model Walk | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 1 |
| POST | product_360-v1 | Product 360 | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 3 |
| POST | model_360-v1 | Model 360 | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 2 |
| POST | swap_models-v1 | Swap Model | image | 1 cr | 3 cr | 7 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 | 7 cr | 1 |
| POST | image_to_fabric-v1 | Image to Fabric | image | 1 cr | 3 cr | 7 cr | 1 |
| POST | text_to_textile-v1 | Text to Textile | image | 1 cr | 3 cr | 7 cr | 3 |
| POST | snap_freeze-v1 | Snap Freeze | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 3 |
| POST | ugc_video-v1 | UGC Video | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 3 |
| POST | image_to_flat_lay-v1 | Image to Flat Lay | image | 1 cr | 3 cr | 7 cr | 1 |
| POST | swap_fabrics-v1 | Swap Fabrics | image | 1 cr | 3 cr | 7 cr | 2 |
| POST | logo_placement-v1 | Add a Logo | image | 1 cr | 3 cr | — | 3 |
| POST | text_to_sketch-v1 | Text to Sketch | image | 1 cr | 3 cr | 7 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 | 7 cr | 2 |
| POST | sketch_to_svg-v1 | Sketch to SVG | image | 1 cr | 1 cr | — | 1 |
| POST | vectorize_image-v1 | Vectorize Prints & Logos | image | 1 cr | 1 cr | — | 1 |
| POST | insert_fabric_on_sketch-v1 | Insert Fabric on Sketch | image | 1 cr | 3 cr | 7 cr | 2 |
| POST | create_similar_outfits-v1 | Create Similar Outfits | image | 1 cr | 3 cr | 7 cr | 1 |
| POST | create_design_variations-v1 | Create Design Variations | image | 1 cr | 3 cr | 7 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 | 7 cr | 2 |
| POST | enhance_video_to_hd-v1 | Enhance Video to HD | video | 4.4 cr/s | 4.4 cr/s | — | 3 |
| POST | ai_stylist-v1 | AI Stylist | image | 1 cr | 3 cr | 7 cr | 1 |
| POST | outpaint_new_ratio-v1 | Expand Image | image | 1 cr | 1 cr | — | 1 |
| POST | create_3d_models-v1 | Image to 3D | 3d | 10 cr | 10 cr | — | 1 |
| POST | tryon_video-v1 | Virtual Try-On Video | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 2 |
| POST | outfit_transition-v1 | Outfit Transition | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 2 |
| POST | fashion_ad-v1 | Fashion Ad | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 3 |
| POST | detail_closeup-v1 | Detail Close-up | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 1 |
| POST | editorial_video-v1 | Editorial Lookbook | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 1 |
| POST | outfit_drop-v1 | Outfit Drop | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 3 |
| POST | remove_video_background-v1 | Remove Video Background | video | 1.4 cr/s | 1.4 cr/s | — | 1 |
| POST | reframe_video-v1 | Reframe Video | video | 4.4 cr/s | 4.4 cr/s | — | 1 |
| POST | passerby_transition-v1 | Passer-By Transition | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 3 |
| POST | crosswalk_look_switch-v1 | Look Switch Walk | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 3 |
| POST | change_video_background-v1 | Change Video Background | video | 4.4 cr/s | 8.8 cr/s | — | 1 |
| POST | change_video_outfit-v1 | Edit Outfit in Video | video | 3.3 cr/s | 4.3 cr/s | — | 1 |
| POST | swap_video_model-v1 | Swap Model in Video | video | 3.3 cr/s | 4.3 cr/s | — | 2 |
| POST | hanger_layering-v1 | Hanger Switch | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 5 |
| POST | window_walkby-v1 | Window Walk-By | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 3 |
| POST | detail_zoom_rush-v1 | Detail Zoom Rush | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 1 |
| POST | outfit_morph-v1 | Outfit Morph | video | 2.2 cr/s | 4.4 cr/s | 23 cr/s | 4 |
| POST | freeform_audio-v1 | Create a Soundtrack | audio | 2 cr | 2 cr | — | 1 |
| POST | voice_over-v1 | Create a Voice-over | audio | 1.06 cr/1k chars | 2.12 cr/1k chars | 2.12 cr/1k chars | 3 |
| POST | motion_collection_panorama-v1 | Collection Panorama | video | 1 cr | 1 cr | — | 6 |
| POST | motion_split_reel-v1 | Split Reel | video | 1 cr | 1 cr | — | 4 |
| POST | motion_style_post-v1 | Style Post | video | 1 cr | 1 cr | — | 1 |
| POST | motion_look_film-v1 | Look Film | video | 1 cr | 1 cr | — | 4 |
| POST | motion_colour_drop-v1 | Colour Drop | video | 1 cr | 1 cr | — | 4 |
| POST | motion_phone_promo-v1 | Phone Promo | video | 1 cr | 1 cr | — | 4 |
| POST | motion_cut_montage-v1 | Cut Montage | video | 1 cr | 1 cr | — | 6 |
| POST | motion_paper_collage-v1 | Paper Collage | video | 1 cr | 1 cr | — | 8 |
| POST | motion_lineup-v1 | Lineup | video | 1 cr | 1 cr | — | 6 |
| POST | motion_character_select-v1 | Character Select | video | 1 cr | 1 cr | — | 6 |
| POST | motion_grid_mosaic-v1 | Grid Mosaic | video | 1 cr | 1 cr | — | 2 |
| POST | motion_ways_to_wear-v1 | Ways to Wear | video | 1 cr | 1 cr | — | 6 |
| POST | motion_detail_study-v1 | Detail Study | video | 1 cr | 1 cr | — | 3 |
| POST | motion_signature_film-v1 | Signature Film | video | 1 cr | 1 cr | — | 4 |
| POST | motion_outfit_picker-v1 | Outfit Picker | video | 1 cr | 1 cr | — | 4 |
| POST | motion_beat_cut-v1 | Beat Cut | video | 1 cr | 1 cr | — | 4 |
| POST | motion_bold_word-v1 | Bold Word | video | 1 cr | 1 cr | — | 4 |
| POST | motion_mix_match-v1 | Mix & Match | video | 1 cr | 1 cr | — | 6 |
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/accounts · /v1/publish · /v1/publish/{id} | Images & videos as feed posts, stories, carousels, reels | live | |
| TikTok | /v1/publish/accounts · /v1/publish · /v1/publish/{id} | Videos & photo posts | live |
| X | /v1/publish/accounts · /v1/publish · /v1/publish/{id} | Images & videos as posts | live |
| /v1/publish/accounts · /v1/publish · /v1/publish/{id} | Images & videos as pins, onto a board | live | |
| YouTube | /v1/publish/accounts · /v1/publish · /v1/publish/{id} | Videos as Shorts | live |
/v1/media · /v1/projects · /v1/elements · /v1/media/uploadCreations catalogue (4)
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, 3D models and soundtracks — URLs, thumbnails, project; filters by project, type, favourites, prompt words, workflow, date; next_before and next_before_id page back | live |
| Projects | GET/v1/projects | Your projects — the filter of every listing | 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 |
/v1/account · /v1/credits · /v1/ledger · /v1/account/invoices · /v1/brand-dnaAccount (6)
The account as its AI agent reads it, for your own program: everything in one reading, the credit balance, what it spent and received, its invoices, and its Visual styles with the analysis the vision model wrote. read scope; nothing is debited.
| Action | Endpoints | Returns | Status |
|---|---|---|---|
| Read the account | GET/v1/account | Username, credits, plan, team, brand, Shopify store, Visual styles, projects with their counts, exact library counts, tech packs | live |
| Credit balance | GET/v1/credits | The balance, one decimal | 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 |
| Invoices | GET/v1/account/invoices?limit=12 | Every invoice, plans and credit packs, newest first, with its page and its PDF; next_starting_after pages back | live |
| Visual style | 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 · /v1/techpacks/{id} · /v1/techpacks/{id}/sections · /v1/moodboardsTech packs (9)
The tech packs and the moodboards: listed, exported as a PDF, and a tech pack whole — pages, sections, data — read and written back, exactly as the account's AI agent does it. 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 |
|---|---|---|---|
| List tech packs | GET/v1/techpacks | The packs — id, name, project, cover, last update | live |
| Tech pack PDF | GET/v1/techpacks/{id}/pdf | The pack exported → { url, name } | live |
| 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 |
| List moodboards | GET/v1/moodboards | The boards — id, name, project, cover, last update | live |
| Moodboard PDF | GET/v1/moodboards/{id}/pdf | The board exported → { url, name } | 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 |
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"
}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/mila/messagesMila - AI Agent (10)
Make Mila work from your own program, exactly as in the app: she uses the studio, the store and the tools for you, with the same permissions and the same credits. Every account has her; keys need the agentsscope. Your message appears in her chat, marked with your key's name, and she answers in the thread.
| Action | Endpoints | Returns | Status |
|---|---|---|---|
| Talk to Mila | POST/v1/mila/messages | 202 and a task id; 409 “working” while she is on a task | live |
| Read the thread | GET/v1/mila/messages?since= | Her messages, with typed results (media, post, shopify_media, techpack, file) | live |
| Her state | GET/v1/mila | Free or busy, waiting for your answer, what she may do alone | live |
| Stop | POST/v1/mila/stop | Stops the running task; what was done stays | live |
| Calendar | GET/v1/mila/schedules | What she does later or again: rhythm, next run, last outcome | live |
| Schedule | POST/v1/mila/schedules | { request, kind: single | recurring, time, date? | every?, day_of_week?, day_of_month?, may_publish? } | live |
| Cancel | DELETE/v1/mila/schedules/{scheduleId} | Takes the line off the calendar | live |
| Files | GET/v1/files?query=&folder= | The account’s Files, as Mila sees them | 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 | live |
| Describe a file | PATCH/v1/files/{id or path} | { description } — the one line the index shows | live |
Send a message, then read the thread until she is free. A message can carry pictures from your gallery (media_ids, from /v1/media); an Idempotency-Key header makes a retry harmless.
curl -X POST "https://thenewblack.ai/api/v1/mila/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 Mila 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/mila/messages?since=2026-09-09T15:02:11Z" \ -H "Authorization: Bearer tnb_live_XXXXXXXXXXXX"
When Mila needs your answer, her message is typed question with the replies she expects (options), and her state reads awaiting: "answer". Your next message is the answer.
Fixed routes
Every route of /v1 besides the workflows — the 77 workflows above are not routes but the bodies one route accepts, POST /v1/generate. Drawn from the same descriptions the OpenAPI document, the CLI and the Claude MCP connector are built from: complete by construction, never typed here.
Catalog
| GET | /v1/catalog | Every workflow, public | public |
| GET | /v1/catalog/presets | The stock template library, public | public |
| GET | /v1/openapi.json | This document, public | public |
| GET | /v1/workflows | The live catalogue, keyed | read |
Generate
| GET | /v1/generations/{id} | A generation's status and result | read |
Publish
| POST | /v1/publish | Post a creation to a connected social account | publish |
| GET | /v1/publish/{id} | A post's state | publish |
| GET | /v1/publish/accounts | The connected social accounts | publish |
| GET | /v1/shopify/products | The connected store's products | read |
| POST | /v1/shopify/publish | Put a creation on a product page | publish |
Creations
| GET | /v1/elements | The account's starred pot | read |
| GET | /v1/media | The account's recent creations | read |
| POST | /v1/media/upload | Upload a picture | generate |
| GET | /v1/projects | The account's projects | read |
Account
| GET | /v1/account | The account in one reading | read |
| GET | /v1/account/invoices | The account's invoices | read |
| GET | /v1/brand-dna | The Visual styles | read |
| GET | /v1/brand-dna/{id} | One Visual style in full | read |
| GET | /v1/credits | The account's credit balance | read |
| GET | /v1/ledger | What the account spent and received | read |
Tech packs
| GET | /v1/moodboards | The account's moodboards | read |
| GET | /v1/moodboards/{id}/pdf | The moodboard as a PDF | read |
| GET | /v1/techpacks | The account's tech packs | read |
| GET | /v1/techpacks/{id} | One tech pack whole | read |
| PATCH | /v1/techpacks/{id} | Rename a tech pack | generate |
| GET | /v1/techpacks/{id}/pdf | The tech pack as a PDF | read |
| POST | /v1/techpacks/{id}/sections | Add a section to a page | generate |
| PUT | /v1/techpacks/{id}/sections/{sectionId} | Replace a section's data | generate |
| POST | /v1/techpacks/from-photos | Start a tech pack with AI, from photos· 1 for the reading, plus 1 per sketch. | generate |
Mila
| GET | /v1/files | The account's Files | agents |
| GET | /v1/files/{id} | One page of a file· a fraction of a credit for pdf and pictures (a model reads them), nothing for the rest. | agents |
| PATCH | /v1/files/{id} | Write a file's one-line description | agents |
| GET | /v1/mila | Mila, the account's AI agent | agents |
| GET | /v1/mila/messages | Read Mila's thread | agents |
| POST | /v1/mila/messages | Talk to Mila· what Mila spends on the task, like the chat. | agents |
| GET | /v1/mila/schedules | Mila's calendar | agents |
| POST | /v1/mila/schedules | Put a request on Mila's calendar· each run spends what the task costs. | agents |
| DELETE | /v1/mila/schedules/{scheduleId} | Take a request off Mila's calendar | agents |
| POST | /v1/mila/stop | Stop Mila's running task | agents |
GET /v1/openapi.json carries this whole table with every parameter and answer, and each workflow as a body of POST /v1/generate.
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.
Serving several stores or clients? On the Enterprise plan, each one can be a workspace of its own — its own API keys, its own creations — on one plan and one balance, with the usage of each workspace in Team › Usage.
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 needs only a free account, no plan: a new account starts with free credits, enough to make its first calls before choosing a plan. 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 style and everything in the Creations catalogue), agents (talk to Mila, her 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. |
| 429 | status | required | rate_limited — the account started its plan's generations for this minute; wait the Retry-After seconds. Nothing was charged. |
| 502 | status | required | generation_refused — the job was refused; any debited credit is refunded. |
Rate limits
An account starts a set number of generations a minute, through the API, the CLI and the MCP connector together: 30 without a plan or on Starter, 60 on Pro, 120 on Business, 300 on Enterprise. Reading — polling a generation, listing, checking credits — is not counted. Past the limit, POST /v1/generate answers 429 rate_limited with a Retry-After header (seconds to wait), and nothing is charged. Need more for a launch or a store network? Write to us — the limit can be raised for your account.
// 429 Too Many Requests · Retry-After: 12
{ "error": { "code": "rate_limited", "message": "This account starts at most 60 generations a minute on its plan. Try again in 12 s.",
"retry_after": 12, "limit_per_minute": 60 } }/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). Required where the catalogue says prompt_required: a picture made from words alone, and the text Voice reads. |
| <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. A place the panel may hide (conditional in the catalogue) is required only while the fields' choice shows it. |
| 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), "pro", or "ultra" where the catalogue lists it in tiers: our best model at its largest output — a picture in 4K (from the Pro plan), a video in 1080p on our top video model. For a picture: standard — 1K resolution image + fast generation; pro — 2K resolution image + thinking process before generating; ultra — 4K resolution image + deep thinking process before generating. For a video: standard — 720p resolution video + fast generation; pro — 1080p resolution video + thinking process before generating; ultra — 1080p resolution video + deep thinking process before generating. |
| ratio | string | optional | From the workflow's offered ratios. |
| duration | string | optional | Video and soundtrack workflows: seconds of output, from the allowed durations. |
| visual_dna | string | optional | Optional — the id of one of your Visual styles (GET /v1/brand-dna) or a house style; its paragraph closes the prompt. Only on the workflows where the studio shows a Visual style (visual_dna: true in the catalogue); refused elsewhere. How far it reaches is in effects.reach. |
| sound | string | optional | Video workflows: "on" (default) keeps the clip's own sound, "off" makes it silent; how far it reaches is in effects.reach. |
| end_image | string | optional | Video workflows that take one (end_image: true): an optional closing frame, one public HTTPS URL. |
| references | string[] | optional | Workflows that take them (references: true): one to three public HTTPS URLs put into the clip — a person, a garment, a place — instead of a start or end frame. |
| 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" \
--data-binary @- <<'JSON'
{
"workflow": "product_to_model-v1",
"product_images": [
"https://example.com/handbag.jpg"
],
"fields": {
"gender": "Woman",
"seg_framing": "full body",
"seg_scene": "a rooftop terrace at dusk"
},
"tier": "standard",
"ratio": "4:5",
"webhook_url": "https://example.com/hooks/tnb"
}
JSON// 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.
Most images are ready in under a minute — a background removal in seconds, a virtual try-on or a product on a model in about half a minute; videos take longer. The result's URL lives 48 hours: copy the file to your own storage. After that the result is deleted and the call answers expired — unless the creation was opened in the app, which keeps it like any other.
// 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 }MCP
The same capabilities inside a conversation: connect The New Black AI to Claude or ChatGPT 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.