This document outlines the REST APIs available for integrating the Closet Agent with external applications, such as your Chrome Extension.
The base URL for all API endpoints is your deployed application's URL. Example: `https://your-app-url.run.app\`
Evaluates a potential clothing purchase against the user's current wardrobe to provide a buy/skip recommendation.
Endpoint: `/api/evaluate`
Method: `POST`
Content-Type: `application/json`
```json { "purchaseImageUrl": "data:image/jpeg;base64,...", // Required: Base64 encoded image of the item to buy "wardrobe": [ // Required: Array of the user's current wardrobe items { "category": "Top", "color": "White", "style": "Casual", "description": "White cotton t-shirt" } ] } ```
Returns a structured evaluation from the AI stylist.
```json { "decision": "BUY", // Enum: "BUY" | "MAYBE" | "SKIP" "reasoning": "This item perfectly complements your existing casual wardrobe...", "pros": [ "Matches white t-shirt", "Good for summer" ], "cons": [ "Might be hard to clean" ], "itemDescription": "A detailed visual description of the evaluated item..." } ```
Generates a realistic virtual try-on image by replacing the clothing in the user's photo with the described clothing item.
Endpoint: `/api/try-on`
Method: `POST`
Content-Type: `application/json`
```json { "userPhotoDataUrl": "data:image/jpeg;base64,...", // Required: Base64 encoded photo of the user "clothingDescription": "- [TOP] Red Casual: Red cotton t-shirt", // Required: Formatted description of the clothes to try on "measurements": { // Required: User's body measurements for realistic fitting "height": "170cm", "weight": "65kg", "bodyType": "Athletic" } } ```
Returns the generated image as a base64 data URL.
```json { "imageUrl": "data:image/jpeg;base64,..." // Base64 encoded generated image } ```
Retrieves the user's saved profile, including their photo and body measurements. This is useful for the extension to automatically populate the measurements and userPhotoDataUrl fields when calling the Try-On API.
Endpoint: /api/profile
Method: GET
Returns the user's profile data. If no profile has been set up yet, it returns an empty object.
{
"photoUrl": "data:image/jpeg;base64,...",
"measurements": {
"height": "170cm",
"weight": "65kg",
"bodyType": "Athletic"
}
}- CORS: Cross-Origin Resource Sharing (CORS) is enabled on these endpoints, allowing your Chrome Extension to call them directly from any e-commerce website.
- Payload Size: The payload limit is set to
50mbto accommodate high-resolution base64 encoded images. - Authentication: Currently, these endpoints are open for your extension's use. If you plan to release the extension publicly, consider adding an API key or token authentication layer in the future.