GlossiDocs
Open Glossi
API

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": "..." } }.

RESTMCP tool
GET /models/:modelId/prep/offerget_model_prep_offer
POST /models/:modelId/prepprepare_model
GET /models/:modelId/preplist_model_preps
GET /models/:modelId/prep/:jobIdget_model_prep
POST /models/:modelId/prep/:jobId/retryretry_model_prep
POST /models/:modelId/prep/:jobId/keepkeep_model_prep
POST /models/:modelId/prep/:jobId/discarddiscard_model_prep

Passes

A run does one or more passes, always in this order:

PassWhat it does
segmentSplits 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.
partsNames every part and groups parts that share a finish, so each finish gets its own material slot.
uvsGives every part even, real-world-scale UVs. Parts with printed artwork keep theirs.
materialsPicks 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
passesrequiredPass names from the table above.
notesAnything the agent should know, in plain words.
referenceKeysUp to 6 photos of the real product, each a referenceKey from POST /materials/generate/reference-upload.
variantNameWith 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_PAYMENTPaid up front and waiting for the payment.
QUEUEDWaiting for a worker.
RUNNINGphase says where it is: downloading, preparing or uploading.
CONVERTINGThe result is being converted into a version.
READYWaiting for you to keep, discard or change it.
NEEDS_INPUTA change needs an answer first; question says what. Answer with retry.
UNCHANGEDA change wasn't made; note says why. The result it was about is still READY.
KEPT, DISCARDED, EXPIRED, FAILEDFinished. 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

CodeHTTPWhen
MODEL_NOT_FOUND, JOB_NOT_FOUND404Not in your workspace.
MODEL_NOT_READY, INVALID_PASSES, INVALID_REFERENCE, TEXT_TOO_LONG, FEEDBACK_REQUIRED400Bad input, or a model still converting.
JOB_NOT_READY, PREP_IN_PROGRESS, REFINES_USED409The run isn't waiting for review, another run is open, or no changes are left.
PAYMENT_REQUIRED, USAGE_LIMIT_REACHED402The card was declined, or the workspace has no usage left.
PREP_UNAVAILABLE, APPROVAL_REQUIRED403Model prep isn't available in this workspace, or needs an owner or admin.
PREP_LIMIT429Too many runs at once in this workspace.

On this page