canonical: https://jentic.com/apis/fashn.ai/fashn

# FASHN API

The FASHN API runs virtual try-on, model creation, and image-editing models from the FASHN AI platform. Predictions are submitted through a single universal `/v1/run` endpoint with a model_name field, then polled for completion via `/v1/status/{id}.` A `/v1/credits` endpoint reports remaining credit balance. The async predict-then-poll pattern lets agents submit jobs without holding open connections.

## For AI agents

Submit virtual try-on, model generation, and AI image-editing jobs to FASHN, then poll for results and check remaining credits.

## Scope

Does not handle physical product fulfilment, sizing recommendations, or full e-commerce flows - use for AI image generation and try-on rendering only.

## Capabilities

- Submit virtual try-on jobs that place a garment image onto a model image via POST `/v1/run`
- Run AI fashion-model generation by selecting the appropriate model_name in POST `/v1/run`
- Apply image-editing models (background, garment swap, retouching) through the same `/v1/run` endpoint
- Poll for prediction completion and retrieve output URLs via GET `/v1/status/{id}`
- Check remaining credit balance before kicking off a batch of predictions via GET `/v1/credits`

## Use cases

### Virtual Try-On for E-Commerce Product Pages

Fashion retailers use FASHN to render every garment on a consistent set of model images without booking studio shoots. The agent submits a try-on job to `/v1/run` with the garment URL, model image, and chosen model_name, then polls `/v1/status/{id}` for the rendered output. Cuts product-photography turnaround from weeks to minutes per SKU.

Example prompt: POST to `/v1/run` with model_name 'tryon' and a garment plus model image, then poll GET `/v1/status/{id}` until status is complete and return the output URL

### AI Model Generation for Brand Lookbooks

Brands generate diverse model imagery without casting calls by calling `/v1/run` with a model-generation model_name and prompt. The async job returns rendered model photos suitable for lookbooks and marketing assets. Pairs well with image-editing follow-up calls to refine output.

Example prompt: POST to `/v1/run` with the model-generation model_name and a styling prompt, poll `/v1/status/{id}`, and store the resulting image URLs in the brand asset library

### Credit-Aware Batch Pipeline

Agencies running large try-on batches first call GET `/v1/credits` to confirm balance, then submit jobs to `/v1/run` in parallel and track each via `/v1/status/{id}.` The pattern prevents mid-batch failures from credit exhaustion. Useful for any workflow that needs to plan against a metered AI budget.

Example prompt: Call GET `/v1/credits` to check balance, then for N jobs POST `/v1/run` and poll `/v1/status/{id}` for each prediction id

### AI Stylist Agent via Jentic

Conversational stylists embedded in shopping apps use Jentic to call FASHN without managing bearer tokens directly. The agent searches 'generate virtual try-on', loads `/v1/run`, and orchestrates the predict-poll loop using the credentials Jentic injects. Cuts integration from days to under an hour.

Example prompt: Through Jentic, search 'generate a virtual try-on', load `/v1/run`, submit the user's chosen garment and model image, then poll `/v1/status/{id}` until the result is ready

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/v1/run` | Submit a prediction job for the chosen model_name |
| GET | `/v1/status/{id}` | Poll for prediction status and retrieve output |
| GET | `/v1/credits` | Get remaining credit balance |

## Key resources

- **Predictions** — Submit prediction jobs and poll for status; covers try-on, model generation, and image edits via model_name
- **Utility** — Account utilities including credit balance

## Why Jentic

- **Setup:** Wiring the FASHN API by hand means learning its bearer auth and running the async pattern yourself: POST a run, then poll `/v1/status/{id}` until the render finishes. Through Jentic you install once, import FASHN from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** FASHN is built around a small set of operations for try-on rendering, so limit the agent to the operations it needs, such as starting a run, checking a run status, or reading the remaining credit balance. You choose which of those operations it may call, so the run trigger is included only when you add it.
- **Credential handling:** Your FASHN bearer token is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'generate a virtual try-on', and Jentic returns the POST `/v1/run` operation with its model_name input schema so the agent picks the right model variant without browsing the FASHN docs.

## Related APIs

- **Replicate** — General-purpose hosted inference for any model - broader than FASHN's fashion focus
- **Stability AI** — Foundation image-generation models without fashion-specific tuning
- **Claid** — Post-process FASHN outputs with background and product retouching
- **PhotoRoom** — Background removal and editing for downstream product imagery

## FAQ

### What authentication does the FASHN API use?

FASHN uses HTTP Bearer token authentication - supply your FASHN API key in the Authorization header as a bearer token. Through Jentic the bearer token is stored encrypted in the vault and injected at execution time.

### Can I run virtual try-on with the FASHN API?

Yes. POST to `/v1/run` with the try-on model_name plus garment and model image inputs, then poll GET `/v1/status/{id}` until the prediction completes and returns the rendered output URL.

### What are the rate limits for the FASHN API?

FASHN does not publish explicit rate limits in the OpenAPI spec - usage is governed by the credit balance returned by `/v1/credits.` Check credits before large batches and back off on 429 responses if encountered.

### How do I generate a try-on image through Jentic?

Install with pip install jentic, search 'generate a virtual try-on', load POST `/v1/run`, execute with model_name and image inputs, then poll `/v1/status/{id}` until complete. Get started with Jentic One, the self-hosted execution layer.

### Are predictions synchronous or async on the FASHN API?

Async. POST `/v1/run` returns a prediction id immediately and the agent polls GET `/v1/status/{id}` until status reports complete. Plan your agent loop with a poll interval and timeout.

### Can I limit what my agent is allowed to do with the FASHN API?

Yes. Because you run Jentic One yourself, your own rules decide which FASHN operations and credentials the agent may use. You can grant read-only access to checking run status via GET `/v1/status/{id}` and reading the credit balance via GET `/v1/credits`, while withholding the ability to start new predictions with POST `/v1/run.` The run trigger is available to the agent only when you choose to include it.
