{
  "openapi": "3.0.3",
  "info": {
    "title": "SkinAI Partner API",
    "version": "1.0.0",
    "description": "## Overview\n\nThe SkinAI Partner API lets you **manage your Skin Analysis catalog from your own systems**:\n\n- **Sync stock and prices** from your inventory and price feeds\n- **Build the catalog** - brands, categories, products, routines and images\n- **Map products to skin problems** so recommendations match each shopper's analysis\n\nChanges are **global**: they affect all shoppers. For per-session stock or prices, use the SDK's `updateProducts` action.\n\n---\n\n## Setup\n\n1. Create an API key in Studio and link it to your Skin Analysis project. One key can cover several projects of your organization, e.g. one per store.\n2. Send it in the `X-API-Key` header\n3. Set `project_key` to your project slug or UUID\n\nCall the API only from your server. Never put the key in a website or app.\n\n## Workflow Order\n\nWhen creating data from scratch, follow this order:\n\n1. **Images** - Upload images (optional for brands, categories and products)\n2. **Brands**\n3. **Categories**\n4. **Products** - require a brand and a category; tag them with `problem_keys` from **Skin Problems**\n5. **Stock & Prices** - keep them in sync\n6. **Routines** - ordered product sets\n\nRecommendations show only **published, in-stock** products."
  },
  "servers": [
    {
      "url": "{base_url}",
      "description": "API Server",
      "variables": {
        "base_url": {
          "default": "https://api.pulpoar.com",
          "description": "Base URL for the API"
        }
      }
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "1. Images",
      "description": "Upload and manage images for brands, categories, and products"
    },
    {
      "name": "2. Brands",
      "description": "Create and manage brands"
    },
    {
      "name": "3. Categories",
      "description": "Create and manage categories"
    },
    {
      "name": "4. Products",
      "description": "Create and manage products"
    },
    {
      "name": "5. Stock & Prices",
      "description": "Sync stock status and prices"
    },
    {
      "name": "6. Routines",
      "description": "Create and manage routines"
    },
    {
      "name": "7. Skin Problems",
      "description": "Skin problems products can target"
    }
  ],
  "paths": {
    "/skinai-partner/{project_key}/images": {
      "post": {
        "operationId": "upload-images",
        "summary": "Upload Images",
        "description": "**Step 1: Upload images** - Images are optional for brands, categories, and products.\n\nDownloads images from the provided URLs, validates them, and stores them in your organization's file storage.\n\n**Validation:**\n- Allowed types: JPEG, PNG, WebP\n- Max file size: 2MB\n- Max dimensions: 4096x4096\n\n**Important:** Save the returned `file_id` values - pass them as `image_id` on brands, categories, and products.",
        "tags": [
          "1. Images"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "description": "Project slug or UUID",
            "required": true,
            "schema": {
              "type": "string",
              "example": "your-project-slug"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageUploadRequest"
              },
              "example": {
                "images": [
                  {
                    "url": "https://example.com/brand-logo.jpg",
                    "title": "Brand Logo"
                  },
                  {
                    "url": "https://example.com/product-image.png",
                    "title": "Product Image"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Images processed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageUploadResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "get": {
        "operationId": "list-images",
        "summary": "List Images",
        "description": "List uploaded images for your project.\n\nReturns only image files (JPEG, PNG, WebP) that belong to your organization.",
        "tags": [
          "1. Images"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "description": "Project slug or UUID",
            "required": true,
            "schema": {
              "type": "string",
              "example": "your-project-slug"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Results per page (default: 100, max: 1000)",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Pagination offset (default: 0)",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Images retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/skinai-partner/{project_key}/brands": {
      "get": {
        "operationId": "list-brands",
        "summary": "List Brands",
        "description": "List the project's brands.",
        "tags": [
          "2. Brands"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Results per page (1-1000)",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Results to skip",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Filter by name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "create-brands",
        "summary": "Create Brands",
        "description": "Create brands (max 100). **Upsert:** an existing slug is updated instead of duplicated. Images are optional.",
        "tags": [
          "2. Brands"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrandCreateRequest"
              },
              "example": {
                "brands": [
                  {
                    "name": "Brand",
                    "slug": "brand"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandCreateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "update-brands",
        "summary": "Update Brands",
        "description": "Update brands by id or slug (max 100).",
        "tags": [
          "2. Brands"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          },
          {
            "name": "lookup",
            "in": "query",
            "required": true,
            "description": "What `key` holds: `id` (UUID) or `slug`",
            "schema": {
              "type": "string",
              "enum": [
                "id",
                "slug"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrandUpdateRequest"
              },
              "example": {
                "updates": [
                  {
                    "key": "brand",
                    "updates": {
                      "name": "New name"
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandUpdateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/skinai-partner/{project_key}/categories": {
      "get": {
        "operationId": "list-categories",
        "summary": "List Categories",
        "description": "List the project's categories.",
        "tags": [
          "3. Categories"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Results per page (1-1000)",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Results to skip",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Filter by name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "create-categories",
        "summary": "Create Categories",
        "description": "Create categories (max 100). **Upsert:** an existing slug is updated instead of duplicated. Images are optional.",
        "tags": [
          "3. Categories"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryCreateRequest"
              },
              "example": {
                "categories": [
                  {
                    "name": "Moisturizers",
                    "slug": "moisturizers"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryCreateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "update-categories",
        "summary": "Update Categories",
        "description": "Update categories by id or slug (max 100).",
        "tags": [
          "3. Categories"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          },
          {
            "name": "lookup",
            "in": "query",
            "required": true,
            "description": "What `key` holds: `id` (UUID) or `slug`",
            "schema": {
              "type": "string",
              "enum": [
                "id",
                "slug"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryUpdateRequest"
              },
              "example": {
                "updates": [
                  {
                    "key": "moisturizers",
                    "updates": {
                      "name": "New name"
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryUpdateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/skinai-partner/{project_key}/products": {
      "get": {
        "operationId": "list-products",
        "summary": "List Products",
        "description": "List the project's products.",
        "tags": [
          "4. Products"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Results per page (1-1000)",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Results to skip",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Filter by name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "published",
                "draft",
                "archived"
              ]
            }
          },
          {
            "name": "stock_status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "in-stock",
                "out-of-stock"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "create-products",
        "summary": "Create Products",
        "description": "Create products (max 100). **Upsert:** an existing slug is updated instead of duplicated. `brand_slug` and `category_slug` must exist. Images are optional.",
        "tags": [
          "4. Products"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCreateRequest"
              },
              "example": {
                "products": [
                  {
                    "name": "Hydrator",
                    "slug": "hydrator",
                    "brand_slug": "brand",
                    "category_slug": "moisturizers",
                    "price": 19.99,
                    "stock_status": "in-stock",
                    "url": "https://example.com/hydrator",
                    "problem_keys": [
                      "eye-bag"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductCreateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "update-products",
        "summary": "Update Products",
        "description": "Update products by id or slug (max 100). Only sent fields change. Present `problem_keys` replaces the product's problems; `[]` clears them.",
        "tags": [
          "4. Products"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          },
          {
            "name": "lookup",
            "in": "query",
            "required": true,
            "description": "What `key` holds: `id` (UUID) or `slug`",
            "schema": {
              "type": "string",
              "enum": [
                "id",
                "slug"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductUpdateRequest"
              },
              "example": {
                "updates": [
                  {
                    "key": "hydrator",
                    "updates": {
                      "status": "published",
                      "problem_keys": [
                        "eye-bag",
                        "wrinkles"
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductUpdateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "delete": {
        "operationId": "delete-products",
        "summary": "Delete Products",
        "description": "Delete products by id (max 100). A product shared with other projects is only unlinked from this one (`unlinked`).",
        "tags": [
          "4. Products"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteRequest"
              },
              "example": {
                "ids": [
                  "550e8400-e29b-41d4-a716-446655440000"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductDeleteResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/skinai-partner/{project_key}/stock": {
      "patch": {
        "operationId": "update-stock",
        "summary": "Update Stock",
        "description": "Set `stock_status` for products by id or slug (max 100). Shoppers only see **published, in-stock** products in recommendations. Accepts no other fields.",
        "tags": [
          "5. Stock & Prices"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          },
          {
            "name": "lookup",
            "in": "query",
            "required": true,
            "description": "What `key` holds: `id` (UUID) or `slug`",
            "schema": {
              "type": "string",
              "enum": [
                "id",
                "slug"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StockUpdateRequest"
              },
              "example": {
                "updates": [
                  {
                    "key": "hydrator",
                    "stock_status": "out-of-stock"
                  },
                  {
                    "key": "serum",
                    "stock_status": "in-stock"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FieldUpdateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/skinai-partner/{project_key}/prices": {
      "patch": {
        "operationId": "update-prices",
        "summary": "Update Prices",
        "description": "Set `price` for products by id or slug (max 100). `null` clears the price. Accepts no other fields.",
        "tags": [
          "5. Stock & Prices"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          },
          {
            "name": "lookup",
            "in": "query",
            "required": true,
            "description": "What `key` holds: `id` (UUID) or `slug`",
            "schema": {
              "type": "string",
              "enum": [
                "id",
                "slug"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PriceUpdateRequest"
              },
              "example": {
                "updates": [
                  {
                    "key": "hydrator",
                    "price": 24.5
                  },
                  {
                    "key": "serum",
                    "price": null
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FieldUpdateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/skinai-partner/stock/stores": {
      "patch": {
        "operationId": "update-stock-stores",
        "summary": "Update Stock Across Stores",
        "description": "Update stock for every store (project) your API key covers, in one batch (max 200 rows per request).\n\n**Send only `product_slug` and `stock_status`** and the stock is updated in every project on your API key that has the product.\n\n**Optional `project_key`:** add a project slug (or id) to a row to update that store only. A UUID-shaped value is always treated as an id.\n\nEach row gets its own result, so one failing row doesn't block the others.\n\n**Rules:**\n- A `project_key` + `product_slug` pair may appear once per request.\n- Unknown fields are rejected with 400, so a misspelled `project_key` can't turn a one-store row into an all-stores row.\n- Per-store stock needs each store project to own its products. A product linked into several projects is one shared record, so it holds one stock value for all of them; giving it different statuses in one batch returns `conflict`.",
        "tags": [
          "5. Stock & Prices"
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StoreStockUpdateRequest"
              },
              "example": {
                "updates": [
                  {
                    "product_slug": "hydrator",
                    "stock_status": "out-of-stock"
                  },
                  {
                    "project_key": "your-store-project-slug",
                    "product_slug": "serum",
                    "stock_status": "in-stock"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoreStockUpdateResponse"
                },
                "example": {
                  "success": true,
                  "processed": 2,
                  "results": [
                    {
                      "project_key": null,
                      "product_slug": "hydrator",
                      "status": "updated",
                      "stock_status": "out-of-stock",
                      "updated_products": 3
                    },
                    {
                      "project_key": "your-store-project-slug",
                      "product_slug": "serum",
                      "status": "updated",
                      "stock_status": "in-stock",
                      "updated_products": 1
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/skinai-partner/{project_key}/routines": {
      "get": {
        "operationId": "list-routines",
        "summary": "List Routines",
        "description": "List the project's routines with their products.",
        "tags": [
          "6. Routines"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Results per page (1-1000)",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Results to skip",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Filter by name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutineListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "create-routines",
        "summary": "Create Routines",
        "description": "Create routines (max 100) with ordered products. Products are matched by `slug` first, then by `name`; a name matching several products returns `product_ambiguous`.",
        "tags": [
          "6. Routines"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoutineCreateRequest"
              },
              "example": {
                "routines": [
                  {
                    "name": "Morning",
                    "slug": "morning",
                    "products": [
                      {
                        "name": "Hydrator",
                        "slug": "hydrator",
                        "order": 1
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutineCreateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "patch": {
        "operationId": "update-routines",
        "summary": "Update Routines",
        "description": "Rename routines by id or slug (max 100).",
        "tags": [
          "6. Routines"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          },
          {
            "name": "lookup",
            "in": "query",
            "required": true,
            "description": "What `key` holds: `id` (UUID) or `slug`",
            "schema": {
              "type": "string",
              "enum": [
                "id",
                "slug"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoutineUpdateRequest"
              },
              "example": {
                "updates": [
                  {
                    "key": "morning",
                    "updates": {
                      "name": "Morning Routine"
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutineUpdateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "delete": {
        "operationId": "delete-routines",
        "summary": "Delete Routines",
        "description": "Delete routines by id (max 100). A routine shared with other projects is only unlinked from this one.",
        "tags": [
          "6. Routines"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteRequest"
              },
              "example": {
                "ids": [
                  "550e8400-e29b-41d4-a716-446655440000"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutineDeleteResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/skinai-partner/{project_key}/problems": {
      "get": {
        "operationId": "list-problems",
        "summary": "List Skin Problems",
        "description": "List the skin problems you can assign to products with `problem_keys`. `assigned` says whether the project uses the problem.",
        "tags": [
          "7. Skin Problems"
        ],
        "parameters": [
          {
            "name": "project_key",
            "in": "path",
            "required": true,
            "description": "Project slug or UUID",
            "schema": {
              "type": "string"
            },
            "example": "your-project-slug"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Results per page (1-1000)",
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Results to skip",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. For batches, check each item's `status`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "BadRequest": {
        "description": "Validation error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Forbidden": {
        "description": "API key not authorized for this project",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "NotFound": {
        "description": "Resource not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              false
            ],
            "example": false
          },
          "error": {
            "type": "string",
            "description": "Error message",
            "example": "Validation failed"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Detailed error reasons",
            "example": [
              "Invalid stock_status value"
            ]
          },
          "retry_after": {
            "type": "integer",
            "description": "Seconds until rate limit resets (only present on 429 responses)",
            "example": 900
          }
        },
        "required": [
          "success",
          "error"
        ]
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer",
            "description": "Total number of results",
            "example": 100
          },
          "limit": {
            "type": "integer",
            "description": "Results per page",
            "example": 100
          },
          "offset": {
            "type": "integer",
            "description": "Current offset",
            "example": 0
          },
          "has_next": {
            "type": "boolean",
            "description": "Whether more results exist",
            "example": false
          },
          "next_offset": {
            "type": "integer",
            "nullable": true,
            "description": "Offset for next page, or null if no more results"
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "has_next",
          "next_offset"
        ]
      },
      "ImageId": {
        "type": "string",
        "format": "uuid",
        "description": "File UUID from image upload",
        "example": "550e8400-e29b-41d4-a716-446655440000"
      },
      "ImageUploadRequest": {
        "type": "object",
        "properties": {
          "images": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri",
                  "description": "Public URL of the image"
                },
                "title": {
                  "type": "string",
                  "description": "Image title (defaults to filename)"
                }
              },
              "required": [
                "url"
              ]
            }
          }
        },
        "required": [
          "images"
        ]
      },
      "ImageUploadResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "uploaded",
                    "failed"
                  ]
                },
                "file_id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "Use this ID for image_id references"
                },
                "width": {
                  "type": "integer"
                },
                "height": {
                  "type": "integer"
                },
                "error": {
                  "type": "string",
                  "description": "Error message when status is failed"
                }
              },
              "required": [
                "url",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "ImageListResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "images": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "description": "File UUID (use this for image_id references)"
                },
                "title": {
                  "type": "string",
                  "nullable": true
                },
                "filename": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "description": "MIME type (image/jpeg, image/png, image/webp)"
                },
                "width": {
                  "type": "integer"
                },
                "height": {
                  "type": "integer"
                },
                "filesize": {
                  "type": "integer",
                  "description": "File size in bytes"
                },
                "date_created": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "filename",
                "type",
                "width",
                "height",
                "filesize",
                "date_created"
              ]
            }
          }
        },
        "required": [
          "success",
          "pagination",
          "images"
        ]
      },
      "BrandRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "nullable": true
          },
          "image": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "date_updated": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "BrandCreateItem": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 255,
            "description": "URL-safe identifier. Generated from `name` when omitted.",
            "example": "hydrator"
          },
          "image_id": {
            "$ref": "#/components/schemas/ImageId",
            "description": "Optional image"
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "BrandCreateRequest": {
        "type": "object",
        "properties": {
          "brands": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BrandCreateItem"
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "brands"
        ]
      },
      "BrandCreateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "slug": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "created",
                    "exists",
                    "updated",
                    "image_not_found",
                    "image_access_denied",
                    "image_invalid_type",
                    "error"
                  ]
                },
                "message": {
                  "type": "string",
                  "description": "Present when the item failed"
                },
                "brand": {
                  "$ref": "#/components/schemas/BrandRecord",
                  "description": "Present for: created, exists, updated"
                }
              },
              "required": [
                "slug",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "BrandUpdateFields": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 255,
            "description": "URL-safe identifier. Generated from `name` when omitted.",
            "example": "hydrator"
          },
          "image_id": {
            "$ref": "#/components/schemas/ImageId"
          }
        },
        "additionalProperties": false
      },
      "BrandUpdateRequest": {
        "type": "object",
        "properties": {
          "updates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "maxLength": 255,
                  "description": "Id or slug, as set by `lookup`"
                },
                "updates": {
                  "$ref": "#/components/schemas/BrandUpdateFields",
                  "minProperties": 1
                }
              },
              "required": [
                "key",
                "updates"
              ]
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "updates"
        ]
      },
      "BrandUpdateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "processed": {
            "type": "integer",
            "description": "Items that succeeded"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "updated",
                    "not_found",
                    "slug_duplicate",
                    "image_not_found",
                    "image_access_denied",
                    "image_invalid_type",
                    "error"
                  ]
                },
                "message": {
                  "type": "string",
                  "description": "Present when the item failed"
                },
                "brand": {
                  "$ref": "#/components/schemas/BrandRecord",
                  "description": "Present for: updated"
                }
              },
              "required": [
                "key",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "BrandListResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "brands": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BrandRecord"
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "brands"
        ]
      },
      "CategoryRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "nullable": true
          },
          "image": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "date_updated": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "CategoryCreateItem": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 255,
            "description": "URL-safe identifier. Generated from `name` when omitted.",
            "example": "hydrator"
          },
          "image_id": {
            "$ref": "#/components/schemas/ImageId",
            "description": "Optional image"
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "CategoryCreateRequest": {
        "type": "object",
        "properties": {
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryCreateItem"
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "categories"
        ]
      },
      "CategoryCreateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "slug": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "created",
                    "exists",
                    "updated",
                    "image_not_found",
                    "image_access_denied",
                    "image_invalid_type",
                    "error"
                  ]
                },
                "message": {
                  "type": "string",
                  "description": "Present when the item failed"
                },
                "category": {
                  "$ref": "#/components/schemas/CategoryRecord",
                  "description": "Present for: created, exists, updated"
                }
              },
              "required": [
                "slug",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "CategoryUpdateFields": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 255,
            "description": "URL-safe identifier. Generated from `name` when omitted.",
            "example": "hydrator"
          },
          "image_id": {
            "$ref": "#/components/schemas/ImageId"
          }
        },
        "additionalProperties": false
      },
      "CategoryUpdateRequest": {
        "type": "object",
        "properties": {
          "updates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "maxLength": 255,
                  "description": "Id or slug, as set by `lookup`"
                },
                "updates": {
                  "$ref": "#/components/schemas/CategoryUpdateFields",
                  "minProperties": 1
                }
              },
              "required": [
                "key",
                "updates"
              ]
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "updates"
        ]
      },
      "CategoryUpdateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "processed": {
            "type": "integer",
            "description": "Items that succeeded"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "updated",
                    "not_found",
                    "slug_duplicate",
                    "image_not_found",
                    "image_access_denied",
                    "image_invalid_type",
                    "error"
                  ]
                },
                "message": {
                  "type": "string",
                  "description": "Present when the item failed"
                },
                "category": {
                  "$ref": "#/components/schemas/CategoryRecord",
                  "description": "Present for: updated"
                }
              },
              "required": [
                "key",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "CategoryListResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryRecord"
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "categories"
        ]
      },
      "ProductRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "nullable": true
          },
          "image": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "published",
              "draft",
              "archived"
            ]
          },
          "date_updated": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "price": {
            "type": "number",
            "nullable": true
          },
          "stock_status": {
            "type": "string",
            "enum": [
              "in-stock",
              "out-of-stock"
            ]
          },
          "url": {
            "type": "string",
            "nullable": true
          },
          "barcode": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "is_favorite": {
            "type": "boolean"
          },
          "brand_slug": {
            "type": "string",
            "nullable": true
          },
          "brand_name": {
            "type": "string",
            "nullable": true
          },
          "category_slug": {
            "type": "string",
            "nullable": true
          },
          "category_name": {
            "type": "string",
            "nullable": true
          },
          "problem_keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ProductCreateItem": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 255,
            "description": "URL-safe identifier. Generated from `name` when omitted.",
            "example": "hydrator"
          },
          "brand_slug": {
            "type": "string",
            "description": "Slug of an existing brand"
          },
          "category_slug": {
            "type": "string",
            "description": "Slug of an existing category"
          },
          "status": {
            "type": "string",
            "enum": [
              "published",
              "draft",
              "archived"
            ],
            "default": "published"
          },
          "image_id": {
            "$ref": "#/components/schemas/ImageId",
            "description": "Optional image"
          },
          "barcode": {
            "type": "string",
            "maxLength": 255
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "description": "Catalog price in your currency. Cents are exact below 131,072.",
            "example": 24.5
          },
          "stock_status": {
            "type": "string",
            "enum": [
              "in-stock",
              "out-of-stock"
            ],
            "default": "in-stock"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "is_favorite": {
            "type": "boolean"
          },
          "description": {
            "type": "string",
            "maxLength": 10000,
            "nullable": true
          },
          "problem_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Skin problem keys from `GET /problems`, e.g. `eye-bag`. Replaces the product's problems; `[]` clears them; omit to keep them.",
            "example": [
              "eye-bag",
              "wrinkles"
            ]
          }
        },
        "required": [
          "name",
          "brand_slug",
          "category_slug"
        ],
        "additionalProperties": false
      },
      "ProductCreateRequest": {
        "type": "object",
        "properties": {
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductCreateItem"
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "products"
        ]
      },
      "ProductCreateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "slug": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "created",
                    "exists",
                    "updated",
                    "linked",
                    "link_failed",
                    "brand_not_found",
                    "category_not_found",
                    "image_not_found",
                    "image_access_denied",
                    "image_invalid_type",
                    "error"
                  ]
                },
                "message": {
                  "type": "string",
                  "description": "Present when the item failed"
                },
                "product": {
                  "$ref": "#/components/schemas/ProductRecord",
                  "description": "Present for: created, exists, updated, linked, link_failed"
                }
              },
              "required": [
                "slug",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "ProductUpdateFields": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 255,
            "description": "URL-safe identifier. Generated from `name` when omitted.",
            "example": "hydrator"
          },
          "brand_slug": {
            "type": "string"
          },
          "category_slug": {
            "type": "string",
            "description": "Reassigns the category; can't be null"
          },
          "status": {
            "type": "string",
            "enum": [
              "published",
              "draft",
              "archived"
            ]
          },
          "image_id": {
            "$ref": "#/components/schemas/ImageId"
          },
          "barcode": {
            "type": "string",
            "maxLength": 255,
            "nullable": true
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "description": "`null` clears the price",
            "example": 24.5,
            "nullable": true
          },
          "stock_status": {
            "type": "string",
            "enum": [
              "in-stock",
              "out-of-stock"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "nullable": true
          },
          "is_favorite": {
            "type": "boolean"
          },
          "description": {
            "type": "string",
            "maxLength": 10000,
            "nullable": true
          },
          "problem_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Skin problem keys from `GET /problems`, e.g. `eye-bag`. Replaces the product's problems; `[]` clears them; omit to keep them.",
            "example": [
              "eye-bag",
              "wrinkles"
            ]
          }
        },
        "additionalProperties": false
      },
      "ProductUpdateRequest": {
        "type": "object",
        "properties": {
          "updates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "maxLength": 255,
                  "description": "Id or slug, as set by `lookup`"
                },
                "updates": {
                  "$ref": "#/components/schemas/ProductUpdateFields",
                  "minProperties": 1
                }
              },
              "required": [
                "key",
                "updates"
              ]
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "updates"
        ]
      },
      "ProductUpdateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "processed": {
            "type": "integer",
            "description": "Items that succeeded"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "updated",
                    "not_found",
                    "slug_duplicate",
                    "brand_not_found",
                    "category_not_found",
                    "image_not_found",
                    "image_access_denied",
                    "image_invalid_type",
                    "error"
                  ]
                },
                "message": {
                  "type": "string",
                  "description": "Present when the item failed"
                },
                "product": {
                  "$ref": "#/components/schemas/ProductRecord",
                  "description": "Present for: updated"
                }
              },
              "required": [
                "key",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "ProductListResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductRecord"
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "products"
        ]
      },
      "DeleteRequest": {
        "type": "object",
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "ids"
        ]
      },
      "ProductDeleteResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "processed": {
            "type": "integer",
            "description": "Items that succeeded"
          },
          "deleted": {
            "type": "integer"
          },
          "unlinked": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "deleted",
                    "unlinked",
                    "not_found",
                    "in_use",
                    "error"
                  ]
                },
                "remaining_project_count": {
                  "type": "integer",
                  "description": "For `unlinked`: other projects that still hold the item"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "StockUpdateRequest": {
        "type": "object",
        "properties": {
          "updates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "maxLength": 255,
                  "description": "Id or slug, as set by `lookup`"
                },
                "stock_status": {
                  "type": "string",
                  "enum": [
                    "in-stock",
                    "out-of-stock"
                  ]
                }
              },
              "required": [
                "key",
                "stock_status"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "updates"
        ]
      },
      "PriceUpdateRequest": {
        "type": "object",
        "properties": {
          "updates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "maxLength": 255,
                  "description": "Id or slug, as set by `lookup`"
                },
                "price": {
                  "type": "number",
                  "minimum": 0,
                  "description": "`null` clears the price",
                  "example": 24.5,
                  "nullable": true
                }
              },
              "required": [
                "key",
                "price"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "updates"
        ]
      },
      "FieldUpdateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "processed": {
            "type": "integer",
            "description": "Items that succeeded"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "updated",
                    "not_found",
                    "error"
                  ]
                },
                "message": {
                  "type": "string",
                  "description": "Present when the item failed"
                },
                "product": {
                  "$ref": "#/components/schemas/ProductRecord",
                  "description": "Present for: updated"
                }
              },
              "required": [
                "key",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "StoreStockUpdateRequest": {
        "type": "object",
        "properties": {
          "updates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "project_key": {
                  "type": "string",
                  "maxLength": 255,
                  "description": "Project slug or id of one store. Omit to update every project on your API key."
                },
                "product_slug": {
                  "type": "string",
                  "maxLength": 255
                },
                "stock_status": {
                  "type": "string",
                  "enum": [
                    "in-stock",
                    "out-of-stock"
                  ]
                }
              },
              "required": [
                "product_slug",
                "stock_status"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 200
          }
        },
        "required": [
          "updates"
        ]
      },
      "StoreStockUpdateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "processed": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "project_key": {
                  "type": "string",
                  "nullable": true
                },
                "product_slug": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "updated",
                    "project_not_found",
                    "not_found",
                    "conflict",
                    "error"
                  ]
                },
                "stock_status": {
                  "type": "string",
                  "enum": [
                    "in-stock",
                    "out-of-stock"
                  ],
                  "description": "Present for `updated`"
                },
                "updated_products": {
                  "type": "integer",
                  "description": "Products changed by the row (one per store, unless shared)"
                },
                "message": {
                  "type": "string",
                  "description": "Present when the row failed"
                }
              },
              "required": [
                "project_key",
                "product_slug",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "processed",
          "results"
        ]
      },
      "RoutineProductRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "nullable": true
          },
          "sort": {
            "type": "integer"
          }
        }
      },
      "RoutineRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "nullable": true
          },
          "date_updated": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutineProductRecord"
            }
          }
        }
      },
      "RoutineCreateItem": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 255,
            "description": "URL-safe identifier. Generated from `name` when omitted.",
            "example": "hydrator"
          },
          "products": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "maxLength": 255,
                  "description": "Matched case-insensitively when `slug` is omitted"
                },
                "slug": {
                  "type": "string",
                  "description": "Preferred: matched first"
                },
                "order": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "required": [
                "name",
                "order"
              ]
            },
            "maxItems": 200
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      },
      "RoutineCreateRequest": {
        "type": "object",
        "properties": {
          "routines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutineCreateItem"
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "routines"
        ]
      },
      "RoutineCreateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "slug": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "created",
                    "exists",
                    "product_not_found",
                    "product_ambiguous",
                    "error"
                  ]
                },
                "message": {
                  "type": "string",
                  "description": "Present when the item failed"
                },
                "routine": {
                  "$ref": "#/components/schemas/RoutineRecord",
                  "description": "Present for: created, exists"
                }
              },
              "required": [
                "slug",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "RoutineUpdateFields": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 255,
            "description": "URL-safe identifier. Generated from `name` when omitted.",
            "example": "hydrator"
          }
        },
        "additionalProperties": false
      },
      "RoutineUpdateRequest": {
        "type": "object",
        "properties": {
          "updates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "maxLength": 255,
                  "description": "Id or slug, as set by `lookup`"
                },
                "updates": {
                  "$ref": "#/components/schemas/RoutineUpdateFields",
                  "minProperties": 1
                }
              },
              "required": [
                "key",
                "updates"
              ]
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "updates"
        ]
      },
      "RoutineUpdateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "processed": {
            "type": "integer",
            "description": "Items that succeeded"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "updated",
                    "not_found",
                    "slug_duplicate",
                    "error"
                  ]
                },
                "message": {
                  "type": "string",
                  "description": "Present when the item failed"
                },
                "routine": {
                  "$ref": "#/components/schemas/RoutineRecord",
                  "description": "Present for: updated"
                }
              },
              "required": [
                "key",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "RoutineListResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "routines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RoutineRecord"
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "routines"
        ]
      },
      "RoutineDeleteResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "processed": {
            "type": "integer",
            "description": "Items that succeeded"
          },
          "deleted": {
            "type": "integer"
          },
          "unlinked": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "deleted",
                    "unlinked",
                    "not_found",
                    "in_use",
                    "error"
                  ]
                },
                "remaining_project_count": {
                  "type": "integer",
                  "description": "For `unlinked`: other projects that still hold the item"
                },
                "message": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "status"
              ]
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "results"
        ]
      },
      "ProblemRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string",
            "description": "Use in `problem_keys`",
            "example": "eye-bag"
          },
          "analysis_key": {
            "type": "string",
            "example": "eyeBag"
          },
          "default_name": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "Display name: the project's override, else the default"
          },
          "display_name": {
            "type": "string",
            "nullable": true
          },
          "assigned": {
            "type": "boolean",
            "description": "Assigned to this project"
          }
        }
      },
      "ProblemListResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "project_id": {
            "type": "string",
            "format": "uuid"
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "problems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProblemRecord"
            }
          }
        },
        "required": [
          "success",
          "project_id",
          "problems"
        ]
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "All API requests require authentication via the X-API-Key header. Set the `api_key` variable in your environment."
      }
    }
  }
}
