Model prep
Split a model into parts, label its parts and finishes, unwrap its UVs and assign materials, then keep or discard the result, through the REST API or an MCP agent.
Model prep gets a model ready for materials and Studio. The REST API and the MCP connector run the same agent as the model page's Actions tab, and a run started here appears there.
Access
REST requests use your workspace API key in X-API-Key. Paths below are relative to https://api.glossi.io/api/v1. MCP tools take the same arguments by name. Errors use the standard shape, { "error": { "code": "...", "message": "..." } }.
| REST | MCP tool |
|---|---|
GET /models/:modelId/prep/offer | get_model_prep_offer |
POST /models/:modelId/prep | prepare_model |
GET /models/:modelId/prep | list_model_preps |
GET /models/:modelId/prep/:jobId | get_model_prep |
POST /models/:modelId/prep/:jobId/retry | retry_model_prep |
POST /models/:modelId/prep/:jobId/keep | keep_model_prep |
POST /models/:modelId/prep/:jobId/discard | discard_model_prep |
Passes
A run does one or more passes, always in this order:
| Pass | What it does |
|---|---|
segment | Splits a model that arrived as one mesh into its real parts. A sewn garment is split along its pattern seams. The look doesn't change. |
parts | Names every part and groups parts that share a finish, so each finish gets its own material slot. |
uvs | Gives every part even, real-world-scale UVs. Parts with printed artwork keep theirs. |
materials | Picks a library or Glossi catalog material for each finish, and makes a new one when nothing fits. |
["segment", "parts", "uvs", "materials"] is the model page's Prepare model. refine isn't started here; it is what retry runs.
What it costs
A run that includes segment is a one-off purchase for an uploaded model, paid when it starts; the others use your plan's usage. Models made with AI model creation are prepared at no extra cost. Read the offer before starting a segment run:
curl 'https://api.glossi.io/api/v1/models/MODEL_ID/prep/offer' \
-H "X-API-Key: $GLOSSI_API_KEY"{
"offer": {
"billing": "PURCHASE",
"available": true,
"unavailableReason": null,
"mode": "CARD",
"price": { "subtotalMinor": 1500, "totalMinor": 1500, "currency": "USD", "taxTreatment": "STRIPE_AUTOMATIC" },
"includedRefines": 3,
"discards": { "max": 0, "left": 0, "next": "PREPAY", "freesAt": null },
"canApprove": true
}
}billing is PURCHASE, USAGE or INCLUDED. Amounts are in minor units (cents). includedRefines is how many changes the purchase covers before you keep it. discards.next is PREPAY when a new run is paid when it starts and isn't refunded on discard. Some organizations' agreements include free discards: then discards.left counts them, next is FREE while any are left, and the result is paid when you keep it. canApprove is whether the key's user may pay for a prep: a workspace owner or admin.
Start a run
curl -X POST 'https://api.glossi.io/api/v1/models/MODEL_ID/prep' \
-H "X-API-Key: $GLOSSI_API_KEY" -H 'Content-Type: application/json' \
-d '{ "passes": ["segment", "parts", "uvs", "materials"], "notes": "The strap and buckle are separate parts" }'| Body | ||
|---|---|---|
passes | required | Pass names from the table above. |
notes | Anything the agent should know, in plain words. | |
referenceKeys | Up to 6 photos of the real product, each a referenceKey from POST /materials/generate/reference-upload. | |
variantName | With materials: also save the picked look as a variant with this name when the result is kept. |
Returns 202 with { "job": { ... } }. A model must be READY, and only one run per model can be open at a time (409 PREP_IN_PROGRESS).
Follow a run
GET /models/MODEL_ID/prep/JOB_ID returns the run; GET /models/MODEL_ID/prep?limit=10 lists the model's runs, newest first. Poll every 30 seconds or so: a full prep takes up to about 40 minutes, a single pass a few minutes.
status | |
|---|---|
AWAITING_PAYMENT | Paid up front and waiting for the payment. |
QUEUED | Waiting for a worker. |
RUNNING | phase says where it is: downloading, preparing or uploading. |
CONVERTING | The result is being converted into a version. |
READY | Waiting for you to keep, discard or change it. |
NEEDS_INPUT | A change needs an answer first; question says what. Answer with retry. |
UNCHANGED | A change wasn't made; note says why. The result it was about is still READY. |
KEPT, DISCARDED, EXPIRED, FAILED | Finished. error says why a run failed. An unkept result expires after 30 days. |
A READY run carries the report: summary, uncertain (what the agent wasn't sure of), changes, partCount, finishGroupCount, bindingProblems, materials, refinesLeft and paysOnKeep.
Change something
curl -X POST 'https://api.glossi.io/api/v1/models/MODEL_ID/prep/JOB_ID/retry' \
-H "X-API-Key: $GLOSSI_API_KEY" -H 'Content-Type: application/json' \
-d '{ "feedback": "The laces include the red strip on the tongue" }'Changes one area of a READY result that split the model, in your words. referenceKeys takes up to 6 screenshots of the area. It starts a new run whose previousJobId is the result it changes. A purchase covers includedRefines changes; after that, 409 REFINES_USED.
Keep or discard
POST .../keep makes the result the model's current version; the previous version stays in its version history. For a paid result it charges the workspace's saved card and returns { "job": { ... }, "payment": { "status": "PAID", ... } }. A card that needs 3-D Secure returns REQUIRES_ACTION: finish it on the model page. 403 APPROVAL_REQUIRED means the key's user isn't a workspace owner or admin.
POST .../discard throws the result away. A prep paid when it started isn't refunded; under an agreement with free discards, it uses one.
Errors
| Code | HTTP | When |
|---|---|---|
MODEL_NOT_FOUND, JOB_NOT_FOUND | 404 | Not in your workspace. |
MODEL_NOT_READY, INVALID_PASSES, INVALID_REFERENCE, TEXT_TOO_LONG, FEEDBACK_REQUIRED | 400 | Bad input, or a model still converting. |
JOB_NOT_READY, PREP_IN_PROGRESS, REFINES_USED | 409 | The run isn't waiting for review, another run is open, or no changes are left. |
PAYMENT_REQUIRED, USAGE_LIMIT_REACHED | 402 | The card was declined, or the workspace has no usage left. |
PREP_UNAVAILABLE, APPROVAL_REQUIRED | 403 | Model prep isn't available in this workspace, or needs an owner or admin. |
PREP_LIMIT | 429 | Too many runs at once in this workspace. |
Production files
Generate numbered factory production files, keep their views current, and set the inks, decoration methods, and Pantones they print, through the REST API or an MCP agent.
Receive signed webhooks
React to supported Glossi events, verify every request, and reconcile state when delivery is missed or duplicated.