{
  "openapi": "3.1.0",
  "info": {
    "title": "EZ Catalog API",
    "version": "1",
    "description": "Product catalog REST API for Argentina and global markets: lookup by barcode (EAN-13, UPC-12, ISBN-10/13), full-text search, batch lookups, brands, product families, categories, images, and community edit proposals."
  },
  "servers": [
    {
      "url": "https://api.ez-catalog.huggian.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Health"
    },
    {
      "name": "Products"
    },
    {
      "name": "Brands"
    },
    {
      "name": "Families"
    },
    {
      "name": "Categories"
    },
    {
      "name": "Images"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Unauthenticated liveness probe.",
        "security": [],
        "responses": {
          "200": {
            "description": "Service is up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                },
                "example": {
                  "ok": true
                }
              }
            }
          }
        }
      }
    },
    "/v1/products/barcode/{ean}": {
      "get": {
        "tags": [
          "Products"
        ],
        "summary": "Look up a product by barcode (EAN-13, UPC-12, ISBN-10/13).",
        "description": "Looks up the product in cache/database and fans out to 87 external providers on cache miss.",
        "x-required-scope": "catalog:products:read",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "ean",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "7790895000997",
            "description": "EAN-13, UPC-12, or ISBN-10/13 barcode."
          }
        ],
        "responses": {
          "200": {
            "description": "Matching product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                },
                "example": {
                  "id": "8a3e1d60-1c4f-4d1c-9e2a-2b5c6d7e8f90",
                  "barcode": "7790895000997",
                  "barcode_type": "EAN13",
                  "name": "Yerba Mate Taragüi 500g",
                  "description": null,
                  "category_id": "ab12cd34-5678-4abc-9def-0123456789ab",
                  "category": "almacen-infusiones",
                  "brand": "Taragüi",
                  "brand_id": "f1c2d3e4-5678-4abc-9def-0123456789ab",
                  "image_url": "https://images.huggian.com/products/7790895000997.jpg",
                  "ncm_code": "0903.00.10",
                  "afip_category": null,
                  "country_of_origin": "AR",
                  "verified": true,
                  "source": "manual",
                  "presentation": "500g",
                  "subcategory": null,
                  "unit_of_measure": "g",
                  "family_id": "c9d0e1f2-5678-4abc-9def-0123456789ab",
                  "product_type": "good",
                  "attributes": null,
                  "created_at": "2026-01-12T10:00:00Z",
                  "updated_at": "2026-04-30T09:00:00Z"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/products/by-barcodes": {
      "post": {
        "tags": [
          "Products"
        ],
        "summary": "Batch lookup products by up to 500 barcodes.",
        "description": "Returns an array of found products. Unknown barcodes are omitted from the result.",
        "x-required-scope": "catalog:products:read",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ByBarcodesRequest"
              },
              "example": {
                "barcodes": [
                  "7790895000997",
                  "7790040119000"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Found products",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Product"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/products/by-ids": {
      "post": {
        "tags": [
          "Products"
        ],
        "summary": "Batch lookup products by up to 500 UUIDs.",
        "x-required-scope": "catalog:products:read",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ByIdsRequest"
              },
              "example": {
                "ids": [
                  "8a3e1d60-1c4f-4d1c-9e2a-2b5c6d7e8f90"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Found products",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Product"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/products/search": {
      "get": {
        "tags": [
          "Products"
        ],
        "summary": "Full-text product search with filters and pagination.",
        "x-required-scope": "catalog:products:read",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Free-text search query."
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Filter by category UUID."
          },
          {
            "name": "brand",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Filter by brand UUID."
          },
          {
            "name": "family",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Filter by product family UUID."
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            },
            "description": "1-based page number."
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "Page size (1..100)."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated search results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResult"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/products": {
      "post": {
        "tags": [
          "Products"
        ],
        "summary": "Create a product (Basic and Pro plans).",
        "x-required-scope": "catalog:products:write",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProductRequest"
              },
              "example": {
                "barcode": "7790895000997",
                "barcode_type": "EAN13",
                "name": "Yerba Mate Taragüi 500g",
                "brand": "Taragüi",
                "country_of_origin": "AR",
                "presentation": "500g",
                "unit_of_measure": "g",
                "product_type": "good"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/products/{id}": {
      "get": {
        "tags": [
          "Products"
        ],
        "summary": "Get a product by UUID.",
        "x-required-scope": "catalog:products:read",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      },
      "put": {
        "tags": [
          "Products"
        ],
        "summary": "Partially update a product (Basic and Pro plans).",
        "x-required-scope": "catalog:products:write",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProductRequest"
              },
              "example": {
                "name": "Yerba Mate Taragüi 500g Sin Palo",
                "verified": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      },
      "delete": {
        "tags": [
          "Products"
        ],
        "summary": "Delete a product (Pro plan).",
        "x-required-scope": "catalog:products:delete",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/products/{id}/propose-edit": {
      "post": {
        "tags": [
          "Products"
        ],
        "summary": "Propose a field correction for referee review (available on all plans, including Free).",
        "description": "Records a pending edit proposal for the `name` or `category` field of an existing product. Idempotent while the same proposal is still pending.",
        "x-required-scope": "catalog:proposals:write",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProposeEditRequest"
              },
              "example": {
                "field": "name",
                "value": "Yerba Mate Taragüi Clásica 500g",
                "proposer_id": "tenant-123"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Proposal accepted for review",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProposeEditResponse"
                },
                "example": {
                  "id": "a1b2c3d4-5678-4abc-9def-0123456789ab",
                  "status": "pending"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/brands": {
      "get": {
        "tags": [
          "Brands"
        ],
        "summary": "List all brands.",
        "x-required-scope": "catalog:products:read",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Brands",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Brand"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      },
      "post": {
        "tags": [
          "Brands"
        ],
        "summary": "Create a brand (normalizes accents, case, and corporate suffixes).",
        "x-required-scope": "catalog:products:write",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBrandRequest"
              },
              "example": {
                "name": "La Serenísima",
                "logo_url": null
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created brand",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Brand"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/brands/{id}": {
      "get": {
        "tags": [
          "Brands"
        ],
        "summary": "Get a brand by UUID including its linked product count.",
        "x-required-scope": "catalog:products:read",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Brand with product count",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandWithCount"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/families": {
      "get": {
        "tags": [
          "Families"
        ],
        "summary": "List product families (SKU size/pack variants), optionally filtered by brand.",
        "x-required-scope": "catalog:products:read",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "brand",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Optional brand UUID filter."
          }
        ],
        "responses": {
          "200": {
            "description": "Product families",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ProductFamily"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/families/{id}": {
      "get": {
        "tags": [
          "Families"
        ],
        "summary": "Get a product family by UUID with its variant products.",
        "x-required-scope": "catalog:products:read",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product family with variants",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FamilyWithVariants"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/categories": {
      "get": {
        "tags": [
          "Categories"
        ],
        "summary": "List all catalog categories (hierarchical tree via parent_id).",
        "x-required-scope": "catalog:products:read",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Categories",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Category"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/v1/products/{ean}/images": {
      "get": {
        "tags": [
          "Images"
        ],
        "summary": "List stored images for a barcode.",
        "x-required-scope": "catalog:products:read",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "ean",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "7790895000997"
          }
        ],
        "responses": {
          "200": {
            "description": "Images for the barcode",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductImageListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        }
      },
      "post": {
        "tags": [
          "Images"
        ],
        "summary": "Upload a product image as raw image/* bytes (Basic and Pro plans).",
        "description": "Send the raw encoded JPEG, PNG, or WebP bytes in the request body with an `image/*` Content-Type header (not multipart/form-data).",
        "x-required-scope": "catalog:images:write",
        "security": [
          {
            "ApiKey": []
          }
        ],
        "parameters": [
          {
            "name": "ean",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "7790895000997"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/webp": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored image metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductImage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "415": {
            "$ref": "#/components/responses/E415"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "502": {
            "$ref": "#/components/responses/E502"
          },
          "503": {
            "$ref": "#/components/responses/E503"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "API key issued for Free, Basic, or Pro catalog plans."
      }
    },
    "responses": {
      "E400": {
        "description": "Bad request (error: BAD_REQUEST)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "E401": {
        "description": "Missing or invalid X-Api-Key (error: UNAUTHORIZED)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "E403": {
        "description": "Valid key without required scope/plan (error: FORBIDDEN)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "E404": {
        "description": "Resource not found (error: NOT_FOUND)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "E409": {
        "description": "Duplicate barcode or normalized brand (error: CONFLICT)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "E413": {
        "description": "Payload exceeds maximum allowed size (error: PAYLOAD_TOO_LARGE)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "E415": {
        "description": "Unsupported media type; expected image/* (error: UNSUPPORTED_MEDIA_TYPE)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "E422": {
        "description": "Unprocessable entity (error: UNPROCESSABLE_ENTITY)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "E429": {
        "description": "Per-minute rate limit (RATE_LIMIT_EXCEEDED with Retry-After and X-RateLimit-* headers) or monthly quota exhausted (MONTHLY_QUOTA_EXCEEDED with limit and used fields)",
        "content": {
          "application/json": {
            "schema": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                {
                  "$ref": "#/components/schemas/MonthlyQuotaErrorResponse"
                }
              ]
            }
          }
        }
      },
      "E500": {
        "description": "Internal server error (error: INTERNAL_ERROR)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "E502": {
        "description": "Upstream provider or storage failure (error: UPSTREAM_ERROR)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "E503": {
        "description": "Service unavailable (error: SERVICE_UNAVAILABLE)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "HealthResponse": {
        "type": "object",
        "required": [
          "ok"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "BAD_REQUEST",
              "UNAUTHORIZED",
              "FORBIDDEN",
              "NOT_FOUND",
              "CONFLICT",
              "PAYLOAD_TOO_LARGE",
              "UNSUPPORTED_MEDIA_TYPE",
              "UNPROCESSABLE_ENTITY",
              "RATE_LIMIT_EXCEEDED",
              "MONTHLY_QUOTA_EXCEEDED",
              "INTERNAL_ERROR",
              "UPSTREAM_ERROR",
              "SERVICE_UNAVAILABLE"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "MonthlyQuotaErrorResponse": {
        "type": "object",
        "required": [
          "error",
          "message",
          "limit",
          "used"
        ],
        "properties": {
          "error": {
            "type": "string",
            "const": "MONTHLY_QUOTA_EXCEEDED"
          },
          "message": {
            "type": "string"
          },
          "limit": {
            "type": "integer"
          },
          "used": {
            "type": "integer"
          }
        }
      },
      "Product": {
        "type": "object",
        "required": [
          "id",
          "barcode_type",
          "name",
          "country_of_origin",
          "verified",
          "source",
          "product_type",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "barcode_type": {
            "type": "string",
            "description": "EAN13, EAN8, UPC, ISBN13, etc."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "category_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "description": "Category slug joined from category_id."
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "brand_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "image_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "ncm_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "afip_category": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_of_origin": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code."
          },
          "verified": {
            "type": "boolean"
          },
          "source": {
            "type": "string"
          },
          "presentation": {
            "type": [
              "string",
              "null"
            ]
          },
          "subcategory": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_of_measure": {
            "type": [
              "string",
              "null"
            ]
          },
          "family_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "product_type": {
            "type": "string",
            "description": "good or service"
          },
          "attributes": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateProductRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "barcode_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "category_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "brand_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "image_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "ncm_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "afip_category": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_of_origin": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "presentation": {
            "type": [
              "string",
              "null"
            ]
          },
          "subcategory": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_of_measure": {
            "type": [
              "string",
              "null"
            ]
          },
          "product_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "attributes": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        }
      },
      "UpdateProductRequest": {
        "type": "object",
        "properties": {
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "barcode_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "category_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "brand": {
            "type": [
              "string",
              "null"
            ]
          },
          "brand_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "image_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "ncm_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "afip_category": {
            "type": [
              "string",
              "null"
            ]
          },
          "country_of_origin": {
            "type": [
              "string",
              "null"
            ]
          },
          "verified": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "source": {
            "type": [
              "string",
              "null"
            ]
          },
          "presentation": {
            "type": [
              "string",
              "null"
            ]
          },
          "subcategory": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit_of_measure": {
            "type": [
              "string",
              "null"
            ]
          },
          "product_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "attributes": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        }
      },
      "SearchResult": {
        "type": "object",
        "required": [
          "items",
          "total",
          "page",
          "per_page"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Product"
            }
          },
          "total": {
            "type": "integer"
          },
          "page": {
            "type": "integer"
          },
          "per_page": {
            "type": "integer"
          }
        }
      },
      "ByBarcodesRequest": {
        "type": "object",
        "required": [
          "barcodes"
        ],
        "properties": {
          "barcodes": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ByIdsRequest": {
        "type": "object",
        "required": [
          "ids"
        ],
        "properties": {
          "ids": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "ProposeEditRequest": {
        "type": "object",
        "required": [
          "field",
          "value",
          "proposer_id"
        ],
        "properties": {
          "field": {
            "type": "string",
            "enum": [
              "name",
              "category"
            ]
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "proposer_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        }
      },
      "ProposeEditResponse": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "Brand": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "logo_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BrandWithCount": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug",
          "created_at",
          "product_count"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "logo_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "product_count": {
            "type": "integer"
          }
        }
      },
      "CreateBrandRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "logo_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          }
        }
      },
      "ProductFamily": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "brand_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FamilyWithVariants": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug",
          "created_at",
          "variants"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "brand_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Product"
            }
          }
        }
      },
      "Category": {
        "type": "object",
        "required": [
          "id",
          "slug",
          "name",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "parent_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProductImage": {
        "type": "object",
        "required": [
          "id",
          "ean",
          "url",
          "source",
          "width",
          "height",
          "bytes",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "ean": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "source": {
            "type": "string"
          },
          "width": {
            "type": "integer"
          },
          "height": {
            "type": "integer"
          },
          "bytes": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProductImageListResponse": {
        "type": "object",
        "required": [
          "ean",
          "images"
        ],
        "properties": {
          "ean": {
            "type": "string"
          },
          "images": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductImage"
            }
          }
        }
      }
    }
  }
}
