Getting Started

Getting Started

This guide walks you through making your first Mirrago API request — from authentication to generating a try-on image.

By the end of this guide, you will:

  • Obtain an access token
  • Create a try-on generation job
  • Retrieve the completed try-on image

No SDKs are required. Mirrago is a simple HTTPS API.

Base URL

All API requests are made to:

https://api.mirrago.com

Step 1 — Get API Credentials

When your business account is created, you will receive through email:

  • client_id
  • client_secret

These credentials identify your application and allow you to request access tokens.

Keep your client_secret secure. Do not expose it in frontend or public client code.

Step 2 — Generate an Access Token

Before calling the Try-On API, request an access token.

Endpoint

POST /oauth/token

Request Body

{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "grant_type": "client_credentials"
}

Example curl request

curl https://api.mirrago.com/oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET",
    "grant_type": "client_credentials"
  }'

Response

{
  "access_token": "eyJhbGci...",
  "expires_in": 3600,
  "token_type": "Bearer"
}

Use the token

Include this header in all API requests:

Authorization: Bearer <access_token>

Step 3 — Create a Try-On Job

Endpoint

POST /v1/mirrago/generate-image

Request Headers

Authorization: Bearer <access_token>
Content-Type: application/json

Request Body

{
  "model_image_url": "https://cdn.yourbrand.com/models/model.jpg",
  "garment_image_url": "https://cdn.yourbrand.com/garments/shirt.png"
}

Response

{
  "job_id": "82cd18eb-fd80-4292-9c40-3c31e739604c",
	"status": "pending",
	"business_id": "nike",
	"username": "TEMP2c9eaf7f-3fcd-4041-9eab-ed6dbaa58b53",
	"cloth_id": "business/nike/clothes/6dae61c8-e73f-4799-bde0-4b17c62c1853.jpeg",
	"credits_before": 100,
	"created_at": "2026-01-24T13:07:14.211044"
}

The job now starts processing asynchronously.

Step 4 — Retrieve Job Status

Endpoint

GET /v1/mirrago/job/{job_id}

Request Header

Authorization: Bearer <access_token>

Response (Processing)

{
  "job_id": "82cd18eb-fd80-4292-9c40-3c31e739604c",
	"cloth_id": "business/nike/clothes/6dae61c8-e73f-4799-bde0-4b17c62c1853.jpeg",
	"cloth_img_url": "https://tryon-userdb.s3.amazonaws.com/business/nike/clothes/6dae61c8-e73f-4799-bde0-4b17c62c1853.jpeg?response-content-type=image%2Fjpeg&response-content-disposition=inline&AWSAccessKeyId=ASIAUW4RAOORWORNVDLW&Signature=GwQ7DaGuz3awwD6wBcbSOU2hl9o%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEEYaCXVzLWVhc3QtMSJHMEUCIQCNHzrud8XoayDXajpsbJtTZmrKAhyKJvdIz8cqKKdMSQIgcwaf9IVj0Zd8wBBhrARNggVL7EIcB7qXiQjruUHeQ%2FQq6gIIDhAAGgwzMjQwMzcyNzY1NzkiDHMU%2BHyxBCc2NWjmQSrHAk3ku9yKLepDpS7CqF12qdfFnfN2p%2BkRzlPOmjYj21bRw8donKK3%2FNxOitGzEsOluYiefM98TCyO85MB7piIzXnb00tbAjRDwBL1uQNNjZw%2BZgFBiT3BHAznSqDaOf7DLheBK8Xpc2gDaWdvbuQkdimILEBBpNMeazPJ%2Fc5JGfS8U06wk44R024a4uObDNeVddNVvQGMXDpbxoeWU6s4s8bpxcVjx94dndHfXM3Bx9ihUeZBZNb3GW%2Fse1JOFrOP%2FFaOtbvJMmDC47XeFmsr%2Bh56Uus0uzsCpMAM03bmKuHBK5sX4GVWzZSZ7uqGNL%2BBXnNXNS3S7HJFGSgBFXS6Y7A8yZvvvoCSvrDg5YorWMjTJ3m1M2w8M0iSTZ7Pl7N7xo1kN62hi2ZwkR9C92lY%2BNC8SSXFK457QcEjPf5Cl8g7wNI8hOEKtDD6htPLBjqeAcXe5I7V1N%2BLoa1rYpHZHw5wd8cRaezT4THD9802X7QU3Jnfa7L5XSgUbJ4JHBuKjals41KOUKmSZadrjaFaJiyAHu%2BaPRbGBfROTxeQR8PD2yjFT8qpk4NmsbwBT4%2Fuw%2FPLQGuJ3FHH%2FlYtSM%2BGncMTnP38l4mo3OtBrtfCZ9ZZOkEGYkwkbcZxie8ElGnO5xLDEyXyh9dA%2BYNAbx36&Expires=1769864854",
	"status": "queued" or "pending",
	"created_at": "2026-01-24T13:07:14.096542",
	"generated_image_key": "",
	"result_url": null,
	"error_msg": {
			"error": ""
	}
}

Response (Completed)

{
  "job_id": "job_12345",
  "status": "completed",
  "result_image_url": "https://cdn.mirrago.com/results/job_12345.jpg"
}

Response (Failed)

{
  "job_id": "job_12345",
  "status": "failed",
  "error": "Processing error message"
}

Step 5 — Display the Result

When the status is completed, render the returned image:

<img src="https://cdn.mirrago.com/results/job_12345.jpg" />
  • Poll every 1 second
  • Stop after 30 seconds
  • Handle failed responses gracefully