{
  "openapi": "3.0.3",
  "info": {
    "title": "Biky Catalog API",
    "version": "1.0.0",
    "description": "Your app's product catalog: products, their variants and categories, which Biky uses to answer, recommend and quote, plus public read-only routes to build a storefront. Most responses use the envelope `{ status, message, data, statusCode }` and answer HTTP 200 (201 for POST) even when the operation fails, so always check `status`."
  },
  "servers": [
    {
      "url": "https://catalog.keybeapi.com",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Products",
      "description": "Create, list, search and maintain the products of your catalog."
    },
    {
      "name": "Variants",
      "description": "Variants of a product (size, color, version...) with their own price and stock."
    },
    {
      "name": "Categories",
      "description": "Categories and subcategories used to organize the catalog."
    },
    {
      "name": "Storefront",
      "description": "Public read-only routes (no credential) to show the catalog in your own site."
    }
  ],
  "paths": {
    "/v2/items/{appUUID}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "get": {
        "tags": [
          "Products"
        ],
        "operationId": "listProducts",
        "summary": "List products",
        "description": "Returns a page of the app's products, newest first. Only `active` products unless you pass `status`. Pagination is page-based and **0-based** (`page=0` is the first page); keep paging until a page returns fewer than `limit` rows.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "name",
            "in": "query",
            "required": false,
            "description": "Text contained in the product name (case- and accent-insensitive).",
            "schema": {
              "type": "string"
            },
            "example": "aero"
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Exact category name; returns products whose `categories` contains it.",
            "schema": {
              "type": "string"
            },
            "example": "ZAPATOS"
          },
          {
            "name": "sku",
            "in": "query",
            "required": false,
            "description": "SKU prefix (case-insensitive).",
            "schema": {
              "type": "string"
            },
            "example": "SHOE-AERO"
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "description": "Size prefix (case-insensitive).",
            "schema": {
              "type": "string"
            },
            "example": "39"
          },
          {
            "name": "color",
            "in": "query",
            "required": false,
            "description": "Color prefix (case-insensitive).",
            "schema": {
              "type": "string"
            },
            "example": "negro"
          },
          {
            "name": "year",
            "in": "query",
            "required": false,
            "description": "Four-digit year.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{4}$"
            },
            "example": "2026"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Status to list: `active` (default), `inactive` (archived) or `deleted`.",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "inactive",
                "deleted"
              ],
              "default": "active"
            },
            "example": "active"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of products.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/ProductPage"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Items fetched successfully",
                  "data": {
                    "rows": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab34cd",
                        "appUUID": "app_7f3k2m9x1q",
                        "name": "Aero Running Shoe",
                        "sku": "SHOE-AERO-001",
                        "alias": [
                          "Aero runner"
                        ],
                        "categories": [
                          "ZAPATOS"
                        ],
                        "subCategories": [
                          "RUNNING"
                        ],
                        "type": "product",
                        "defaultPrice": 249900,
                        "defaultCurrency": "COP",
                        "isPriceStartingFrom": true,
                        "description": "Lightweight running shoe with a breathable mesh upper.",
                        "externalId": "erp-10045",
                        "externalUrl": "https://shop.example.com/products/aero",
                        "images": [
                          {
                            "_id": "665f1c2e8a4b3d0012ab36b1",
                            "url": "https://cdn.example.com/catalog/aero-front.jpg",
                            "description": "Front view",
                            "isMain": true
                          }
                        ],
                        "videos": [],
                        "pdfs": [],
                        "hasStock": true,
                        "stock": 42,
                        "option1": "Talla",
                        "option1Values": [
                          "38",
                          "39",
                          "40"
                        ],
                        "option2": "Color",
                        "option2Values": [
                          "Negro",
                          "Blanco"
                        ],
                        "published": true,
                        "status": "active",
                        "priority": 0,
                        "extendedData": [
                          {
                            "field": "material",
                            "value": "mesh"
                          }
                        ],
                        "offers": [
                          {
                            "type": "standard",
                            "currency": "COP",
                            "priceBase": 249900,
                            "discounts": [
                              {
                                "sellingPrice": 219900,
                                "startDate": "2026-11-01T00:00:00.000Z",
                                "endDate": "2026-11-30T23:59:59.000Z",
                                "justification": "Black Friday"
                              }
                            ]
                          }
                        ],
                        "createdAt": "2026-10-01T15:04:05.000Z",
                        "updatedAt": "2026-11-06T15:04:05.000Z"
                      }
                    ],
                    "pagination": {
                      "page": 0,
                      "totalDocs": 1,
                      "totalPages": 0
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Products"
        ],
        "operationId": "createProduct",
        "summary": "Create a product",
        "description": "Creates a product. `sku` is mandatory and must not exist among the app's active products (otherwise `status: ERROR`, `Item with sku … already exists`). Image URLs can also be plain strings. After saving, images are processed asynchronously and Biky's search index is refreshed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ProductInput"
                  },
                  {
                    "type": "object",
                    "required": [
                      "name",
                      "sku"
                    ]
                  }
                ]
              },
              "example": {
                "name": "Aero Running Shoe",
                "sku": "SHOE-AERO-001",
                "categories": [
                  "ZAPATOS"
                ],
                "type": "product",
                "defaultPrice": 249900,
                "defaultCurrency": "COP",
                "isPriceStartingFrom": true,
                "description": "Lightweight running shoe with a breathable mesh upper.",
                "externalId": "erp-10045",
                "externalUrl": "https://shop.example.com/products/aero",
                "images": [
                  {
                    "url": "https://cdn.example.com/catalog/aero-front.jpg",
                    "description": "Front view",
                    "isMain": true
                  }
                ],
                "hasStock": true,
                "stock": 42,
                "option1": "Talla",
                "option1Values": [
                  "38",
                  "39",
                  "40"
                ],
                "published": true,
                "extendedData": [
                  {
                    "field": "material",
                    "value": "mesh"
                  }
                ],
                "offers": [
                  {
                    "type": "standard",
                    "currency": "COP",
                    "priceBase": 249900,
                    "discounts": [
                      {
                        "sellingPrice": 219900,
                        "startDate": "2026-11-01T00:00:00.000Z",
                        "endDate": "2026-11-30T23:59:59.000Z",
                        "justification": "Black Friday"
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Product created (or `status: ERROR` with the reason).",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Product"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "_id": "665f1c2e8a4b3d0012ab34cd",
                    "appUUID": "app_7f3k2m9x1q",
                    "name": "Aero Running Shoe",
                    "sku": "SHOE-AERO-001",
                    "alias": [
                      "Aero runner"
                    ],
                    "categories": [
                      "ZAPATOS"
                    ],
                    "subCategories": [
                      "RUNNING"
                    ],
                    "type": "product",
                    "defaultPrice": 249900,
                    "defaultCurrency": "COP",
                    "isPriceStartingFrom": true,
                    "description": "Lightweight running shoe with a breathable mesh upper.",
                    "externalId": "erp-10045",
                    "externalUrl": "https://shop.example.com/products/aero",
                    "images": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab36b1",
                        "url": "https://cdn.example.com/catalog/aero-front.jpg",
                        "description": "Front view",
                        "isMain": true
                      }
                    ],
                    "videos": [],
                    "pdfs": [],
                    "hasStock": true,
                    "stock": 42,
                    "option1": "Talla",
                    "option1Values": [
                      "38",
                      "39",
                      "40"
                    ],
                    "option2": "Color",
                    "option2Values": [
                      "Negro",
                      "Blanco"
                    ],
                    "published": true,
                    "status": "active",
                    "priority": 0,
                    "extendedData": [
                      {
                        "field": "material",
                        "value": "mesh"
                      }
                    ],
                    "offers": [
                      {
                        "type": "standard",
                        "currency": "COP",
                        "priceBase": 249900,
                        "discounts": [
                          {
                            "sellingPrice": 219900,
                            "startDate": "2026-11-01T00:00:00.000Z",
                            "endDate": "2026-11-30T23:59:59.000Z",
                            "justification": "Black Friday"
                          }
                        ]
                      }
                    ],
                    "createdAt": "2026-10-01T15:04:05.000Z",
                    "updatedAt": "2026-11-06T15:04:05.000Z"
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v2/items/{appUUID}/filters": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "post": {
        "tags": [
          "Products"
        ],
        "operationId": "filterProducts",
        "summary": "List products with advanced filters",
        "description": "Same as `GET /v2/items/{appUUID}` but with the filters in the body, plus sorting (`sortByFields`/`sortByOrder`) and arbitrary field conditions (`compareFields`). Read-only, answers HTTP 201.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductFilterBody"
              },
              "example": {
                "page": "0",
                "limit": "20",
                "status": "active",
                "sortByFields": [
                  "defaultPrice"
                ],
                "sortByOrder": [
                  1
                ],
                "compareFields": {
                  "and": [
                    {
                      "defaultPrice": {
                        "$gte": 100000,
                        "$lte": 300000
                      }
                    }
                  ],
                  "or": []
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "A page of products.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/ProductPage"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Items fetched successfully",
                  "data": {
                    "rows": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab34cd",
                        "appUUID": "app_7f3k2m9x1q",
                        "name": "Aero Running Shoe",
                        "sku": "SHOE-AERO-001",
                        "alias": [
                          "Aero runner"
                        ],
                        "categories": [
                          "ZAPATOS"
                        ],
                        "subCategories": [
                          "RUNNING"
                        ],
                        "type": "product",
                        "defaultPrice": 249900,
                        "defaultCurrency": "COP",
                        "isPriceStartingFrom": true,
                        "description": "Lightweight running shoe with a breathable mesh upper.",
                        "externalId": "erp-10045",
                        "externalUrl": "https://shop.example.com/products/aero",
                        "images": [
                          {
                            "_id": "665f1c2e8a4b3d0012ab36b1",
                            "url": "https://cdn.example.com/catalog/aero-front.jpg",
                            "description": "Front view",
                            "isMain": true
                          }
                        ],
                        "videos": [],
                        "pdfs": [],
                        "hasStock": true,
                        "stock": 42,
                        "option1": "Talla",
                        "option1Values": [
                          "38",
                          "39",
                          "40"
                        ],
                        "option2": "Color",
                        "option2Values": [
                          "Negro",
                          "Blanco"
                        ],
                        "published": true,
                        "status": "active",
                        "priority": 0,
                        "extendedData": [
                          {
                            "field": "material",
                            "value": "mesh"
                          }
                        ],
                        "offers": [
                          {
                            "type": "standard",
                            "currency": "COP",
                            "priceBase": 249900,
                            "discounts": [
                              {
                                "sellingPrice": 219900,
                                "startDate": "2026-11-01T00:00:00.000Z",
                                "endDate": "2026-11-30T23:59:59.000Z",
                                "justification": "Black Friday"
                              }
                            ]
                          }
                        ],
                        "createdAt": "2026-10-01T15:04:05.000Z",
                        "updatedAt": "2026-11-06T15:04:05.000Z"
                      }
                    ],
                    "pagination": {
                      "page": 0,
                      "totalDocs": 1,
                      "totalPages": 0
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v2/items/{appUUID}/search-by-name": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "get": {
        "tags": [
          "Products"
        ],
        "operationId": "searchProductsByName",
        "summary": "Search products by name",
        "description": "Tolerant name search: the text is split into tokens and matched against name, `alias` and SKU, so `Aero shoe 39` still finds `Aero Running Shoe`. Tokens with digits (model codes) weigh more. Results below `minScore`, or far below the best match (`relativeCutoff`), are dropped. By default only active products with stock. No vector search.",
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": false,
            "description": "Text to search. Required (or `search`).",
            "schema": {
              "type": "string"
            },
            "example": "aero running"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Alias of `name`.",
            "schema": {
              "type": "string"
            },
            "example": "aero running"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum results. Default `10`, max `50`.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 10
            },
            "example": 10
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Results to skip. Default `0`.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "example": 0
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Single category name (uppercased before matching).",
            "schema": {
              "type": "string"
            },
            "example": "ZAPATOS"
          },
          {
            "name": "categories",
            "in": "query",
            "required": false,
            "description": "Comma-separated category names; the product must have all of them.",
            "schema": {
              "type": "string"
            },
            "example": "ZAPATOS,RUNNING"
          },
          {
            "name": "collectionId",
            "in": "query",
            "required": false,
            "description": "External collection id (synced catalogs).",
            "schema": {
              "type": "string"
            },
            "example": "gid-collection-1001"
          },
          {
            "name": "minScore",
            "in": "query",
            "required": false,
            "description": "Minimum match score, 0 to 1. Default `0.5`.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 1,
              "default": 0.5
            },
            "example": 0.5
          },
          {
            "name": "relativeCutoff",
            "in": "query",
            "required": false,
            "description": "Drop results scoring below `bestScore × relativeCutoff`. Default `0.8`; `0` disables it.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 1,
              "default": 0.8
            },
            "example": 0.8
          },
          {
            "name": "hasStock",
            "in": "query",
            "required": false,
            "description": "Only products with stock. Default `true`; send `false` to include sold-out products.",
            "schema": {
              "type": "boolean",
              "default": true
            },
            "example": true
          },
          {
            "name": "includeInactive",
            "in": "query",
            "required": false,
            "description": "Include inactive (archived) products. Default `false`.",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "example": false
          },
          {
            "name": "candidatesLimit",
            "in": "query",
            "required": false,
            "description": "Products read before ranking. Default `500`, max `2000`.",
            "schema": {
              "type": "integer",
              "minimum": 50,
              "maximum": 2000,
              "default": 500
            },
            "example": 500
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked products. Each one adds `searchScore`, `matchedTokens` and `missingTokens`.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "data": {
                              "type": "array",
                              "items": {
                                "allOf": [
                                  {
                                    "$ref": "#/components/schemas/Product"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "searchScore": {
                                        "type": "number",
                                        "description": "Match score, 0 to 1."
                                      },
                                      "matchedTokens": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        },
                                        "description": "Tokens found."
                                      },
                                      "missingTokens": {
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        },
                                        "description": "Tokens not found."
                                      }
                                    }
                                  }
                                ]
                              },
                              "description": "Products, best match first."
                            },
                            "metadata": {
                              "allOf": [
                                {
                                  "$ref": "#/components/schemas/OffsetMetadata"
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "matchType": {
                                      "type": "string",
                                      "enum": [
                                        "name",
                                        "none"
                                      ],
                                      "description": "`none` when no product passed the threshold."
                                    },
                                    "tokens": {
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      },
                                      "description": "Tokens searched."
                                    },
                                    "candidates": {
                                      "type": "integer",
                                      "description": "Products evaluated."
                                    },
                                    "minScore": {
                                      "type": "number",
                                      "description": "Threshold applied."
                                    }
                                  }
                                }
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "data": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab34cd",
                        "appUUID": "app_7f3k2m9x1q",
                        "name": "Aero Running Shoe",
                        "sku": "SHOE-AERO-001",
                        "alias": [
                          "Aero runner"
                        ],
                        "categories": [
                          "ZAPATOS"
                        ],
                        "subCategories": [
                          "RUNNING"
                        ],
                        "type": "product",
                        "defaultPrice": 249900,
                        "defaultCurrency": "COP",
                        "isPriceStartingFrom": true,
                        "description": "Lightweight running shoe with a breathable mesh upper.",
                        "externalId": "erp-10045",
                        "externalUrl": "https://shop.example.com/products/aero",
                        "images": [
                          {
                            "_id": "665f1c2e8a4b3d0012ab36b1",
                            "url": "https://cdn.example.com/catalog/aero-front.jpg",
                            "description": "Front view",
                            "isMain": true
                          }
                        ],
                        "videos": [],
                        "pdfs": [],
                        "hasStock": true,
                        "stock": 42,
                        "option1": "Talla",
                        "option1Values": [
                          "38",
                          "39",
                          "40"
                        ],
                        "option2": "Color",
                        "option2Values": [
                          "Negro",
                          "Blanco"
                        ],
                        "published": true,
                        "status": "active",
                        "priority": 0,
                        "extendedData": [
                          {
                            "field": "material",
                            "value": "mesh"
                          }
                        ],
                        "offers": [
                          {
                            "type": "standard",
                            "currency": "COP",
                            "priceBase": 249900,
                            "discounts": [
                              {
                                "sellingPrice": 219900,
                                "startDate": "2026-11-01T00:00:00.000Z",
                                "endDate": "2026-11-30T23:59:59.000Z",
                                "justification": "Black Friday"
                              }
                            ]
                          }
                        ],
                        "createdAt": "2026-10-01T15:04:05.000Z",
                        "updatedAt": "2026-11-06T15:04:05.000Z",
                        "searchScore": 1,
                        "matchedTokens": [
                          "aero",
                          "running"
                        ],
                        "missingTokens": []
                      }
                    ],
                    "metadata": {
                      "totalDocs": 1,
                      "limit": 10,
                      "offset": 0,
                      "hasNextPage": false,
                      "matchType": "name",
                      "tokens": [
                        "aero",
                        "running"
                      ],
                      "candidates": 3,
                      "minScore": 0.5
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v2/items/{appUUID}/{itemId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        },
        {
          "$ref": "#/components/parameters/ItemId"
        }
      ],
      "get": {
        "tags": [
          "Products"
        ],
        "operationId": "getProduct",
        "summary": "Get a product",
        "description": "Returns one product of the app, whatever its status. Variants are not included: use `GET /v2/item/variants/{appUUID}/{id}` with the product id as `id`. If it does not exist the body has `status: ERROR` and `message: Item not found` (HTTP 200). The response may include internal fields (e.g. `embedding`) that are not part of the contract.",
        "responses": {
          "200": {
            "description": "The product.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Product"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Item fetched successfully",
                  "data": {
                    "_id": "665f1c2e8a4b3d0012ab34cd",
                    "appUUID": "app_7f3k2m9x1q",
                    "name": "Aero Running Shoe",
                    "sku": "SHOE-AERO-001",
                    "alias": [
                      "Aero runner"
                    ],
                    "categories": [
                      "ZAPATOS"
                    ],
                    "subCategories": [
                      "RUNNING"
                    ],
                    "type": "product",
                    "defaultPrice": 249900,
                    "defaultCurrency": "COP",
                    "isPriceStartingFrom": true,
                    "description": "Lightweight running shoe with a breathable mesh upper.",
                    "externalId": "erp-10045",
                    "externalUrl": "https://shop.example.com/products/aero",
                    "images": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab36b1",
                        "url": "https://cdn.example.com/catalog/aero-front.jpg",
                        "description": "Front view",
                        "isMain": true
                      }
                    ],
                    "videos": [],
                    "pdfs": [],
                    "hasStock": true,
                    "stock": 42,
                    "option1": "Talla",
                    "option1Values": [
                      "38",
                      "39",
                      "40"
                    ],
                    "option2": "Color",
                    "option2Values": [
                      "Negro",
                      "Blanco"
                    ],
                    "published": true,
                    "status": "active",
                    "priority": 0,
                    "extendedData": [
                      {
                        "field": "material",
                        "value": "mesh"
                      }
                    ],
                    "offers": [
                      {
                        "type": "standard",
                        "currency": "COP",
                        "priceBase": 249900,
                        "discounts": [
                          {
                            "sellingPrice": 219900,
                            "startDate": "2026-11-01T00:00:00.000Z",
                            "endDate": "2026-11-30T23:59:59.000Z",
                            "justification": "Black Friday"
                          }
                        ]
                      }
                    ],
                    "createdAt": "2026-10-01T15:04:05.000Z",
                    "updatedAt": "2026-11-06T15:04:05.000Z"
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "put": {
        "tags": [
          "Products"
        ],
        "operationId": "updateProduct",
        "summary": "Update a product",
        "description": "Partial update: only the fields you send are changed, and the change history is recorded in `updatedBy`. Sending `status` applies it to all the product's variants too; `isPriceStartingFrom: true` recalculates `defaultPrice` from the cheapest variant. Validation errors come back with HTTP 200 and `statusCode: 400` in the body.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductInput"
              },
              "example": {
                "defaultPrice": 229900,
                "stock": 30,
                "status": "active"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated product (or `status: ERROR` with `statusCode` 400/500).",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Product"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Item updated successfully",
                  "data": {
                    "_id": "665f1c2e8a4b3d0012ab34cd",
                    "appUUID": "app_7f3k2m9x1q",
                    "name": "Aero Running Shoe",
                    "sku": "SHOE-AERO-001",
                    "alias": [
                      "Aero runner"
                    ],
                    "categories": [
                      "ZAPATOS"
                    ],
                    "subCategories": [
                      "RUNNING"
                    ],
                    "type": "product",
                    "defaultPrice": 229900,
                    "defaultCurrency": "COP",
                    "isPriceStartingFrom": true,
                    "description": "Lightweight running shoe with a breathable mesh upper.",
                    "externalId": "erp-10045",
                    "externalUrl": "https://shop.example.com/products/aero",
                    "images": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab36b1",
                        "url": "https://cdn.example.com/catalog/aero-front.jpg",
                        "description": "Front view",
                        "isMain": true
                      }
                    ],
                    "videos": [],
                    "pdfs": [],
                    "hasStock": true,
                    "stock": 30,
                    "option1": "Talla",
                    "option1Values": [
                      "38",
                      "39",
                      "40"
                    ],
                    "option2": "Color",
                    "option2Values": [
                      "Negro",
                      "Blanco"
                    ],
                    "published": true,
                    "status": "active",
                    "priority": 0,
                    "extendedData": [
                      {
                        "field": "material",
                        "value": "mesh"
                      }
                    ],
                    "offers": [
                      {
                        "type": "standard",
                        "currency": "COP",
                        "priceBase": 249900,
                        "discounts": [
                          {
                            "sellingPrice": 219900,
                            "startDate": "2026-11-01T00:00:00.000Z",
                            "endDate": "2026-11-30T23:59:59.000Z",
                            "justification": "Black Friday"
                          }
                        ]
                      }
                    ],
                    "createdAt": "2026-10-01T15:04:05.000Z",
                    "updatedAt": "2026-11-06T15:04:05.000Z"
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/v2/items/{appUUID}/batch/update": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "post": {
        "tags": [
          "Products"
        ],
        "operationId": "batchUpdateProducts",
        "summary": "Update products in batch",
        "description": "Updates up to 100 products in one call. Only `name`, `description`, `categories`, `defaultPrice` and `defaultCurrency` are written; other fields are ignored. Every `_id` must exist in the app or nothing is updated. **Always send `categories`: if you omit it, the product's categories are cleared.** Category names are uppercased.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "items"
                ],
                "properties": {
                  "items": {
                    "type": "array",
                    "maxItems": 100,
                    "description": "Products to update (max 100).",
                    "items": {
                      "type": "object",
                      "required": [
                        "_id"
                      ],
                      "properties": {
                        "_id": {
                          "type": "string",
                          "description": "Product id."
                        },
                        "name": {
                          "type": "string",
                          "description": "New name (trimmed)."
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 2000,
                          "description": "New description (max 2,000 characters)."
                        },
                        "categories": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Full list of category names (replaces the stored one)."
                        },
                        "defaultPrice": {
                          "description": "New price (a numeric string is parsed).",
                          "oneOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "defaultCurrency": {
                          "type": "string",
                          "description": "ISO 4217 currency code."
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "items": [
                  {
                    "_id": "665f1c2e8a4b3d0012ab34cd",
                    "categories": [
                      "ZAPATOS"
                    ],
                    "defaultPrice": 229900,
                    "defaultCurrency": "COP"
                  },
                  {
                    "_id": "665f1c2e8a4b3d0012ab34ce",
                    "name": "Aero Trail Shoe",
                    "categories": [
                      "ZAPATOS",
                      "TRAIL"
                    ],
                    "defaultPrice": 279900,
                    "defaultCurrency": "COP"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Bulk-write summary (or `status: ERROR` if an id does not exist).",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/BulkWriteResult"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Items updated successfully",
                  "data": {
                    "insertedCount": 0,
                    "matchedCount": 2,
                    "modifiedCount": 2,
                    "deletedCount": 0,
                    "upsertedCount": 0
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/items/{appUUID}/batch/archive": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "post": {
        "tags": [
          "Products"
        ],
        "operationId": "batchArchiveProducts",
        "summary": "Archive or unarchive products",
        "description": "`archive` sets up to 100 products to `inactive` and unpublishes them; `unarchive` sets them back to `active` (they stay unpublished until you update `published`). All ids must belong to the app or nothing changes. Uses the legacy envelope (`success`, `message`, `result`).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/BatchItemIds"
                  },
                  {
                    "type": "object",
                    "required": [
                      "action"
                    ],
                    "properties": {
                      "action": {
                        "type": "string",
                        "enum": [
                          "archive",
                          "unarchive"
                        ],
                        "description": "`archive` or `unarchive`."
                      }
                    }
                  }
                ]
              },
              "example": {
                "action": "archive",
                "itemIds": [
                  "665f1c2e8a4b3d0012ab34cd",
                  "665f1c2e8a4b3d0012ab34ce"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Products archived or unarchived.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/LegacyResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/BulkWriteResult"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "success": true,
                  "message": "items.archive.success",
                  "result": {
                    "insertedCount": 0,
                    "matchedCount": 2,
                    "modifiedCount": 2,
                    "deletedCount": 0,
                    "upsertedCount": 0
                  }
                }
              }
            }
          },
          "400": {
            "description": "The operation failed (`success: false`): invalid input, ids that do not belong to the app, or items in the wrong status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyResponse"
                },
                "example": {
                  "success": false,
                  "message": "items.archive.someItemsNotFound",
                  "result": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/items/{appUUID}/batch/delete": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "post": {
        "tags": [
          "Products"
        ],
        "operationId": "batchDeleteProducts",
        "summary": "Delete products",
        "description": "Soft-deletes up to 100 products (status `deleted`). **The products must be archived (`inactive`) first**, otherwise nothing is deleted and you get `success: false`. Uses the legacy envelope.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchItemIds"
              },
              "example": {
                "itemIds": [
                  "665f1c2e8a4b3d0012ab34cd",
                  "665f1c2e8a4b3d0012ab34ce"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Products deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/LegacyResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "$ref": "#/components/schemas/BulkWriteResult"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "success": true,
                  "message": "Item eliminado con éxito",
                  "result": {
                    "insertedCount": 0,
                    "matchedCount": 2,
                    "modifiedCount": 2,
                    "deletedCount": 0,
                    "upsertedCount": 0
                  }
                }
              }
            }
          },
          "400": {
            "description": "The operation failed (`success: false`): invalid input, ids that do not belong to the app, or items in the wrong status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyResponse"
                },
                "example": {
                  "success": false,
                  "message": "items.archive.someItemsNotInactive",
                  "result": null
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v2/item/variants/{appUUID}/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "get": {
        "tags": [
          "Variants"
        ],
        "operationId": "listVariants",
        "summary": "List the variants of a product",
        "description": "Returns a page of the product's variants (deleted ones excluded), newest first. Pagination is page-based and **0-based**.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Id of the **product** whose variants you want.",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab34cd"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of variants.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/VariantPage"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Item variants fetched successfully",
                  "data": {
                    "rows": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab35a1",
                        "appUUID": "app_7f3k2m9x1q",
                        "itemId": "665f1c2e8a4b3d0012ab34cd",
                        "name": "Aero Running Shoe - 39 Negro",
                        "sku": "SHOE-AERO-001-39-NEG",
                        "price": 249900,
                        "currency": "COP",
                        "description": "Size 39, black.",
                        "option1": "Talla",
                        "option1Value": "39",
                        "option2": "Color",
                        "option2Value": "Negro",
                        "colors": [
                          "Negro"
                        ],
                        "images": [
                          {
                            "url": "https://cdn.example.com/catalog/aero-39-black.jpg",
                            "isMain": true
                          }
                        ],
                        "hasStock": true,
                        "stock": 12,
                        "published": true,
                        "status": "active",
                        "createdAt": "2026-10-01T15:04:05.000Z",
                        "updatedAt": "2026-11-06T15:04:05.000Z"
                      }
                    ],
                    "pagination": {
                      "page": 0,
                      "totalDocs": 1,
                      "totalPages": 0
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "delete": {
        "tags": [
          "Variants"
        ],
        "operationId": "deleteVariant",
        "summary": "Delete a variant",
        "description": "Soft-deletes the variant (status `deleted`); it disappears from listings and searches. Answers HTTP 400 if the variant does not exist in the app or is already deleted.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Id of the **variant** to delete.",
            "schema": {
              "type": "string"
            },
            "example": "665f1c2e8a4b3d0012ab35a1"
          }
        ],
        "responses": {
          "200": {
            "description": "Variant deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "description": "Always an empty object."
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Item variant deleted successfully",
                  "data": {},
                  "statusCode": 200
                }
              }
            }
          },
          "400": {
            "description": "Invalid id, variant not found or already deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "Always `ERROR`."
                    },
                    "message": {
                      "type": "string",
                      "description": "Reason."
                    }
                  }
                },
                "example": {
                  "status": "ERROR",
                  "message": "Item variant not found"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v2/item/variants/{appUUID}/id/{variantId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        },
        {
          "$ref": "#/components/parameters/VariantId"
        }
      ],
      "get": {
        "tags": [
          "Variants"
        ],
        "operationId": "getVariant",
        "summary": "Get a variant",
        "description": "Returns one variant of the app. Deleted variants, or variants of another app, answer `status: ERROR` with `Item variant not found` (HTTP 200).",
        "responses": {
          "200": {
            "description": "The variant.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Variant"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Item variant fetched successfully",
                  "data": {
                    "_id": "665f1c2e8a4b3d0012ab35a1",
                    "appUUID": "app_7f3k2m9x1q",
                    "itemId": "665f1c2e8a4b3d0012ab34cd",
                    "name": "Aero Running Shoe - 39 Negro",
                    "sku": "SHOE-AERO-001-39-NEG",
                    "price": 249900,
                    "currency": "COP",
                    "description": "Size 39, black.",
                    "option1": "Talla",
                    "option1Value": "39",
                    "option2": "Color",
                    "option2Value": "Negro",
                    "colors": [
                      "Negro"
                    ],
                    "images": [
                      {
                        "url": "https://cdn.example.com/catalog/aero-39-black.jpg",
                        "isMain": true
                      }
                    ],
                    "hasStock": true,
                    "stock": 12,
                    "published": true,
                    "status": "active",
                    "createdAt": "2026-10-01T15:04:05.000Z",
                    "updatedAt": "2026-11-06T15:04:05.000Z"
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v2/item/variants/{appUUID}/item/{itemId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        },
        {
          "$ref": "#/components/parameters/ItemId"
        }
      ],
      "post": {
        "tags": [
          "Variants"
        ],
        "operationId": "createVariant",
        "summary": "Create a variant",
        "description": "Creates one variant under the product `itemId`. The variant is always created as published. Describe the combination with `option1`/`option1Value` … `option3`/`option3Value` (free text; usually the same axis names as the product's `option1`…`option3`).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VariantInput"
              },
              "example": {
                "name": "Aero Running Shoe - 39 Negro",
                "sku": "SHOE-AERO-001-39-NEG",
                "price": 249900,
                "currency": "COP",
                "description": "Size 39, black.",
                "option1": "Talla",
                "option1Value": "39",
                "option2": "Color",
                "option2Value": "Negro",
                "colors": [
                  "Negro"
                ],
                "images": [
                  {
                    "url": "https://cdn.example.com/catalog/aero-39-black.jpg",
                    "isMain": true
                  }
                ],
                "hasStock": true,
                "stock": 12
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created variant.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Variant"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Item variants created successfully",
                  "data": {
                    "_id": "665f1c2e8a4b3d0012ab35a1",
                    "appUUID": "app_7f3k2m9x1q",
                    "itemId": "665f1c2e8a4b3d0012ab34cd",
                    "name": "Aero Running Shoe - 39 Negro",
                    "sku": "SHOE-AERO-001-39-NEG",
                    "price": 249900,
                    "currency": "COP",
                    "description": "Size 39, black.",
                    "option1": "Talla",
                    "option1Value": "39",
                    "option2": "Color",
                    "option2Value": "Negro",
                    "colors": [
                      "Negro"
                    ],
                    "images": [
                      {
                        "url": "https://cdn.example.com/catalog/aero-39-black.jpg",
                        "isMain": true
                      }
                    ],
                    "hasStock": true,
                    "stock": 12,
                    "published": true,
                    "status": "active",
                    "createdAt": "2026-10-01T15:04:05.000Z",
                    "updatedAt": "2026-11-06T15:04:05.000Z"
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v2/item/variants/{appUUID}/item/{itemId}/item-variants/{variantId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        },
        {
          "$ref": "#/components/parameters/ItemId"
        },
        {
          "$ref": "#/components/parameters/VariantId"
        }
      ],
      "put": {
        "tags": [
          "Variants"
        ],
        "operationId": "updateVariant",
        "summary": "Update a variant",
        "description": "Partial update of a variant: only the fields you send are changed. If the variant does not exist in the app the body has `statusCode: 404` (HTTP 200).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VariantInput"
              },
              "example": {
                "price": 239900,
                "stock": 8,
                "hasStock": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated variant.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Variant"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Item variants updated successfully",
                  "data": {
                    "_id": "665f1c2e8a4b3d0012ab35a1",
                    "appUUID": "app_7f3k2m9x1q",
                    "itemId": "665f1c2e8a4b3d0012ab34cd",
                    "name": "Aero Running Shoe - 39 Negro",
                    "sku": "SHOE-AERO-001-39-NEG",
                    "price": 239900,
                    "currency": "COP",
                    "description": "Size 39, black.",
                    "option1": "Talla",
                    "option1Value": "39",
                    "option2": "Color",
                    "option2Value": "Negro",
                    "colors": [
                      "Negro"
                    ],
                    "images": [
                      {
                        "url": "https://cdn.example.com/catalog/aero-39-black.jpg",
                        "isMain": true
                      }
                    ],
                    "hasStock": true,
                    "stock": 8,
                    "published": true,
                    "status": "active",
                    "createdAt": "2026-10-01T15:04:05.000Z",
                    "updatedAt": "2026-11-06T15:04:05.000Z"
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v2/categories/{appUUID}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "get": {
        "tags": [
          "Categories"
        ],
        "operationId": "listCategories",
        "summary": "List categories",
        "description": "Returns a page of the app's categories (newest first) with their subcategories populated. Offset-based pagination.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OffsetLimit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/Sort"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of categories with their subcategories.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/Category"
                              },
                              "description": "Categories of the page."
                            },
                            "metadata": {
                              "$ref": "#/components/schemas/OffsetMetadata"
                            }
                          }
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "data": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab37c1",
                        "appUUID": "app_7f3k2m9x1q",
                        "name": "ZAPATOS",
                        "image": "https://cdn.example.com/catalog/zapatos.png",
                        "subCategories": [
                          {
                            "_id": "665f1c2e8a4b3d0012ab38d1",
                            "appUUID": "app_7f3k2m9x1q",
                            "name": "RUNNING",
                            "image": "https://cdn.example.com/catalog/running.png",
                            "createdAt": "2026-10-01T15:04:05.000Z",
                            "updatedAt": "2026-10-01T15:04:05.000Z"
                          }
                        ],
                        "createdAt": "2026-10-01T15:04:05.000Z",
                        "updatedAt": "2026-10-01T15:04:05.000Z"
                      }
                    ],
                    "metadata": {
                      "totalDocs": 1,
                      "limit": 10,
                      "hasNextPage": false,
                      "offset": 0
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v2/categories/{appUUID}/create": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "post": {
        "tags": [
          "Categories"
        ],
        "operationId": "createCategory",
        "summary": "Create a category",
        "description": "Creates a category. The name is unique per app (409 if it already exists). Products are linked to categories by **name**, through their `categories` field. There is no update endpoint: delete and recreate to rename.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Category name (trimmed). Use uppercase to match the storefront searches."
                  },
                  "image": {
                    "type": "string",
                    "description": "Image URL."
                  },
                  "subCategories": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Ids of existing subcategories to link."
                  }
                }
              },
              "example": {
                "name": "ZAPATOS",
                "image": "https://cdn.example.com/catalog/zapatos.png",
                "subCategories": [
                  "665f1c2e8a4b3d0012ab38d1"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Category created.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Category"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "_id": "665f1c2e8a4b3d0012ab37c1",
                    "appUUID": "app_7f3k2m9x1q",
                    "name": "ZAPATOS",
                    "image": "https://cdn.example.com/catalog/zapatos.png",
                    "subCategories": [
                      "665f1c2e8a4b3d0012ab38d1"
                    ],
                    "createdAt": "2026-10-01T15:04:05.000Z",
                    "updatedAt": "2026-10-01T15:04:05.000Z"
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "description": "A category with that name already exists in the app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                },
                "example": {
                  "status": "ERROR",
                  "message": "A category with the name \"ZAPATOS\" already exists for this app",
                  "statusCode": 409
                }
              }
            }
          }
        }
      }
    },
    "/v2/categories/{appUUID}/{categoryId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        },
        {
          "$ref": "#/components/parameters/CategoryId"
        }
      ],
      "delete": {
        "tags": [
          "Categories"
        ],
        "operationId": "deleteCategory",
        "summary": "Delete a category",
        "description": "Permanently deletes the category and returns it (`data: null` if it did not exist). Products keep the category name in their `categories`: update them if needed.",
        "responses": {
          "200": {
            "description": "The deleted category, or `null`.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "nullable": true,
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Category"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "_id": "665f1c2e8a4b3d0012ab37c1",
                    "appUUID": "app_7f3k2m9x1q",
                    "name": "ZAPATOS",
                    "image": "https://cdn.example.com/catalog/zapatos.png",
                    "subCategories": [
                      "665f1c2e8a4b3d0012ab38d1"
                    ],
                    "createdAt": "2026-10-01T15:04:05.000Z",
                    "updatedAt": "2026-10-01T15:04:05.000Z"
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v2/categories/{appUUID}/subcategories": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "get": {
        "tags": [
          "Categories"
        ],
        "operationId": "listSubcategories",
        "summary": "List subcategories",
        "description": "Returns a page of the app's subcategories (deleted ones excluded), newest first. Offset-based pagination.",
        "parameters": [
          {
            "$ref": "#/components/parameters/OffsetLimit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/Sort"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of subcategories.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/Subcategory"
                              },
                              "description": "Subcategories of the page."
                            },
                            "metadata": {
                              "$ref": "#/components/schemas/OffsetMetadata"
                            }
                          }
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "data": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab38d1",
                        "appUUID": "app_7f3k2m9x1q",
                        "name": "RUNNING",
                        "image": "https://cdn.example.com/catalog/running.png",
                        "createdAt": "2026-10-01T15:04:05.000Z",
                        "updatedAt": "2026-10-01T15:04:05.000Z"
                      }
                    ],
                    "metadata": {
                      "totalDocs": 1,
                      "limit": 10,
                      "hasNextPage": false,
                      "offset": 0
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Categories"
        ],
        "operationId": "createSubcategory",
        "summary": "Create a subcategory",
        "description": "Creates a subcategory. The name is unique per app (409 if it already exists). It is not linked to any category automatically: pass its id in `subCategories` when you create the category.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Subcategory name (trimmed)."
                  },
                  "image": {
                    "type": "string",
                    "description": "Image URL."
                  }
                }
              },
              "example": {
                "name": "RUNNING",
                "image": "https://cdn.example.com/catalog/running.png"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Subcategory created.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/Subcategory"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "_id": "665f1c2e8a4b3d0012ab38d1",
                    "appUUID": "app_7f3k2m9x1q",
                    "name": "RUNNING",
                    "image": "https://cdn.example.com/catalog/running.png",
                    "createdAt": "2026-10-01T15:04:05.000Z",
                    "updatedAt": "2026-10-01T15:04:05.000Z"
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "description": "A subcategory with that name already exists in the app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                },
                "example": {
                  "status": "ERROR",
                  "message": "A subcategory with the name \"RUNNING\" already exists for this app",
                  "statusCode": 409
                }
              }
            }
          }
        }
      }
    },
    "/v2/categories/{appUUID}/subcategories/{subCategoryId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        },
        {
          "$ref": "#/components/parameters/SubcategoryId"
        }
      ],
      "delete": {
        "tags": [
          "Categories"
        ],
        "operationId": "deleteSubcategory",
        "summary": "Delete a subcategory",
        "description": "Soft-deletes the subcategory (sets `deletedAt`) and returns it (`data: null` if it did not exist or was already deleted). It stops appearing in listings and inside its categories.",
        "responses": {
          "200": {
            "description": "The deleted subcategory, or `null`.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "nullable": true,
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Subcategory"
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "_id": "665f1c2e8a4b3d0012ab38d1",
                    "appUUID": "app_7f3k2m9x1q",
                    "name": "RUNNING",
                    "image": "https://cdn.example.com/catalog/running.png",
                    "createdAt": "2026-10-01T15:04:05.000Z",
                    "updatedAt": "2026-10-01T15:04:05.000Z",
                    "deletedAt": "2026-11-06T15:04:05.000Z"
                  },
                  "statusCode": 200
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/public/v2/items/{appUUID}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "get": {
        "tags": [
          "Storefront"
        ],
        "operationId": "listStorefrontProducts",
        "summary": "List products (public)",
        "description": "Public, no credential needed: lists the app's active products for a storefront, newest first. Same filters and **0-based** page pagination as `GET /v2/items/{appUUID}`. Only active products are listed.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "name",
            "in": "query",
            "required": false,
            "description": "Text contained in the product name (case- and accent-insensitive).",
            "schema": {
              "type": "string"
            },
            "example": "aero"
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Exact category name; returns products whose `categories` contains it.",
            "schema": {
              "type": "string"
            },
            "example": "ZAPATOS"
          },
          {
            "name": "sku",
            "in": "query",
            "required": false,
            "description": "SKU prefix (case-insensitive).",
            "schema": {
              "type": "string"
            },
            "example": "SHOE-AERO"
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "description": "Size prefix (case-insensitive).",
            "schema": {
              "type": "string"
            },
            "example": "39"
          },
          {
            "name": "color",
            "in": "query",
            "required": false,
            "description": "Color prefix (case-insensitive).",
            "schema": {
              "type": "string"
            },
            "example": "negro"
          },
          {
            "name": "year",
            "in": "query",
            "required": false,
            "description": "Four-digit year.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{4}$"
            },
            "example": "2026"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of products.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/ProductPage"
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "Items fetched successfully",
                  "data": {
                    "rows": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab34cd",
                        "appUUID": "app_7f3k2m9x1q",
                        "name": "Aero Running Shoe",
                        "sku": "SHOE-AERO-001",
                        "alias": [
                          "Aero runner"
                        ],
                        "categories": [
                          "ZAPATOS"
                        ],
                        "subCategories": [
                          "RUNNING"
                        ],
                        "type": "product",
                        "defaultPrice": 249900,
                        "defaultCurrency": "COP",
                        "isPriceStartingFrom": true,
                        "description": "Lightweight running shoe with a breathable mesh upper.",
                        "externalId": "erp-10045",
                        "externalUrl": "https://shop.example.com/products/aero",
                        "images": [
                          {
                            "_id": "665f1c2e8a4b3d0012ab36b1",
                            "url": "https://cdn.example.com/catalog/aero-front.jpg",
                            "description": "Front view",
                            "isMain": true
                          }
                        ],
                        "videos": [],
                        "pdfs": [],
                        "hasStock": true,
                        "stock": 42,
                        "option1": "Talla",
                        "option1Values": [
                          "38",
                          "39",
                          "40"
                        ],
                        "option2": "Color",
                        "option2Values": [
                          "Negro",
                          "Blanco"
                        ],
                        "published": true,
                        "status": "active",
                        "priority": 0,
                        "extendedData": [
                          {
                            "field": "material",
                            "value": "mesh"
                          }
                        ],
                        "offers": [
                          {
                            "type": "standard",
                            "currency": "COP",
                            "priceBase": 249900,
                            "discounts": [
                              {
                                "sellingPrice": 219900,
                                "startDate": "2026-11-01T00:00:00.000Z",
                                "endDate": "2026-11-30T23:59:59.000Z",
                                "justification": "Black Friday"
                              }
                            ]
                          }
                        ],
                        "createdAt": "2026-10-01T15:04:05.000Z",
                        "updatedAt": "2026-11-06T15:04:05.000Z"
                      }
                    ],
                    "pagination": {
                      "page": 0,
                      "totalDocs": 1,
                      "totalPages": 0
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          }
        }
      }
    },
    "/public/v1/items/{appUUID}/{itemId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        },
        {
          "$ref": "#/components/parameters/ItemId"
        }
      ],
      "get": {
        "tags": [
          "Storefront"
        ],
        "operationId": "getStorefrontProduct",
        "summary": "Get a product with its variants (public)",
        "description": "Public, no credential needed: returns an active product with up to 250 variants in `variants.rows`. Uses the legacy envelope. A product that does not exist or is not active answers `404`; an `itemId` that is not a valid ObjectId answers `400`. Variants are not filtered by status: check `status` and `published` before showing them.",
        "security": [],
        "responses": {
          "200": {
            "description": "The product with its variants.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/LegacyResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Product"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "variants": {
                                  "$ref": "#/components/schemas/VariantPage"
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "success": true,
                  "message": "Item encontrado con éxito",
                  "result": {
                    "_id": "665f1c2e8a4b3d0012ab34cd",
                    "appUUID": "app_7f3k2m9x1q",
                    "name": "Aero Running Shoe",
                    "sku": "SHOE-AERO-001",
                    "alias": [
                      "Aero runner"
                    ],
                    "categories": [
                      "ZAPATOS"
                    ],
                    "subCategories": [
                      "RUNNING"
                    ],
                    "type": "product",
                    "defaultPrice": 249900,
                    "defaultCurrency": "COP",
                    "isPriceStartingFrom": true,
                    "description": "Lightweight running shoe with a breathable mesh upper.",
                    "externalId": "erp-10045",
                    "externalUrl": "https://shop.example.com/products/aero",
                    "images": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab36b1",
                        "url": "https://cdn.example.com/catalog/aero-front.jpg",
                        "description": "Front view",
                        "isMain": true
                      }
                    ],
                    "videos": [],
                    "pdfs": [],
                    "hasStock": true,
                    "stock": 42,
                    "option1": "Talla",
                    "option1Values": [
                      "38",
                      "39",
                      "40"
                    ],
                    "option2": "Color",
                    "option2Values": [
                      "Negro",
                      "Blanco"
                    ],
                    "published": true,
                    "status": "active",
                    "priority": 0,
                    "extendedData": [
                      {
                        "field": "material",
                        "value": "mesh"
                      }
                    ],
                    "offers": [
                      {
                        "type": "standard",
                        "currency": "COP",
                        "priceBase": 249900,
                        "discounts": [
                          {
                            "sellingPrice": 219900,
                            "startDate": "2026-11-01T00:00:00.000Z",
                            "endDate": "2026-11-30T23:59:59.000Z",
                            "justification": "Black Friday"
                          }
                        ]
                      }
                    ],
                    "createdAt": "2026-10-01T15:04:05.000Z",
                    "updatedAt": "2026-11-06T15:04:05.000Z",
                    "variants": {
                      "rows": [
                        {
                          "_id": "665f1c2e8a4b3d0012ab35a1",
                          "appUUID": "app_7f3k2m9x1q",
                          "itemId": "665f1c2e8a4b3d0012ab34cd",
                          "name": "Aero Running Shoe - 39 Negro",
                          "sku": "SHOE-AERO-001-39-NEG",
                          "price": 249900,
                          "currency": "COP",
                          "description": "Size 39, black.",
                          "option1": "Talla",
                          "option1Value": "39",
                          "option2": "Color",
                          "option2Value": "Negro",
                          "colors": [
                            "Negro"
                          ],
                          "images": [
                            {
                              "url": "https://cdn.example.com/catalog/aero-39-black.jpg",
                              "isMain": true
                            }
                          ],
                          "hasStock": true,
                          "stock": 12,
                          "published": true,
                          "status": "active",
                          "createdAt": "2026-10-01T15:04:05.000Z",
                          "updatedAt": "2026-11-06T15:04:05.000Z"
                        }
                      ],
                      "pagination": {
                        "page": 0,
                        "totalDocs": 1,
                        "totalPages": 0
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`itemId` is not a valid ObjectId, or an unexpected error happened.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyResponse"
                },
                "example": {
                  "success": false,
                  "message": "Los datos ingresados no son válidos",
                  "result": null
                }
              }
            }
          },
          "404": {
            "description": "The product does not exist in the app or is not active.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyResponse"
                },
                "example": {
                  "success": false,
                  "message": "El item no existe",
                  "result": null
                }
              }
            }
          }
        }
      }
    },
    "/public/v1/items-search/{appUUID}/search": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "get": {
        "tags": [
          "Storefront"
        ],
        "operationId": "searchStorefrontProducts",
        "summary": "Search products by name or category (public)",
        "description": "Public, no credential needed: active products with stock filtered by name/SKU text, category or collection, with offset pagination. Within a page, products with higher `priority` come first. If no product matches, it falls back to matching variant names/SKUs with `name` and returns up to 5 products with their `variants` (without `name`, an empty result comes back as `status: ERROR`). Images come cover-first and `brandLogoUrl` is added when known.",
        "security": [],
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": false,
            "description": "Text contained in the product name or SKU (case-insensitive, regular-expression syntax).",
            "schema": {
              "type": "string"
            },
            "example": "aero"
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Single category name (uppercased before matching).",
            "schema": {
              "type": "string"
            },
            "example": "ZAPATOS"
          },
          {
            "name": "categories",
            "in": "query",
            "required": false,
            "description": "Comma-separated category names; the product must have all of them (uppercased).",
            "schema": {
              "type": "string"
            },
            "example": "ZAPATOS,RUNNING"
          },
          {
            "name": "collectionId",
            "in": "query",
            "required": false,
            "description": "External collection id (synced catalogs).",
            "schema": {
              "type": "string"
            },
            "example": "gid-collection-1001"
          },
          {
            "$ref": "#/components/parameters/OffsetLimit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Sort map as a deep object, e.g. `sort[defaultPrice]=asc` (`asc`/`desc`). Default newest first.",
            "style": "deepObject",
            "explode": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "enum": [
                  "asc",
                  "desc"
                ]
              }
            },
            "example": {
              "defaultPrice": "asc"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of products.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "data": {
                              "type": "array",
                              "items": {
                                "allOf": [
                                  {
                                    "$ref": "#/components/schemas/Product"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "variants": {
                                        "type": "array",
                                        "items": {
                                          "$ref": "#/components/schemas/Variant"
                                        },
                                        "description": "Matching variants (only when the match came from variants)."
                                      }
                                    }
                                  }
                                ]
                              },
                              "description": "Products of the page."
                            },
                            "metadata": {
                              "$ref": "#/components/schemas/OffsetMetadata"
                            }
                          }
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "data": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab34cd",
                        "appUUID": "app_7f3k2m9x1q",
                        "name": "Aero Running Shoe",
                        "sku": "SHOE-AERO-001",
                        "alias": [
                          "Aero runner"
                        ],
                        "categories": [
                          "ZAPATOS"
                        ],
                        "subCategories": [
                          "RUNNING"
                        ],
                        "type": "product",
                        "defaultPrice": 249900,
                        "defaultCurrency": "COP",
                        "isPriceStartingFrom": true,
                        "description": "Lightweight running shoe with a breathable mesh upper.",
                        "externalId": "erp-10045",
                        "externalUrl": "https://shop.example.com/products/aero",
                        "images": [
                          {
                            "_id": "665f1c2e8a4b3d0012ab36b1",
                            "url": "https://cdn.example.com/catalog/aero-front.jpg",
                            "description": "Front view",
                            "isMain": true
                          }
                        ],
                        "videos": [],
                        "pdfs": [],
                        "hasStock": true,
                        "stock": 42,
                        "option1": "Talla",
                        "option1Values": [
                          "38",
                          "39",
                          "40"
                        ],
                        "option2": "Color",
                        "option2Values": [
                          "Negro",
                          "Blanco"
                        ],
                        "published": true,
                        "status": "active",
                        "priority": 0,
                        "extendedData": [
                          {
                            "field": "material",
                            "value": "mesh"
                          }
                        ],
                        "offers": [
                          {
                            "type": "standard",
                            "currency": "COP",
                            "priceBase": 249900,
                            "discounts": [
                              {
                                "sellingPrice": 219900,
                                "startDate": "2026-11-01T00:00:00.000Z",
                                "endDate": "2026-11-30T23:59:59.000Z",
                                "justification": "Black Friday"
                              }
                            ]
                          }
                        ],
                        "createdAt": "2026-10-01T15:04:05.000Z",
                        "updatedAt": "2026-11-06T15:04:05.000Z"
                      }
                    ],
                    "metadata": {
                      "totalDocs": 1,
                      "limit": 10,
                      "hasNextPage": false,
                      "offset": 0
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          }
        }
      }
    },
    "/public/v1/items-search/{appUUID}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "get": {
        "tags": [
          "Storefront"
        ],
        "operationId": "semanticSearchStorefrontProducts",
        "summary": "Semantic search of products (public)",
        "description": "Public, no credential needed: vector (meaning-based) search over active products with stock, e.g. `zapatos para correr` finds running shoes without a literal match. Each product carries its `score` and up to 10 best-matching active `variants`, and results are reordered by `priority`. Not paginated: use `limit`.",
        "security": [],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": true,
            "description": "What the customer is looking for, in natural language. Required.",
            "schema": {
              "type": "string"
            },
            "example": "zapatos livianos para correr"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum products. Default `5`.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 5
            },
            "example": 5
          },
          {
            "name": "categories",
            "in": "query",
            "required": false,
            "description": "Comma-separated category names to prefer. If none matches, it searches the whole catalog unless `filterCategoryStrictly=true`.",
            "schema": {
              "type": "string"
            },
            "example": "ZAPATOS"
          },
          {
            "name": "filterCategoryStrictly",
            "in": "query",
            "required": false,
            "description": "Return nothing when no product is in `categories`, instead of searching the whole catalog.",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "example": false
          },
          {
            "name": "searchVariants",
            "in": "query",
            "required": false,
            "description": "Text used to rank the variants of each product. Defaults to `search`.",
            "schema": {
              "type": "string"
            },
            "example": "talla 39 negro"
          },
          {
            "name": "collectionId",
            "in": "query",
            "required": false,
            "description": "External collection id (synced catalogs).",
            "schema": {
              "type": "string"
            },
            "example": "gid-collection-1001"
          }
        ],
        "responses": {
          "200": {
            "description": "Products ranked by similarity.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "allOf": [
                              {
                                "$ref": "#/components/schemas/Product"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "score": {
                                    "type": "number",
                                    "description": "Similarity score."
                                  },
                                  "variants": {
                                    "type": "array",
                                    "items": {
                                      "allOf": [
                                        {
                                          "$ref": "#/components/schemas/Variant"
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "score": {
                                              "type": "number",
                                              "description": "Similarity score."
                                            }
                                          }
                                        }
                                      ]
                                    },
                                    "description": "Up to 10 best-matching variants."
                                  }
                                }
                              }
                            ]
                          }
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": [
                    {
                      "_id": "665f1c2e8a4b3d0012ab34cd",
                      "appUUID": "app_7f3k2m9x1q",
                      "name": "Aero Running Shoe",
                      "sku": "SHOE-AERO-001",
                      "alias": [
                        "Aero runner"
                      ],
                      "categories": [
                        "ZAPATOS"
                      ],
                      "subCategories": [
                        "RUNNING"
                      ],
                      "type": "product",
                      "defaultPrice": 249900,
                      "defaultCurrency": "COP",
                      "isPriceStartingFrom": true,
                      "description": "Lightweight running shoe with a breathable mesh upper.",
                      "externalId": "erp-10045",
                      "externalUrl": "https://shop.example.com/products/aero",
                      "images": [
                        {
                          "_id": "665f1c2e8a4b3d0012ab36b1",
                          "url": "https://cdn.example.com/catalog/aero-front.jpg",
                          "description": "Front view",
                          "isMain": true
                        }
                      ],
                      "videos": [],
                      "pdfs": [],
                      "hasStock": true,
                      "stock": 42,
                      "option1": "Talla",
                      "option1Values": [
                        "38",
                        "39",
                        "40"
                      ],
                      "option2": "Color",
                      "option2Values": [
                        "Negro",
                        "Blanco"
                      ],
                      "published": true,
                      "status": "active",
                      "priority": 0,
                      "extendedData": [
                        {
                          "field": "material",
                          "value": "mesh"
                        }
                      ],
                      "offers": [
                        {
                          "type": "standard",
                          "currency": "COP",
                          "priceBase": 249900,
                          "discounts": [
                            {
                              "sellingPrice": 219900,
                              "startDate": "2026-11-01T00:00:00.000Z",
                              "endDate": "2026-11-30T23:59:59.000Z",
                              "justification": "Black Friday"
                            }
                          ]
                        }
                      ],
                      "createdAt": "2026-10-01T15:04:05.000Z",
                      "updatedAt": "2026-11-06T15:04:05.000Z",
                      "score": 0.87,
                      "variants": [
                        {
                          "_id": "665f1c2e8a4b3d0012ab35a1",
                          "appUUID": "app_7f3k2m9x1q",
                          "itemId": "665f1c2e8a4b3d0012ab34cd",
                          "name": "Aero Running Shoe - 39 Negro",
                          "sku": "SHOE-AERO-001-39-NEG",
                          "price": 249900,
                          "currency": "COP",
                          "description": "Size 39, black.",
                          "option1": "Talla",
                          "option1Value": "39",
                          "option2": "Color",
                          "option2Value": "Negro",
                          "colors": [
                            "Negro"
                          ],
                          "images": [
                            {
                              "url": "https://cdn.example.com/catalog/aero-39-black.jpg",
                              "isMain": true
                            }
                          ],
                          "hasStock": true,
                          "stock": 12,
                          "published": true,
                          "status": "active",
                          "createdAt": "2026-10-01T15:04:05.000Z",
                          "updatedAt": "2026-11-06T15:04:05.000Z",
                          "score": 0.82
                        }
                      ]
                    }
                  ],
                  "statusCode": 200
                }
              }
            }
          }
        }
      }
    },
    "/public/v2/categories/{appUUID}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AppUUID"
        }
      ],
      "get": {
        "tags": [
          "Storefront"
        ],
        "operationId": "listStorefrontCategories",
        "summary": "List categories (public)",
        "description": "Public, no credential needed: same as `GET /v2/categories/{appUUID}`, to build the category menu of a storefront.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/OffsetLimit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/Sort"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of categories with their subcategories.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "data": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/Category"
                              },
                              "description": "Categories of the page."
                            },
                            "metadata": {
                              "$ref": "#/components/schemas/OffsetMetadata"
                            }
                          }
                        }
                      }
                    }
                  ]
                },
                "example": {
                  "status": "SUCCESS",
                  "message": "",
                  "data": {
                    "data": [
                      {
                        "_id": "665f1c2e8a4b3d0012ab37c1",
                        "appUUID": "app_7f3k2m9x1q",
                        "name": "ZAPATOS",
                        "image": "https://cdn.example.com/catalog/zapatos.png",
                        "subCategories": [
                          {
                            "_id": "665f1c2e8a4b3d0012ab38d1",
                            "appUUID": "app_7f3k2m9x1q",
                            "name": "RUNNING",
                            "image": "https://cdn.example.com/catalog/running.png",
                            "createdAt": "2026-10-01T15:04:05.000Z",
                            "updatedAt": "2026-10-01T15:04:05.000Z"
                          }
                        ],
                        "createdAt": "2026-10-01T15:04:05.000Z",
                        "updatedAt": "2026-10-01T15:04:05.000Z"
                      }
                    ],
                    "metadata": {
                      "totalDocs": 1,
                      "limit": 10,
                      "hasNextPage": false,
                      "offset": 0
                    }
                  },
                  "statusCode": 200
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your app's API key (Settings → API keys) or an Identity access token."
      }
    },
    "parameters": {
      "AppUUID": {
        "name": "appUUID",
        "in": "path",
        "required": true,
        "description": "Your app UUID (shown in Settings → API keys).",
        "schema": {
          "type": "string"
        },
        "example": "app_7f3k2m9x1q"
      },
      "ItemId": {
        "name": "itemId",
        "in": "path",
        "required": true,
        "description": "Product id (24-hex ObjectId).",
        "schema": {
          "type": "string"
        },
        "example": "665f1c2e8a4b3d0012ab34cd"
      },
      "VariantId": {
        "name": "variantId",
        "in": "path",
        "required": true,
        "description": "Variant id (24-hex ObjectId).",
        "schema": {
          "type": "string"
        },
        "example": "665f1c2e8a4b3d0012ab35a1"
      },
      "CategoryId": {
        "name": "categoryId",
        "in": "path",
        "required": true,
        "description": "Category id (24-hex ObjectId).",
        "schema": {
          "type": "string"
        },
        "example": "665f1c2e8a4b3d0012ab37c1"
      },
      "SubcategoryId": {
        "name": "subCategoryId",
        "in": "path",
        "required": true,
        "description": "Subcategory id (24-hex ObjectId).",
        "schema": {
          "type": "string"
        },
        "example": "665f1c2e8a4b3d0012ab38d1"
      },
      "Page": {
        "name": "page",
        "in": "query",
        "required": false,
        "description": "Page number, **0-based**. Default `0`.",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "default": 0
        },
        "example": 0
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Page size. Default `10`.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "default": 10
        },
        "example": 20
      },
      "Offset": {
        "name": "offset",
        "in": "query",
        "required": false,
        "description": "Number of documents to skip. Default `0`.",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "default": 0
        },
        "example": 0
      },
      "OffsetLimit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Maximum documents to return. Default `10`.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "default": 10
        },
        "example": 10
      },
      "Sort": {
        "name": "sort",
        "in": "query",
        "required": false,
        "description": "Sort map as a deep object, e.g. `sort[createdAt]=desc`. Use `asc` or `desc` (numeric `1`/`-1` are rejected in the query string). Default `createdAt` descending.",
        "style": "deepObject",
        "explode": true,
        "schema": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "enum": [
              "asc",
              "desc"
            ]
          }
        },
        "example": {
          "createdAt": "desc"
        }
      }
    },
    "schemas": {
      "ApiResponse": {
        "type": "object",
        "description": "Envelope of every `/v2/*` and `/public/v1/items-search/*` response. The HTTP status is usually 200 (201 for POST) even when the operation fails: check `status` and `statusCode`.",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "SUCCESS",
              "ERROR"
            ],
            "description": "`SUCCESS` or `ERROR`."
          },
          "message": {
            "type": "string",
            "description": "Human-readable result or error message (may be empty)."
          },
          "data": {
            "description": "Payload of the operation (see each endpoint). Absent or `null` on errors."
          },
          "statusCode": {
            "type": "integer",
            "description": "Logical status code of the operation (e.g. 200, 400, 404, 500). It can differ from the HTTP status."
          },
          "errors": {
            "type": "array",
            "description": "Validation errors (only on `Validation failed`).",
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            }
          }
        },
        "required": [
          "status",
          "message",
          "statusCode"
        ]
      },
      "ValidationError": {
        "type": "object",
        "description": "One validation error of a product or variant payload.",
        "properties": {
          "code": {
            "type": "string",
            "description": "Stable error code.",
            "enum": [
              "ITEM_IMAGES_LIMIT_EXCEEDED",
              "ITEM_VIDEOS_LIMIT_EXCEEDED",
              "ITEM_PDFS_LIMIT_EXCEEDED",
              "ITEM_DESCRIPTION_TOO_LONG",
              "ITEM_MULTIPLE_MAIN_IMAGES",
              "VARIANT_IMAGES_LIMIT_EXCEEDED",
              "VARIANT_VIDEOS_LIMIT_EXCEEDED",
              "VARIANT_PDFS_LIMIT_EXCEEDED",
              "VARIANT_MULTIPLE_MAIN_IMAGES",
              "SOURCES_INVALID",
              "SOURCE_INVALID_STRUCTURE",
              "SOURCE_MISSING_TYPE",
              "SOURCE_MISSING_URL",
              "SOURCE_INVALID_URL",
              "SOURCE_DUPLICATE"
            ]
          },
          "message": {
            "type": "string",
            "description": "English description of the error."
          },
          "translationKey": {
            "type": "string",
            "description": "i18n key used by the Biky UI."
          },
          "limit": {
            "type": "integer",
            "description": "Maximum allowed (limit errors only)."
          },
          "received": {
            "type": "integer",
            "description": "Value received (limit errors only)."
          }
        }
      },
      "LegacyResponse": {
        "type": "object",
        "description": "Envelope of the `/v1/items/*` and `/public/v1/items/*` routes.",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "`true` when the operation succeeded (HTTP 200); `false` comes with HTTP 400."
          },
          "message": {
            "type": "string",
            "description": "Localized result message (Spanish by default)."
          },
          "result": {
            "description": "Payload of the operation, `null` on errors."
          }
        }
      },
      "GatewayError": {
        "type": "object",
        "description": "Error returned by the API gateway or by the framework before reaching the handler.",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message."
          },
          "error": {
            "type": "string",
            "description": "Error name (framework errors only)."
          },
          "statusCode": {
            "type": "integer",
            "description": "HTTP status (framework errors only)."
          }
        }
      },
      "PagePagination": {
        "type": "object",
        "description": "Page-based pagination block. It is an empty object `{}` when there are no results. `totalPages` is `floor(totalDocs / limit)`, so it can be one less than the real number of pages: iterate until a page returns fewer than `limit` rows.",
        "properties": {
          "page": {
            "type": "integer",
            "description": "Requested page (0-based)."
          },
          "totalDocs": {
            "type": "integer",
            "description": "Total matching documents."
          },
          "totalPages": {
            "type": "integer",
            "description": "`floor(totalDocs / limit)`."
          }
        }
      },
      "OffsetMetadata": {
        "type": "object",
        "description": "Offset-based pagination metadata. When you pass `limit`/`offset` they are echoed back as strings, and `hasNextPage` is unreliable if `offset` > 0: compute `offset + data.length < totalDocs` yourself.",
        "properties": {
          "totalDocs": {
            "type": "integer",
            "description": "Total matching documents."
          },
          "limit": {
            "type": "integer",
            "description": "Page size used."
          },
          "hasNextPage": {
            "type": "boolean",
            "description": "Whether more documents exist after this page."
          },
          "offset": {
            "type": "integer",
            "description": "Number of documents skipped."
          }
        }
      },
      "Image": {
        "type": "object",
        "description": "Image of a product or variant.",
        "required": [
          "url"
        ],
        "properties": {
          "_id": {
            "type": "string",
            "readOnly": true,
            "description": "Image id (assigned on product create)."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Public URL of the image."
          },
          "description": {
            "type": "string",
            "description": "Alt text / caption."
          },
          "isMain": {
            "type": "boolean",
            "description": "Cover image. Only one image per product (or variant) may be `true`; if none is, the first one is used."
          },
          "width": {
            "type": "string",
            "description": "Width in pixels, as text."
          },
          "height": {
            "type": "string",
            "description": "Height in pixels, as text."
          },
          "externalId": {
            "type": "string",
            "description": "Id of the image in your system."
          },
          "externalUrl": {
            "type": "string",
            "description": "Original URL of the image in your system."
          },
          "320x240_url": {
            "type": "string",
            "readOnly": true,
            "description": "Resized copy, filled asynchronously after saving."
          },
          "640x480_url": {
            "type": "string",
            "readOnly": true,
            "description": "Resized copy, filled asynchronously after saving."
          },
          "800x600_url": {
            "type": "string",
            "readOnly": true,
            "description": "Resized copy, filled asynchronously after saving."
          },
          "1024x768_url": {
            "type": "string",
            "readOnly": true,
            "description": "Resized copy, filled asynchronously after saving."
          }
        }
      },
      "Media": {
        "type": "object",
        "description": "Video or PDF attached to a product or variant.",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Public URL of the file."
          },
          "description": {
            "type": "string",
            "description": "Caption shown to the customer."
          },
          "externalId": {
            "type": "string",
            "description": "Id of the file in your system (PDFs)."
          }
        }
      },
      "ExtendedField": {
        "type": "object",
        "description": "Custom field of a product or variant. `field` is free text defined by your team (e.g. `material`, `area_m2`); Biky can filter by these fields.",
        "required": [
          "field",
          "value"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "Field name."
          },
          "value": {
            "description": "Field value (text or number).",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          }
        }
      },
      "OfferDiscount": {
        "type": "object",
        "description": "Discounted price inside an offer.",
        "required": [
          "sellingPrice"
        ],
        "properties": {
          "sellingPrice": {
            "type": "number",
            "description": "Final price with the discount applied."
          },
          "startDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the discount starts (null = already active)."
          },
          "endDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the discount ends (null = no end)."
          },
          "justification": {
            "type": "string",
            "description": "Reason shown to advisors (e.g. a campaign name)."
          }
        }
      },
      "Offer": {
        "type": "object",
        "description": "Price offer of a product or variant, used by Biky to quote.",
        "required": [
          "currency",
          "priceBase",
          "discounts"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Offer type. Default `standard`."
          },
          "typeId": {
            "type": "string",
            "nullable": true,
            "description": "Optional id of the contact status the offer applies to."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code."
          },
          "priceBase": {
            "type": "number",
            "description": "Base price before discounts (usually the product `defaultPrice` or the variant `price`)."
          },
          "discounts": {
            "type": "array",
            "maxItems": 3,
            "description": "Up to 3 discounts.",
            "items": {
              "$ref": "#/components/schemas/OfferDiscount"
            }
          }
        }
      },
      "ProductInput": {
        "type": "object",
        "description": "Writable fields of a product.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Product name. Line breaks are removed and it is trimmed."
          },
          "sku": {
            "type": "string",
            "description": "Your SKU. Must be unique among the app's active products (checked on create)."
          },
          "alias": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alternative names, also matched by name search."
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Category **names** (not ids). Use the exact uppercase name of the category (e.g. `ZAPATOS`): the storefront searches uppercase the filter before matching."
          },
          "subCategories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Subcategory names."
          },
          "type": {
            "type": "string",
            "enum": [
              "product",
              "place",
              "single_post",
              "service",
              "digital",
              "other"
            ],
            "description": "Kind of item. Default `other`."
          },
          "defaultPrice": {
            "type": "number",
            "description": "Base price of the product."
          },
          "defaultCurrency": {
            "type": "string",
            "description": "ISO 4217 currency code of `defaultPrice` (e.g. `COP`, `USD`, `MXN`)."
          },
          "isPriceStartingFrom": {
            "type": "boolean",
            "description": "Show the price as \"from\". On update, when `true`, `defaultPrice` is recalculated as the lowest price of the product's variants."
          },
          "rating": {
            "type": "number",
            "description": "Rating shown on the storefront."
          },
          "description": {
            "type": "string",
            "maxLength": 2000,
            "description": "Short description (max 2,000 characters)."
          },
          "longDescription": {
            "type": "string",
            "description": "Long description (HTML or plain text)."
          },
          "externalId": {
            "type": "string",
            "description": "Id of the product in your system."
          },
          "externalUrl": {
            "type": "string",
            "description": "URL of the product in your store."
          },
          "images": {
            "type": "array",
            "maxItems": 30,
            "description": "Up to 30 images, only one with `isMain: true`.",
            "items": {
              "$ref": "#/components/schemas/Image"
            }
          },
          "videos": {
            "type": "array",
            "maxItems": 5,
            "description": "Up to 5 videos.",
            "items": {
              "$ref": "#/components/schemas/Media"
            }
          },
          "pdfs": {
            "type": "array",
            "maxItems": 3,
            "description": "Up to 3 PDFs (brochures, spec sheets).",
            "items": {
              "$ref": "#/components/schemas/Media"
            }
          },
          "hasStock": {
            "type": "boolean",
            "description": "Whether the product is available. Storefront searches only return products with `hasStock: true`. Default `true`."
          },
          "stock": {
            "type": "number",
            "description": "Units available."
          },
          "option1": {
            "type": "string",
            "description": "Name of the first variant axis (e.g. `Talla`)."
          },
          "option1Values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Values of the first axis."
          },
          "option2": {
            "type": "string",
            "description": "Name of the second variant axis."
          },
          "option2Values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Values of the second axis."
          },
          "option3": {
            "type": "string",
            "description": "Name of the third variant axis."
          },
          "option3Values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Values of the third axis."
          },
          "size": {
            "type": "string",
            "description": "Size (filterable)."
          },
          "color": {
            "type": "string",
            "description": "Color (filterable)."
          },
          "year": {
            "type": "number",
            "description": "Year, e.g. model year (filterable)."
          },
          "published": {
            "type": "boolean",
            "description": "Whether the product is published. Default `true`."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive",
              "deleted"
            ],
            "description": "Lifecycle status. `inactive` = archived. Changing it on update also applies it to all the product's variants. Default `active`."
          },
          "priority": {
            "type": "number",
            "description": "Ranking boost in search results (higher first). Default 0."
          },
          "extendedData": {
            "type": "array",
            "description": "Custom fields of the product.",
            "items": {
              "$ref": "#/components/schemas/ExtendedField"
            }
          },
          "promotions": {
            "type": "string",
            "maxLength": 200,
            "description": "Current promotions in plain text (truncated to 200 characters)."
          },
          "financialProposal": {
            "type": "string",
            "description": "Financing options in plain text."
          },
          "offers": {
            "type": "array",
            "description": "Price offers used by Biky to quote.",
            "items": {
              "$ref": "#/components/schemas/Offer"
            }
          }
        }
      },
      "Product": {
        "type": "object",
        "description": "A product (item) of the app's catalog.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Product id."
          },
          "appUUID": {
            "type": "string",
            "description": "App the product belongs to."
          },
          "name": {
            "type": "string",
            "description": "Product name. Line breaks are removed and it is trimmed."
          },
          "sku": {
            "type": "string",
            "description": "Your SKU. Must be unique among the app's active products (checked on create)."
          },
          "alias": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alternative names, also matched by name search."
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Category **names** (not ids). Use the exact uppercase name of the category (e.g. `ZAPATOS`): the storefront searches uppercase the filter before matching."
          },
          "subCategories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Subcategory names."
          },
          "type": {
            "type": "string",
            "enum": [
              "product",
              "place",
              "single_post",
              "service",
              "digital",
              "other"
            ],
            "description": "Kind of item. Default `other`."
          },
          "defaultPrice": {
            "type": "number",
            "description": "Base price of the product."
          },
          "defaultCurrency": {
            "type": "string",
            "description": "ISO 4217 currency code of `defaultPrice` (e.g. `COP`, `USD`, `MXN`)."
          },
          "isPriceStartingFrom": {
            "type": "boolean",
            "description": "Show the price as \"from\". On update, when `true`, `defaultPrice` is recalculated as the lowest price of the product's variants."
          },
          "rating": {
            "type": "number",
            "description": "Rating shown on the storefront."
          },
          "description": {
            "type": "string",
            "maxLength": 2000,
            "description": "Short description (max 2,000 characters)."
          },
          "longDescription": {
            "type": "string",
            "description": "Long description (HTML or plain text)."
          },
          "externalId": {
            "type": "string",
            "description": "Id of the product in your system."
          },
          "externalUrl": {
            "type": "string",
            "description": "URL of the product in your store."
          },
          "images": {
            "type": "array",
            "maxItems": 30,
            "description": "Up to 30 images, only one with `isMain: true`.",
            "items": {
              "$ref": "#/components/schemas/Image"
            }
          },
          "videos": {
            "type": "array",
            "maxItems": 5,
            "description": "Up to 5 videos.",
            "items": {
              "$ref": "#/components/schemas/Media"
            }
          },
          "pdfs": {
            "type": "array",
            "maxItems": 3,
            "description": "Up to 3 PDFs (brochures, spec sheets).",
            "items": {
              "$ref": "#/components/schemas/Media"
            }
          },
          "hasStock": {
            "type": "boolean",
            "description": "Whether the product is available. Storefront searches only return products with `hasStock: true`. Default `true`."
          },
          "stock": {
            "type": "number",
            "description": "Units available."
          },
          "option1": {
            "type": "string",
            "description": "Name of the first variant axis (e.g. `Talla`)."
          },
          "option1Values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Values of the first axis."
          },
          "option2": {
            "type": "string",
            "description": "Name of the second variant axis."
          },
          "option2Values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Values of the second axis."
          },
          "option3": {
            "type": "string",
            "description": "Name of the third variant axis."
          },
          "option3Values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Values of the third axis."
          },
          "size": {
            "type": "string",
            "description": "Size (filterable)."
          },
          "color": {
            "type": "string",
            "description": "Color (filterable)."
          },
          "year": {
            "type": "number",
            "description": "Year, e.g. model year (filterable)."
          },
          "published": {
            "type": "boolean",
            "description": "Whether the product is published. Default `true`."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive",
              "deleted"
            ],
            "description": "Lifecycle status. `inactive` = archived. Changing it on update also applies it to all the product's variants. Default `active`."
          },
          "priority": {
            "type": "number",
            "description": "Ranking boost in search results (higher first). Default 0."
          },
          "extendedData": {
            "type": "array",
            "description": "Custom fields of the product.",
            "items": {
              "$ref": "#/components/schemas/ExtendedField"
            }
          },
          "promotions": {
            "type": "string",
            "maxLength": 200,
            "description": "Current promotions in plain text (truncated to 200 characters)."
          },
          "financialProposal": {
            "type": "string",
            "description": "Financing options in plain text."
          },
          "offers": {
            "type": "array",
            "description": "Price offers used by Biky to quote.",
            "items": {
              "$ref": "#/components/schemas/Offer"
            }
          },
          "externalCollectionId": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ids of the external collections (e.g. Shopify) the product belongs to, filled by catalog sync."
          },
          "isImported": {
            "type": "boolean",
            "description": "Whether the product came from an import or sync."
          },
          "importedFrom": {
            "type": "string",
            "description": "Import source (`csv`, `xlsx`, `shopify`, `woocommerce`, `vtex`, ...)."
          },
          "brandLogoUrl": {
            "type": "string",
            "description": "Logo of the product brand. Only added by the search endpoints, when known."
          },
          "createdBy": {
            "type": "object",
            "description": "User that created the product.",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          },
          "updatedBy": {
            "type": "object",
            "description": "User that last updated the product, with the history of changed fields.",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Creation date."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last update date."
          }
        }
      },
      "VariantInput": {
        "type": "object",
        "description": "Writable fields of a variant.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Variant name."
          },
          "sku": {
            "type": "string",
            "description": "Variant SKU."
          },
          "price": {
            "type": "number",
            "description": "Variant price."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code of `price`."
          },
          "description": {
            "type": "string",
            "description": "Variant description."
          },
          "option1": {
            "type": "string",
            "description": "Name of the first axis (e.g. `Talla`)."
          },
          "option1Value": {
            "type": "string",
            "description": "Value of the first axis (e.g. `39`)."
          },
          "option2": {
            "type": "string",
            "description": "Name of the second axis."
          },
          "option2Value": {
            "type": "string",
            "description": "Value of the second axis."
          },
          "option3": {
            "type": "string",
            "description": "Name of the third axis."
          },
          "option3Value": {
            "type": "string",
            "description": "Value of the third axis."
          },
          "colors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Colors available for this variant. The array sent replaces the stored one."
          },
          "size": {
            "type": "string",
            "description": "Size."
          },
          "year": {
            "type": "string",
            "description": "Year."
          },
          "images": {
            "type": "array",
            "maxItems": 30,
            "description": "Up to 30 images, only one with `isMain: true`.",
            "items": {
              "$ref": "#/components/schemas/Image"
            }
          },
          "videos": {
            "type": "array",
            "maxItems": 5,
            "description": "Up to 5 videos.",
            "items": {
              "$ref": "#/components/schemas/Media"
            }
          },
          "pdfs": {
            "type": "array",
            "maxItems": 3,
            "description": "Up to 3 PDFs.",
            "items": {
              "$ref": "#/components/schemas/Media"
            }
          },
          "hasStock": {
            "type": "boolean",
            "description": "Whether the variant is available."
          },
          "stock": {
            "type": "number",
            "description": "Units available."
          },
          "published": {
            "type": "boolean",
            "description": "Whether the variant is published (always `true` on create)."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive",
              "deleted"
            ],
            "description": "Lifecycle status. Default `active`."
          },
          "externalId": {
            "type": "string",
            "description": "Id of the variant in your system."
          },
          "externalItemId": {
            "type": "string",
            "description": "Id of the parent product in your system."
          },
          "externalUrl": {
            "type": "string",
            "description": "URL of the variant in your store."
          },
          "extendedData": {
            "type": "array",
            "description": "Custom fields of the variant.",
            "items": {
              "$ref": "#/components/schemas/ExtendedField"
            }
          },
          "promotions": {
            "type": "string",
            "description": "Current promotions in plain text."
          },
          "financialProposal": {
            "type": "string",
            "description": "Financing options in plain text."
          },
          "offers": {
            "type": "array",
            "description": "Price offers of the variant.",
            "items": {
              "$ref": "#/components/schemas/Offer"
            }
          }
        }
      },
      "Variant": {
        "type": "object",
        "description": "A variant of a product (e.g. one size/color combination).",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Variant id."
          },
          "appUUID": {
            "type": "string",
            "description": "App the variant belongs to."
          },
          "itemId": {
            "type": "string",
            "description": "Id of the parent product."
          },
          "name": {
            "type": "string",
            "description": "Variant name."
          },
          "sku": {
            "type": "string",
            "description": "Variant SKU."
          },
          "price": {
            "type": "number",
            "description": "Variant price."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code of `price`."
          },
          "description": {
            "type": "string",
            "description": "Variant description."
          },
          "option1": {
            "type": "string",
            "description": "Name of the first axis (e.g. `Talla`)."
          },
          "option1Value": {
            "type": "string",
            "description": "Value of the first axis (e.g. `39`)."
          },
          "option2": {
            "type": "string",
            "description": "Name of the second axis."
          },
          "option2Value": {
            "type": "string",
            "description": "Value of the second axis."
          },
          "option3": {
            "type": "string",
            "description": "Name of the third axis."
          },
          "option3Value": {
            "type": "string",
            "description": "Value of the third axis."
          },
          "colors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Colors available for this variant. The array sent replaces the stored one."
          },
          "size": {
            "type": "string",
            "description": "Size."
          },
          "year": {
            "type": "string",
            "description": "Year."
          },
          "images": {
            "type": "array",
            "maxItems": 30,
            "description": "Up to 30 images, only one with `isMain: true`.",
            "items": {
              "$ref": "#/components/schemas/Image"
            }
          },
          "videos": {
            "type": "array",
            "maxItems": 5,
            "description": "Up to 5 videos.",
            "items": {
              "$ref": "#/components/schemas/Media"
            }
          },
          "pdfs": {
            "type": "array",
            "maxItems": 3,
            "description": "Up to 3 PDFs.",
            "items": {
              "$ref": "#/components/schemas/Media"
            }
          },
          "hasStock": {
            "type": "boolean",
            "description": "Whether the variant is available."
          },
          "stock": {
            "type": "number",
            "description": "Units available."
          },
          "published": {
            "type": "boolean",
            "description": "Whether the variant is published (always `true` on create)."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive",
              "deleted"
            ],
            "description": "Lifecycle status. Default `active`."
          },
          "externalId": {
            "type": "string",
            "description": "Id of the variant in your system."
          },
          "externalItemId": {
            "type": "string",
            "description": "Id of the parent product in your system."
          },
          "externalUrl": {
            "type": "string",
            "description": "URL of the variant in your store."
          },
          "extendedData": {
            "type": "array",
            "description": "Custom fields of the variant.",
            "items": {
              "$ref": "#/components/schemas/ExtendedField"
            }
          },
          "promotions": {
            "type": "string",
            "description": "Current promotions in plain text."
          },
          "financialProposal": {
            "type": "string",
            "description": "Financing options in plain text."
          },
          "offers": {
            "type": "array",
            "description": "Price offers of the variant.",
            "items": {
              "$ref": "#/components/schemas/Offer"
            }
          },
          "deletedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Deletion date (soft-deleted variants)."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Creation date."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last update date."
          }
        }
      },
      "Subcategory": {
        "type": "object",
        "description": "A subcategory of the app.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Subcategory id."
          },
          "appUUID": {
            "type": "string",
            "description": "App the subcategory belongs to."
          },
          "name": {
            "type": "string",
            "description": "Subcategory name, unique per app."
          },
          "image": {
            "type": "string",
            "description": "Image URL."
          },
          "externalId": {
            "type": "string",
            "description": "Id in the external store (synced catalogs)."
          },
          "isImported": {
            "type": "boolean",
            "description": "Whether it came from a catalog sync."
          },
          "deletedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Deletion date (soft delete)."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Creation date."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last update date."
          }
        }
      },
      "Category": {
        "type": "object",
        "description": "A product category of the app. Products reference categories by `name`.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Category id."
          },
          "appUUID": {
            "type": "string",
            "description": "App the category belongs to."
          },
          "name": {
            "type": "string",
            "description": "Category name, unique per app."
          },
          "image": {
            "type": "string",
            "description": "Image URL."
          },
          "subCategories": {
            "type": "array",
            "description": "Subcategories linked to the category: full objects in listings (deleted ones excluded), plain ids in create/delete responses.",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/Subcategory"
                },
                {
                  "type": "string"
                }
              ]
            }
          },
          "externalId": {
            "type": "string",
            "description": "Id in the external store (synced catalogs)."
          },
          "isImported": {
            "type": "boolean",
            "description": "Whether it came from a catalog sync."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Creation date."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last update date."
          }
        }
      },
      "ProductPage": {
        "type": "object",
        "description": "A page of products.",
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Product"
            },
            "description": "Products of the page."
          },
          "pagination": {
            "$ref": "#/components/schemas/PagePagination"
          }
        }
      },
      "VariantPage": {
        "type": "object",
        "description": "A page of variants.",
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Variant"
            },
            "description": "Variants of the page."
          },
          "pagination": {
            "$ref": "#/components/schemas/PagePagination"
          }
        }
      },
      "ProductFilterBody": {
        "type": "object",
        "description": "Filters for `POST /v2/items/{appUUID}/filters`. All fields are optional.",
        "properties": {
          "page": {
            "type": "string",
            "description": "Page number, 0-based. Default `0`."
          },
          "limit": {
            "type": "string",
            "description": "Page size. Default `10`."
          },
          "name": {
            "type": "string",
            "description": "Text contained in the name (case- and accent-insensitive)."
          },
          "category": {
            "type": "string",
            "description": "Exact category name contained in `categories`."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive",
              "deleted"
            ],
            "description": "Status to list. Default `active`."
          },
          "sku": {
            "type": "string",
            "description": "SKU prefix (case-insensitive)."
          },
          "size": {
            "type": "string",
            "description": "Size prefix (case-insensitive)."
          },
          "color": {
            "type": "string",
            "description": "Color prefix (case-insensitive)."
          },
          "year": {
            "type": "string",
            "description": "Four-digit year."
          },
          "collectionId": {
            "type": "string",
            "description": "External collection id (synced catalogs)."
          },
          "sortByFields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Fields to sort by. Default `[\"createdAt\"]`."
          },
          "sortByOrder": {
            "type": "array",
            "items": {
              "type": "integer",
              "enum": [
                1,
                -1
              ]
            },
            "description": "Order of each field in `sortByFields`: `1` ascending, `-1` descending."
          },
          "compareFields": {
            "type": "object",
            "description": "Extra conditions on any product field. Each element is `{ \"<field>\": <value> }`: a string or number value is a case-insensitive prefix match; an object value accepts the operators `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$in`, `$nin` (others are ignored).",
            "properties": {
              "and": {
                "type": "array",
                "items": {
                  "type": "object"
                },
                "description": "All conditions must match."
              },
              "or": {
                "type": "array",
                "items": {
                  "type": "object"
                },
                "description": "At least one condition must match."
              }
            }
          }
        }
      },
      "BatchItemIds": {
        "type": "object",
        "required": [
          "itemIds"
        ],
        "properties": {
          "itemIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "string"
            },
            "description": "Ids of the products (1 to 100). All must belong to `{appUUID}`."
          }
        }
      },
      "BulkWriteResult": {
        "type": "object",
        "description": "MongoDB bulk-write summary.",
        "properties": {
          "matchedCount": {
            "type": "integer",
            "description": "Documents matched."
          },
          "modifiedCount": {
            "type": "integer",
            "description": "Documents modified."
          },
          "upsertedCount": {
            "type": "integer",
            "description": "Always 0."
          },
          "insertedCount": {
            "type": "integer",
            "description": "Always 0."
          },
          "deletedCount": {
            "type": "integer",
            "description": "Always 0."
          }
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing, invalid, expired or revoked credential (rejected by the API gateway).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/GatewayError"
            },
            "example": {
              "message": "Unauthorized"
            }
          }
        }
      },
      "Forbidden": {
        "description": "The route does not exist on this host (`Missing Authentication Token`), or the owner of the credential is not a member of the account in the path.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/GatewayError"
            },
            "example": {
              "message": "No tiene permiso para esta app app_7f3k2m9x1q",
              "error": "Forbidden",
              "statusCode": 403
            }
          }
        }
      },
      "BadRequest": {
        "description": "The payload breaks a catalog limit (media count, description length, more than one cover image) or has invalid `sources`. `errors` lists each problem.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiResponse"
            },
            "example": {
              "status": "ERROR",
              "message": "Validation failed",
              "data": null,
              "statusCode": 400,
              "errors": [
                {
                  "code": "ITEM_MULTIPLE_MAIN_IMAGES",
                  "message": "Product can only have one main image. Maximum: 1, received: 2",
                  "translationKey": "errors.catalog.item_multiple_main_images",
                  "limit": 1,
                  "received": 2
                }
              ]
            }
          }
        }
      }
    }
  }
}
