Skip to content

Shoes & Bags AR Try-On — API Reference

Base URL: https://dev.wearfits.com


Authentication

All authenticated endpoints accept credentials via one of the following methods, checked in priority order:

Include an API key or session token in the Authorization header:

Authorization: Bearer your_api_key_here

API keys are created and managed at dash.wearfits.com. This is the recommended method for server-to-server integrations.

If the caller is logged into the WEARFITS dashboard, the session cookie is sent automatically by the browser. No additional headers are required.

Users authenticated via dash.wearfits.com receive a NextAuth session cookie (next-auth.session-token) set on the shared .wearfits.com domain. This cookie is forwarded automatically to dev.wearfits.com and is accepted as a valid Level 1 credential.

If the NextAuth account email matches a legacy user's email field, that user's full permission level is inherited. Otherwise, the caller receives a synthetic Level 1 identity.

4. Query Parameter (Legacy, Discouraged)

GET /some/endpoint?token=your_token_here

This method may leak tokens in server logs and referrer headers. Avoid it in new integrations.


API Key Validation

When a Bearer token is an API key created at dash.wearfits.com, it is validated against the following rules:

Condition Rejection reason
Key not found in database not_found
Key has isActive = false inactive
expiresAt is set and in the past expired
maxUsage > 0 and usageCount >= maxUsage over_limit

All validation failures return HTTP 401 with error code invalid_api_key. Usage is incremented only on successful requests.


Permission Levels

Level Name Description
1 Logged In Any authenticated user or valid API key
2 Garment Admin garmentAdmin or admin flag on legacy user
3 Admin admin flag on legacy user

Model Upload API

POST /tryon/api/upload_shoe

Upload a binary GLB shoe model. On success the system automatically creates a new object and queues it for the Autofit processing pipeline.

Authentication required: Level 1 (legacy session, Bearer token, NextAuth session, or API key from dash.wearfits.com)

Content-Type: multipart/form-data

Request fields

Field Type Required Description
file file Yes Binary .glb file, maximum 30 MB
token string No Alternative authentication token (query/body parameter)

Example request

curl -X POST https://dev.wearfits.com/tryon/api/upload_shoe \
  -H "Authorization: Bearer your_api_key_here" \
  -F "file=@shoe_model.glb"

Response — 200 OK

{
    "id": "e84bc8b8afb5e6973556e376f0b942ab",
    "color_id": "default",
    "viewer_url": "https://app.wearfits.com/viewer?object=e84bc8b8afb5e6973556e376f0b942ab"
}
Field Type Description
id string Unique object identifier (hex string)
color_id string Color/material variant identifier
viewer_url string Direct URL to preview the uploaded model in the 3D viewer

Error responses

HTTP Status Error Code Description
400 no_file No .glb file was included in the request
400 file_too_large File exceeds the 30 MB limit
401 unauthorized Missing or invalid authentication
401 invalid_api_key API key is inactive, expired, or over quota

Autofit Status API

After a successful upload, the model enters the Autofit queue where it is automatically aligned and optimized for the try-on engine. Use this endpoint to poll processing progress.

GET /tryon/api/autofit_status

Authentication required: No (public endpoint)

Query parameters

Parameter Required Description
id Yes Object ID returned by upload_shoe
color_id No Color/material variant ID (defaults to default)

Example request

curl "https://dev.wearfits.com/tryon/api/autofit_status?id=e84bc8b8afb5e6973556e376f0b942ab"

Response — 200 OK

{
    "status": "finished",
    "progress": 100,
    "glb_url": "https://storage.googleapis.com/.../object.glb"
}
Field Type Description
status string Current processing state (see values below)
progress number Completion percentage, 0–100
glb_url string URL of the processed GLB file (present only when status is finished)

Status values

Value Description
in_queue Waiting for an available processing slot
in_progress Actively being processed
exporting Generating the final optimized GLB
finished Model is ready for use in the viewer
failed Processing encountered an unrecoverable error

Object & Asset API

These endpoints manage 3D objects, materials, and asset files. Most are public unless noted.

Method Endpoint Description
GET /api/get_models List all available models (filtered by ownership when authenticated)
GET /api/get_object_properties/:name Retrieve properties for a named object
GET /api/get_materials/:name Retrieve materials for a named object
POST /api/set_object_properties Update object properties
POST /api/set_materials Update materials for an object
POST /api/upload_textures Upload texture files for an object
POST /api/upload_mesh Upload a mesh file for an object
POST /api/replace_mesh Replace the existing mesh of an object
POST /api/bake Bake textures for an object
POST /api/claim_object Claim ownership of an object
GET /api/get_gltf/:name Download the GLTF file for a named object
GET /api/get_usdz/:name Download the USDZ file for a named object

Try-On API

Server-side endpoints for programmatic try-on operations.

Method Endpoint Description
POST /tryon/api/garment_fit_on Apply a garment to a provided image
POST /tryon/api/shoes_fit_on Apply shoes to a provided image
POST /tryon/api/report_bug Submit a bug report from a try-on session

Try-On Viewer Endpoints

These are browser-facing HTML routes that load the client-side try-on experience.

Method Endpoint Description
GET /tryon Main try-on experience
GET /tryon/app Try-on application (full UI)
GET /tryon/editor Try-on editor for content management
GET /tryon/accessory-editor Accessory (bags, jewelry) try-on editor

Viewer endpoints support a rich set of URL parameters for runtime configuration. Key parameters include:

Parameter Values Description
pose_quality 1 / 2 / 3 ML pose model quality: lite / full / heavy
native_ml_size 160 / 192 / 256 Input resolution for the ML model
mirror_mode / mm 15 Mirror display mode
turbo 0 / 1 Enable alternating ML/optical-flow pipeline
no_logs 0 / 1 Disable worker logging (15–30% performance gain)
settings 0 / 1 Show advanced settings panel
async_mode 0 / 1 Enable asynchronous processing mode
debug 0 / 1 Enable debug overlay

Integration API

Method Endpoint Description
POST /api/integration/t4l/parse_json Parse a T4L-format JSON payload and return a viewer URL

Rate Limits & Constraints

Constraint Value
Maximum file size 30 MB per upload
Accepted upload format Binary .glb only
Batch uploads Queued; track progress via /tryon/api/autofit_status
API key usage tracking Incremented per successful request only
API key quota enforcement Enforced when maxUsage > 0