{
    "openapi": "3.1.0",
    "info": {
        "title": "API de Gestión Simple",
        "version": "1.0.0",
        "description": "API REST para integrar clientes, productos, stock, facturas, cobros, pedidos, presupuestos y webhooks.\n\nAutenticación: header `X-Api-Key: fs_live_…` o `Authorization: Bearer fs_live_…`. Cada clave tiene alcances (`recurso:read` / `recurso:write`) y puede tener un límite por minuto. Las claves anteriores a los alcances conservan todos. Errores: `{ok:false, code, message}`. POST de facturas, cobros, productos y ajustes de stock aceptan `Idempotency-Key`."
    },
    "servers": [
        {
            "url": "https://apps.rayocreativo.com/api",
            "description": "Producción"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        },
        {
            "apiKey": []
        }
    ],
    "tags": [
        {
            "name": "Conexión"
        },
        {
            "name": "Clientes"
        },
        {
            "name": "Productos"
        },
        {
            "name": "Facturas"
        },
        {
            "name": "Cobros"
        },
        {
            "name": "Pedidos"
        },
        {
            "name": "Stock"
        },
        {
            "name": "Presupuestos"
        },
        {
            "name": "CRM"
        },
        {
            "name": "Webhooks"
        },
        {
            "name": "MCP"
        }
    ],
    "paths": {
        "/presupuestos/v1/budgets": {
            "post": {
                "tags": [
                    "Presupuestos"
                ],
                "summary": "Crea un presupuesto (client_id o client + items).",
                "operationId": "post_presupuestos_v1_budgets",
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Si repetís el pedido con la misma clave (24 h) recibís la misma respuesta (header Idempotent-Replayed: true) sin duplicar nada.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/BudgetInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "budgets:write"
                ],
                "description": "Alcance requerido: `budgets:write`."
            },
            "get": {
                "tags": [
                    "Presupuestos"
                ],
                "summary": "Lista presupuestos.",
                "operationId": "get_presupuestos_v1_budgets",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Estado.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": false,
                        "description": "Cliente.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since",
                        "in": "query",
                        "required": false,
                        "description": "Creados desde.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Número o título.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "budgets:read"
                ],
                "description": "Alcance requerido: `budgets:read`."
            }
        },
        "/presupuestos/v1/budgets/{budget}": {
            "get": {
                "tags": [
                    "Presupuestos"
                ],
                "summary": "Obtiene un presupuesto con sus ítems.",
                "operationId": "get_presupuestos_v1_budgets_budget",
                "parameters": [
                    {
                        "name": "budget",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "budgets:read"
                ],
                "description": "Alcance requerido: `budgets:read`."
            }
        },
        "/presupuestos/v1/clients": {
            "post": {
                "tags": [
                    "Presupuestos"
                ],
                "summary": "Crea o vincula un cliente de Presupuestos.",
                "operationId": "post_presupuestos_v1_clients",
                "parameters": [],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "clients:write"
                ],
                "description": "Alcance requerido: `clients:write`."
            }
        },
        "/v1/budgets.php": {
            "post": {
                "tags": [
                    "Presupuestos"
                ],
                "summary": "Alias de compatibilidad de /presupuestos/v1/budgets.",
                "operationId": "post_v1_budgets_php",
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Si repetís el pedido con la misma clave (24 h) recibís la misma respuesta (header Idempotent-Replayed: true) sin duplicar nada.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/BudgetInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "budgets:write"
                ],
                "description": "Alcance requerido: `budgets:write`."
            }
        },
        "/v1/clients.php": {
            "post": {
                "tags": [
                    "Presupuestos"
                ],
                "summary": "Alias de compatibilidad de /presupuestos/v1/clients.",
                "operationId": "post_v1_clients_php",
                "parameters": [],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "clients:write"
                ],
                "description": "Alcance requerido: `clients:write`."
            }
        },
        "/v1/{slug}/catalog/categories": {
            "get": {
                "tags": [
                    "Productos"
                ],
                "summary": "Lista las categorías de productos (con su categoría padre).",
                "operationId": "get_v1_slug_catalog_categories",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "parent_id",
                        "in": "query",
                        "required": false,
                        "description": "Solo las hijas de esta categoría.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "active",
                        "in": "query",
                        "required": false,
                        "description": "true/false.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "products:read"
                ],
                "description": "Alcance requerido: `products:read`."
            }
        },
        "/v1/{slug}/catalog/products": {
            "get": {
                "tags": [
                    "Productos"
                ],
                "summary": "Lista productos del catálogo de Gestión con precio, variantes y stock.",
                "operationId": "get_v1_slug_catalog_products",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Nombre o SKU.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "sku",
                        "in": "query",
                        "required": false,
                        "description": "SKU exacto.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "category_id",
                        "in": "query",
                        "required": false,
                        "description": "Categoría.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "active",
                        "in": "query",
                        "required": false,
                        "description": "true/false.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Fecha ISO 8601.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProductList"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "products:read"
                ],
                "description": "Alcance requerido: `products:read`."
            },
            "post": {
                "tags": [
                    "Productos"
                ],
                "summary": "Crea un producto (simple o con variantes) con su precio. Un SKU repetido da 422 duplicate_sku.",
                "operationId": "post_v1_slug_catalog_products",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Si repetís el pedido con la misma clave (24 h) recibís la misma respuesta (header Idempotent-Replayed: true) sin duplicar nada.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProductOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ProductInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "products:write"
                ],
                "description": "Alcance requerido: `products:write`."
            }
        },
        "/v1/{slug}/catalog/products/{product}": {
            "get": {
                "tags": [
                    "Productos"
                ],
                "summary": "Obtiene un producto con sus variantes.",
                "operationId": "get_v1_slug_catalog_products_product",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "product",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProductOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "products:read"
                ],
                "description": "Alcance requerido: `products:read`."
            },
            "put": {
                "tags": [
                    "Productos"
                ],
                "summary": "Edita un producto; si enviás «variations» se sincronizan (las que no vengan se quitan o archivan si tienen ventas).",
                "operationId": "put_v1_slug_catalog_products_product",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "product",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProductOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ProductInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "products:write"
                ],
                "description": "Alcance requerido: `products:write`."
            },
            "patch": {
                "tags": [
                    "Productos"
                ],
                "summary": "Edita un producto; si enviás «variations» se sincronizan (las que no vengan se quitan o archivan si tienen ventas).",
                "operationId": "patch_v1_slug_catalog_products_product",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "product",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProductOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ProductInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "products:write"
                ],
                "description": "Alcance requerido: `products:write`."
            },
            "delete": {
                "tags": [
                    "Productos"
                ],
                "summary": "Da de baja un producto. Con ventas o pedidos no se borra: se desactiva y se oculta (deactivated=true).",
                "operationId": "delete_v1_slug_catalog_products_product",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "product",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "products:write"
                ],
                "description": "Alcance requerido: `products:write`."
            }
        },
        "/v1/{slug}/clients": {
            "get": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Lista clientes.",
                "operationId": "get_v1_slug_clients",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Texto: nombre, email, CUIT o documento.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "email",
                        "in": "query",
                        "required": false,
                        "description": "Email exacto.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "cuit",
                        "in": "query",
                        "required": false,
                        "description": "CUIT exacto.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Estado del cliente.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Solo modificados desde esta fecha (ISO 8601).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ClientList"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "clients:read"
                ],
                "description": "Alcance requerido: `clients:read`."
            },
            "post": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Crea un cliente o lo vincula si ya existe (mismo CUIT o email).",
                "operationId": "post_v1_slug_clients",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ClientOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ClientInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "clients:write"
                ],
                "description": "Alcance requerido: `clients:write`."
            }
        },
        "/v1/{slug}/clients/{client}": {
            "get": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Obtiene un cliente.",
                "operationId": "get_v1_slug_clients_client",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ClientOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "clients:read"
                ],
                "description": "Alcance requerido: `clients:read`."
            },
            "put": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Edita un cliente (solo cambia los campos enviados). El CUIT/DNI no se cambian por API.",
                "operationId": "put_v1_slug_clients_client",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ClientOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ClientUpdate"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "clients:write"
                ],
                "description": "Alcance requerido: `clients:write`."
            },
            "patch": {
                "tags": [
                    "Clientes"
                ],
                "summary": "Edita un cliente (solo cambia los campos enviados). El CUIT/DNI no se cambian por API.",
                "operationId": "patch_v1_slug_clients_client",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ClientOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ClientUpdate"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "clients:write"
                ],
                "description": "Alcance requerido: `clients:write`."
            }
        },
        "/v1/{slug}/credit-notes": {
            "post": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Emite una nota de crédito indicando invoice_id o external_id.",
                "operationId": "post_v1_slug_credit_notes",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Si repetís el pedido con la misma clave (24 h) recibís la misma respuesta (header Idempotent-Replayed: true) sin duplicar nada.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreditNoteInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "invoices:write"
                ],
                "description": "Alcance requerido: `invoices:write`."
            }
        },
        "/v1/{slug}/crm/activities": {
            "get": {
                "tags": [
                    "CRM"
                ],
                "summary": "Lista actividades.",
                "operationId": "get_v1_slug_crm_activities",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "crm:read"
                ],
                "description": "Alcance requerido: `crm:read`."
            },
            "post": {
                "tags": [
                    "CRM"
                ],
                "summary": "Crea una actividad.",
                "operationId": "post_v1_slug_crm_activities",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "crm:write"
                ],
                "description": "Alcance requerido: `crm:write`."
            }
        },
        "/v1/{slug}/crm/deals": {
            "get": {
                "tags": [
                    "CRM"
                ],
                "summary": "Lista oportunidades.",
                "operationId": "get_v1_slug_crm_deals",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Estado.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "crm:read"
                ],
                "description": "Alcance requerido: `crm:read`."
            },
            "post": {
                "tags": [
                    "CRM"
                ],
                "summary": "Crea una oportunidad.",
                "operationId": "post_v1_slug_crm_deals",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "crm:write"
                ],
                "description": "Alcance requerido: `crm:write`."
            }
        },
        "/v1/{slug}/crm/deals/{deal}": {
            "get": {
                "tags": [
                    "CRM"
                ],
                "summary": "Obtiene una oportunidad con etapa, cliente, productos y actividades.",
                "operationId": "get_v1_slug_crm_deals_deal",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "deal",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "crm:read"
                ],
                "description": "Alcance requerido: `crm:read`."
            }
        },
        "/v1/{slug}/invoices": {
            "get": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Lista comprobantes.",
                "operationId": "get_v1_slug_invoices",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "unpaid, partial, paid, overdue, cancelled.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": false,
                        "description": "Cliente.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since",
                        "in": "query",
                        "required": false,
                        "description": "Emitidos desde (fecha).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "until",
                        "in": "query",
                        "required": false,
                        "description": "Emitidos hasta (fecha).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "number",
                        "in": "query",
                        "required": false,
                        "description": "Parte del número.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "external_id",
                        "in": "query",
                        "required": false,
                        "description": "Id de tu sistema.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "integration",
                        "in": "query",
                        "required": false,
                        "description": "Nombre de tu integración.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/InvoiceList"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "invoices:read"
                ],
                "description": "Alcance requerido: `invoices:read`."
            },
            "post": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Crea (y por defecto emite) un comprobante. Idempotente con Idempotency-Key o con integration+external_id.",
                "operationId": "post_v1_slug_invoices",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Si repetís el pedido con la misma clave (24 h) recibís la misma respuesta (header Idempotent-Replayed: true) sin duplicar nada.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/InvoiceOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/InvoiceInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "invoices:write"
                ],
                "description": "Alcance requerido: `invoices:write`."
            }
        },
        "/v1/{slug}/invoices/{invoice}": {
            "get": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Obtiene un comprobante con ítems, link de pago y PDF.",
                "operationId": "get_v1_slug_invoices_invoice",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "invoice",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/InvoiceOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "invoices:read"
                ],
                "description": "Alcance requerido: `invoices:read`."
            }
        },
        "/v1/{slug}/invoices/{invoice}/credit-note": {
            "post": {
                "tags": [
                    "Facturas"
                ],
                "summary": "Emite la nota de crédito que anula el comprobante.",
                "operationId": "post_v1_slug_invoices_invoice_credit_note",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "invoice",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Si repetís el pedido con la misma clave (24 h) recibís la misma respuesta (header Idempotent-Replayed: true) sin duplicar nada.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreditNoteInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "invoices:write"
                ],
                "description": "Alcance requerido: `invoices:write`."
            }
        },
        "/v1/{slug}/invoices/{invoice}/payments": {
            "post": {
                "tags": [
                    "Cobros"
                ],
                "summary": "Registra un cobro aplicado a esa factura (no puede superar su saldo).",
                "operationId": "post_v1_slug_invoices_invoice_payments",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "invoice",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Si repetís el pedido con la misma clave (24 h) recibís la misma respuesta (header Idempotent-Replayed: true) sin duplicar nada.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PaymentOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PaymentInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "payments:write"
                ],
                "description": "Alcance requerido: `payments:write`."
            }
        },
        "/v1/{slug}/orders": {
            "get": {
                "tags": [
                    "Pedidos"
                ],
                "summary": "Lista ventas y pedidos.",
                "operationId": "get_v1_slug_orders",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since",
                        "in": "query",
                        "required": false,
                        "description": "Desde (fecha).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "until",
                        "in": "query",
                        "required": false,
                        "description": "Hasta (fecha).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "pending, active, cancelled.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "source",
                        "in": "query",
                        "required": false,
                        "description": "store, pos, admin, mercadolibre…",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": false,
                        "description": "Cliente.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "orders:read"
                ],
                "description": "Alcance requerido: `orders:read`."
            }
        },
        "/v1/{slug}/orders/{order}": {
            "get": {
                "tags": [
                    "Pedidos"
                ],
                "summary": "Obtiene un pedido o venta con sus ítems y el cliente.",
                "operationId": "get_v1_slug_orders_order",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "order",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "orders:read"
                ],
                "description": "Alcance requerido: `orders:read`."
            }
        },
        "/v1/{slug}/payments": {
            "get": {
                "tags": [
                    "Cobros"
                ],
                "summary": "Lista cobros registrados.",
                "operationId": "get_v1_slug_payments",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "since",
                        "in": "query",
                        "required": false,
                        "description": "Desde (fecha).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "until",
                        "in": "query",
                        "required": false,
                        "description": "Hasta (fecha).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "method",
                        "in": "query",
                        "required": false,
                        "description": "Medio de pago.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_id",
                        "in": "query",
                        "required": false,
                        "description": "Cliente.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "payments:read"
                ],
                "description": "Alcance requerido: `payments:read`."
            },
            "post": {
                "tags": [
                    "Cobros"
                ],
                "summary": "Registra un cobro de un cliente (con invoice_id se aplica a esa factura; sin factura queda a cuenta).",
                "operationId": "post_v1_slug_payments",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Si repetís el pedido con la misma clave (24 h) recibís la misma respuesta (header Idempotent-Replayed: true) sin duplicar nada.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PaymentOne"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PaymentInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "payments:write"
                ],
                "description": "Alcance requerido: `payments:write`."
            }
        },
        "/v1/{slug}/ping": {
            "get": {
                "tags": [
                    "Conexión"
                ],
                "summary": "Verifica la clave y devuelve la empresa, cupo y los alcances de la clave.",
                "operationId": "get_v1_slug_ping",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/{slug}/price-lists": {
            "get": {
                "tags": [
                    "Productos"
                ],
                "summary": "Lista las listas de precios con su regla, moneda y vigencia.",
                "operationId": "get_v1_slug_price_lists",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "active",
                        "in": "query",
                        "required": false,
                        "description": "true/false.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "products:read"
                ],
                "description": "Alcance requerido: `products:read`."
            }
        },
        "/v1/{slug}/products": {
            "get": {
                "tags": [
                    "Productos"
                ],
                "summary": "Catálogo de Facturador (solo lectura, 200 máx.).",
                "operationId": "get_v1_slug_products",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Nombre o código.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "products:read"
                ],
                "description": "Alcance requerido: `products:read`."
            }
        },
        "/v1/{slug}/purchases": {
            "get": {
                "tags": [
                    "Compras"
                ],
                "summary": "Lista comprobantes de compra (facturas de proveedores).",
                "operationId": "get_v1_slug_purchases",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "pending, partial, paid, cancelled.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "supplier_id",
                        "in": "query",
                        "required": false,
                        "description": "Proveedor.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "since",
                        "in": "query",
                        "required": false,
                        "description": "Emitidos desde (fecha).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "until",
                        "in": "query",
                        "required": false,
                        "description": "Emitidos hasta (fecha).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "purchases:read"
                ],
                "description": "Alcance requerido: `purchases:read`."
            }
        },
        "/v1/{slug}/purchases/{purchase}": {
            "get": {
                "tags": [
                    "Compras"
                ],
                "summary": "Obtiene un comprobante de compra con importes, saldo y estado.",
                "operationId": "get_v1_slug_purchases_purchase",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "purchase",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "purchases:read"
                ],
                "description": "Alcance requerido: `purchases:read`."
            }
        },
        "/v1/{slug}/stock/adjust": {
            "post": {
                "tags": [
                    "Stock"
                ],
                "summary": "Ajusta el stock de un producto (delta positivo o negativo), opcionalmente en un depósito.",
                "operationId": "post_v1_slug_stock_adjust",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Si repetís el pedido con la misma clave (24 h) recibís la misma respuesta (header Idempotent-Replayed: true) sin duplicar nada.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/StockAdjustInput"
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "stock:write"
                ],
                "description": "Alcance requerido: `stock:write`."
            }
        },
        "/v1/{slug}/stock/balances": {
            "get": {
                "tags": [
                    "Stock"
                ],
                "summary": "Saldos por producto con detalle por depósito.",
                "operationId": "get_v1_slug_stock_balances",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "sku",
                        "in": "query",
                        "required": false,
                        "description": "SKU exacto.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Nombre o SKU.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "warehouse_id",
                        "in": "query",
                        "required": false,
                        "description": "Limitar a un depósito.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "stock:read"
                ],
                "description": "Alcance requerido: `stock:read`."
            }
        },
        "/v1/{slug}/stock/warehouses": {
            "get": {
                "tags": [
                    "Stock"
                ],
                "summary": "Depósitos activos.",
                "operationId": "get_v1_slug_stock_warehouses",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "stock:read"
                ],
                "description": "Alcance requerido: `stock:read`."
            }
        },
        "/v1/{slug}/suppliers": {
            "get": {
                "tags": [
                    "Compras"
                ],
                "summary": "Lista proveedores.",
                "operationId": "get_v1_slug_suppliers",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Nombre, CUIT o email.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "cuit",
                        "in": "query",
                        "required": false,
                        "description": "CUIT exacto.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "updated_since",
                        "in": "query",
                        "required": false,
                        "description": "Solo modificados desde esta fecha.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "purchases:read"
                ],
                "description": "Alcance requerido: `purchases:read`."
            },
            "post": {
                "tags": [
                    "Compras"
                ],
                "summary": "Crea un proveedor. Si ya existe uno con el mismo CUIT lo devuelve (200) sin duplicarlo.",
                "operationId": "post_v1_slug_suppliers",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "purchases:write"
                ],
                "description": "Alcance requerido: `purchases:write`."
            }
        },
        "/v1/{slug}/suppliers/{supplier}": {
            "get": {
                "tags": [
                    "Compras"
                ],
                "summary": "Obtiene un proveedor.",
                "operationId": "get_v1_slug_suppliers_supplier",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "supplier",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "purchases:read"
                ],
                "description": "Alcance requerido: `purchases:read`."
            }
        },
        "/v1/{slug}/webhooks/deliveries": {
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Entregas recientes.",
                "operationId": "get_v1_slug_webhooks_deliveries",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Número de página (desde 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Resultados por página (máximo 100; «limit» es un alias).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "pending, delivered, failed.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "event",
                        "in": "query",
                        "required": false,
                        "description": "Nombre del evento.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "endpoint_id",
                        "in": "query",
                        "required": false,
                        "description": "Destino.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "webhooks:read"
                ],
                "description": "Alcance requerido: `webhooks:read`."
            }
        },
        "/v1/{slug}/webhooks/deliveries/{uuid}/resend": {
            "post": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Reenvía una entrega fallida (con ?force=1 también una ya recibida). Conserva el mismo id.",
                "operationId": "post_v1_slug_webhooks_deliveries_uuid_resend",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "force",
                        "in": "query",
                        "required": false,
                        "description": "1 para reenviar aunque haya sido recibida.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "webhooks:write"
                ],
                "description": "Alcance requerido: `webhooks:write`."
            }
        },
        "/v1/{slug}/webhooks/endpoints": {
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Destinos configurados (sin el secreto).",
                "operationId": "get_v1_slug_webhooks_endpoints",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "webhooks:read"
                ],
                "description": "Alcance requerido: `webhooks:read`."
            }
        },
        "/v1/{slug}/webhooks/events": {
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Catálogo de eventos con payload de ejemplo y reglas de entrega.",
                "operationId": "get_v1_slug_webhooks_events",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Clave ausente, inválida, vencida o revocada.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "La clave no tiene el alcance necesario (code: insufficient_scope).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Datos inválidos (code: validation_error).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Límite de pedidos por minuto.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "x-required-scopes": [
                    "webhooks:read"
                ],
                "description": "Alcance requerido: `webhooks:read`."
            }
        },
        "/mcp/{slug}": {
            "post": {
                "tags": [
                    "MCP"
                ],
                "summary": "Servidor MCP (Model Context Protocol), transporte Streamable HTTP.",
                "description": "Un mensaje JSON-RPC 2.0 por pedido (initialize, tools/list, tools/call, resources/list, resources/read, ping, server/discover). Autenticación: Bearer con la clave de API. Herramientas de solo lectura; las dos de escritura piden el alcance mcp:write tildado.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "jsonrpc",
                                    "method"
                                ],
                                "properties": {
                                    "jsonrpc": {
                                        "const": "2.0"
                                    },
                                    "id": {
                                        "type": [
                                            "string",
                                            "integer"
                                        ]
                                    },
                                    "method": {
                                        "type": "string"
                                    },
                                    "params": {
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Respuesta JSON-RPC."
                    },
                    "202": {
                        "description": "Notificación aceptada."
                    },
                    "401": {
                        "description": "Falta clave o es inválida (WWW-Authenticate con resource_metadata)."
                    }
                }
            }
        }
    },
    "webhooks": {
        "order.created": {
            "post": {
                "summary": "Venta registrada",
                "description": "Se crea un pedido o venta (tienda, mostrador, carga manual, canales).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "order.created"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 88,
                                            "number": "P-00088",
                                            "status": "active",
                                            "source": "store",
                                            "currency": "ARS",
                                            "subtotal": 8000,
                                            "discount": 0,
                                            "total": 8000,
                                            "coupon_code": null,
                                            "invoice_id": 301,
                                            "store_id": 3,
                                            "client": {
                                                "id": 12,
                                                "number": "C-0012",
                                                "name": "Lucía Paz",
                                                "first_name": "Lucía",
                                                "last_name": "Paz",
                                                "business_name": null,
                                                "email": "<email del cliente>",
                                                "whatsapp": "1155550000",
                                                "cuit": "27111111112",
                                                "dni": null,
                                                "iva_condition": "consumidor_final",
                                                "city": "CABA",
                                                "province": "Buenos Aires",
                                                "created_at": "2027-03-20T14:05:00-03:00"
                                            },
                                            "items": [
                                                {
                                                    "product_id": 55,
                                                    "description": "Remera",
                                                    "quantity": 2,
                                                    "unit_price": 4000
                                                }
                                            ],
                                            "created_at": "2027-03-20T14:00:00-03:00"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "invoice.created": {
            "post": {
                "summary": "Comprobante emitido",
                "description": "Un comprobante deja de ser borrador (emitido).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "invoice.created"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 301,
                                            "number": "0001-00000045",
                                            "status": "unpaid",
                                            "mode": "afip",
                                            "voucher_type": "B",
                                            "cae": "74123456789012",
                                            "currency": "ARS",
                                            "subtotal": 10000,
                                            "tax_total": 2100,
                                            "total": 12100,
                                            "balance": 12100,
                                            "issued_at": "2027-03-20T14:05:00-03:00",
                                            "due_at": null,
                                            "client": {
                                                "id": 12,
                                                "number": "C-0012",
                                                "name": "Lucía Paz",
                                                "first_name": "Lucía",
                                                "last_name": "Paz",
                                                "business_name": null,
                                                "email": "<email del cliente>",
                                                "whatsapp": "1155550000",
                                                "cuit": "27111111112",
                                                "dni": null,
                                                "iva_condition": "consumidor_final",
                                                "city": "CABA",
                                                "province": "Buenos Aires",
                                                "created_at": "2027-03-20T14:05:00-03:00"
                                            },
                                            "items": [
                                                {
                                                    "description": "Servicio mensual",
                                                    "quantity": 1,
                                                    "unit_price": 10000,
                                                    "tax_rate": 21,
                                                    "total": 12100
                                                }
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "invoice.paid": {
            "post": {
                "summary": "Comprobante cobrado completo",
                "description": "El saldo de un comprobante llega a cero.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "invoice.paid"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 301,
                                            "number": "0001-00000045",
                                            "status": "paid",
                                            "mode": "afip",
                                            "voucher_type": "B",
                                            "cae": "74123456789012",
                                            "currency": "ARS",
                                            "subtotal": 10000,
                                            "tax_total": 2100,
                                            "total": 12100,
                                            "balance": 0,
                                            "issued_at": "2027-03-20T14:05:00-03:00",
                                            "due_at": null,
                                            "client": {
                                                "id": 12,
                                                "number": "C-0012",
                                                "name": "Lucía Paz",
                                                "first_name": "Lucía",
                                                "last_name": "Paz",
                                                "business_name": null,
                                                "email": "<email del cliente>",
                                                "whatsapp": "1155550000",
                                                "cuit": "27111111112",
                                                "dni": null,
                                                "iva_condition": "consumidor_final",
                                                "city": "CABA",
                                                "province": "Buenos Aires",
                                                "created_at": "2027-03-20T14:05:00-03:00"
                                            },
                                            "items": [
                                                {
                                                    "description": "Servicio mensual",
                                                    "quantity": 1,
                                                    "unit_price": 10000,
                                                    "tax_rate": 21,
                                                    "total": 12100
                                                }
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "payment.received": {
            "post": {
                "summary": "Cobro registrado",
                "description": "Se registra un cobro (panel, API, pasarela).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "payment.received"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 77,
                                            "amount": 12100,
                                            "currency": "ARS",
                                            "exchange_rate": 1,
                                            "method": "transferencia",
                                            "description": "Cobro de 0001-00000045",
                                            "paid_at": "2027-03-20T15:00:00-03:00",
                                            "card": null,
                                            "client": {
                                                "id": 12,
                                                "number": "C-0012",
                                                "name": "Lucía Paz",
                                                "first_name": "Lucía",
                                                "last_name": "Paz",
                                                "business_name": null,
                                                "email": "<email del cliente>",
                                                "whatsapp": "1155550000",
                                                "cuit": "27111111112",
                                                "dni": null,
                                                "iva_condition": "consumidor_final",
                                                "city": "CABA",
                                                "province": "Buenos Aires",
                                                "created_at": "2027-03-20T14:05:00-03:00"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "client.created": {
            "post": {
                "summary": "Cliente nuevo",
                "description": "Se da de alta un cliente.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "client.created"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 12,
                                            "number": "C-0012",
                                            "name": "Lucía Paz",
                                            "first_name": "Lucía",
                                            "last_name": "Paz",
                                            "business_name": null,
                                            "email": "<email del cliente>",
                                            "whatsapp": "1155550000",
                                            "cuit": "27111111112",
                                            "dni": null,
                                            "iva_condition": "consumidor_final",
                                            "city": "CABA",
                                            "province": "Buenos Aires",
                                            "created_at": "2027-03-20T14:05:00-03:00"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "appointment.booked": {
            "post": {
                "summary": "Turno reservado",
                "description": "Se reserva un turno.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "appointment.booked"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 9,
                                            "status": "confirmed",
                                            "starts_at": "2027-03-22T10:00:00-03:00",
                                            "ends_at": "2027-03-22T10:30:00-03:00",
                                            "service": "Consulta",
                                            "agenda": "Consultorio 1",
                                            "customer": {
                                                "name": "Lucía Paz",
                                                "email": "<email del cliente>",
                                                "phone": "1155550000"
                                            },
                                            "client_id": 12,
                                            "price": 5000,
                                            "currency": "ARS",
                                            "source": "web"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "appointment.cancelled": {
            "post": {
                "summary": "Turno cancelado",
                "description": "Un turno pasa a cancelado.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "appointment.cancelled"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 9,
                                            "status": "cancelled",
                                            "starts_at": "2027-03-22T10:00:00-03:00"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "stock.low": {
            "post": {
                "summary": "Stock por debajo del mínimo",
                "description": "El disponible total de un producto con stock estricto baja hasta el mínimo configurado o por debajo (una vez por cruce, no en cada venta).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "stock.low"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "product_id": 55,
                                            "sku": "REM-001",
                                            "name": "Remera",
                                            "available": 3,
                                            "minimum": 5,
                                            "warehouse_id": 1
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "product.created": {
            "post": {
                "summary": "Producto creado",
                "description": "Se crea un producto de venta (físico, servicio o digital), con sus variantes y precios ya guardados.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "product.created"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 55,
                                            "name": "Remera",
                                            "sku": "REM-001",
                                            "type": "physical",
                                            "kind": "variable",
                                            "currency": "ARS",
                                            "price": 4000,
                                            "is_active": true,
                                            "show_on_store": true,
                                            "category_id": null,
                                            "variations": [
                                                {
                                                    "id": 56,
                                                    "sku": "REM-001-M",
                                                    "options": {
                                                        "Talle": "M"
                                                    },
                                                    "price": 4000,
                                                    "is_active": true
                                                }
                                            ],
                                            "updated_at": "2027-03-20T14:00:00-03:00"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "product.updated": {
            "post": {
                "summary": "Producto actualizado",
                "description": "Cambia el nombre, SKU, descripción, estado, tipo, categoría o precio de un producto (se agrupan los cambios seguidos).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "product.updated"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 55,
                                            "name": "Remera básica",
                                            "sku": "REM-001",
                                            "type": "physical",
                                            "kind": "simple",
                                            "currency": "ARS",
                                            "price": 4500,
                                            "is_active": true,
                                            "show_on_store": true,
                                            "category_id": null,
                                            "variations": [],
                                            "updated_at": "2027-03-20T14:10:00-03:00"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "credit_note.issued": {
            "post": {
                "summary": "Nota de crédito emitida",
                "description": "Se emite una nota de crédito (panel o API).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "credit_note.issued"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 21,
                                            "number": "0001-00000007",
                                            "status": "issued",
                                            "invoice_id": 301,
                                            "currency": "ARS",
                                            "total": 12100,
                                            "reason": "Anulación 0001-00000045",
                                            "voucher_type": "NC B",
                                            "cae": "74123456789099",
                                            "issued_at": "2027-03-21T09:00:00-03:00",
                                            "client": {
                                                "id": 12,
                                                "number": "C-0012",
                                                "name": "Lucía Paz",
                                                "first_name": "Lucía",
                                                "last_name": "Paz",
                                                "business_name": null,
                                                "email": "<email del cliente>",
                                                "whatsapp": "1155550000",
                                                "cuit": "27111111112",
                                                "dni": null,
                                                "iva_condition": "consumidor_final",
                                                "city": "CABA",
                                                "province": "Buenos Aires",
                                                "created_at": "2027-03-20T14:05:00-03:00"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "invoice.cancelled": {
            "post": {
                "summary": "Factura anulada",
                "description": "Un comprobante emitido pasa a anulado.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "invoice.cancelled"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 301,
                                            "number": "0001-00000045",
                                            "status": "cancelled",
                                            "mode": "afip",
                                            "voucher_type": "B",
                                            "cae": "74123456789012",
                                            "currency": "ARS",
                                            "subtotal": 10000,
                                            "tax_total": 2100,
                                            "total": 12100,
                                            "balance": 12100,
                                            "issued_at": "2027-03-20T14:05:00-03:00",
                                            "due_at": null,
                                            "client": {
                                                "id": 12,
                                                "number": "C-0012",
                                                "name": "Lucía Paz",
                                                "first_name": "Lucía",
                                                "last_name": "Paz",
                                                "business_name": null,
                                                "email": "<email del cliente>",
                                                "whatsapp": "1155550000",
                                                "cuit": "27111111112",
                                                "dni": null,
                                                "iva_condition": "consumidor_final",
                                                "city": "CABA",
                                                "province": "Buenos Aires",
                                                "created_at": "2027-03-20T14:05:00-03:00"
                                            },
                                            "items": [
                                                {
                                                    "description": "Servicio mensual",
                                                    "quantity": 1,
                                                    "unit_price": 10000,
                                                    "tax_rate": 21,
                                                    "total": 12100
                                                }
                                            ],
                                            "cancelled_at": "2027-03-21T09:00:00-03:00"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "order.paid": {
            "post": {
                "summary": "Pedido de la tienda pagado",
                "description": "El comprobante de un pedido de la tienda online queda cobrado completo (incluye paid_invoice_id).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "order.paid"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 88,
                                            "number": "P-00088",
                                            "status": "active",
                                            "source": "store",
                                            "currency": "ARS",
                                            "subtotal": 8000,
                                            "discount": 0,
                                            "total": 8000,
                                            "coupon_code": null,
                                            "invoice_id": 301,
                                            "store_id": 3,
                                            "client": {
                                                "id": 12,
                                                "number": "C-0012",
                                                "name": "Lucía Paz",
                                                "first_name": "Lucía",
                                                "last_name": "Paz",
                                                "business_name": null,
                                                "email": "<email del cliente>",
                                                "whatsapp": "1155550000",
                                                "cuit": "27111111112",
                                                "dni": null,
                                                "iva_condition": "consumidor_final",
                                                "city": "CABA",
                                                "province": "Buenos Aires",
                                                "created_at": "2027-03-20T14:05:00-03:00"
                                            },
                                            "items": [
                                                {
                                                    "product_id": 55,
                                                    "description": "Remera",
                                                    "quantity": 2,
                                                    "unit_price": 4000
                                                }
                                            ],
                                            "created_at": "2027-03-20T14:00:00-03:00",
                                            "paid_invoice_id": 301
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "chatbot.handoff": {
            "post": {
                "summary": "Chatbot: pasa a una persona",
                "description": "Una charla del chatbot se deriva al equipo (la pidió el cliente, hubo enojo o el asistente no supo).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "chatbot.handoff"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 31,
                                            "channel": "whatsapp",
                                            "name": "Lucía Paz",
                                            "email": null,
                                            "whatsapp": "5491155550000",
                                            "status": "handoff",
                                            "topic": "Reclamos",
                                            "summary": "Pide hablar con una persona por un pedido demorado.",
                                            "page_url": null,
                                            "messages": 6,
                                            "bot_id": 1,
                                            "created_at": "2027-03-20T14:00:00-03:00",
                                            "reason": "Quiere hablar con una persona"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "chatbot.lead": {
            "post": {
                "summary": "Chatbot: contacto nuevo",
                "description": "Alguien deja su email o WhatsApp en una charla del chatbot (una vez por charla).",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "chatbot.lead"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 32,
                                            "channel": "embed",
                                            "name": "Beto Gómez",
                                            "email": "<email del cliente>",
                                            "whatsapp": null,
                                            "status": "open",
                                            "topic": "Precios",
                                            "summary": null,
                                            "page_url": "https://tienda.com/producto/x",
                                            "messages": 2,
                                            "bot_id": 1,
                                            "created_at": "2027-03-20T15:00:00-03:00"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        },
        "meli_claim.opened": {
            "post": {
                "summary": "Reclamo de Mercado Libre abierto",
                "description": "Se registra un reclamo nuevo de un comprador en Mercado Libre.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "event": {
                                        "const": "meli_claim.opened"
                                    },
                                    "created_at": {
                                        "type": "string",
                                        "format": "date-time"
                                    },
                                    "data": {
                                        "type": "object",
                                        "example": {
                                            "id": 5,
                                            "claim_id": "5123456789",
                                            "type": "mediations",
                                            "stage": "claim",
                                            "status": "opened",
                                            "reason_id": "PNR",
                                            "ml_order_id": "2000001234567",
                                            "affects_reputation": true,
                                            "due_at": "2027-03-23T12:00:00-03:00",
                                            "opened_at": "2027-03-20T12:00:00-03:00"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "2XX": {
                        "description": "Recibido. Cualquier otra respuesta se reintenta."
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "Clave de API de la empresa."
            },
            "apiKey": {
                "type": "apiKey",
                "in": "header",
                "name": "X-Api-Key"
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "ok",
                    "code",
                    "message"
                ],
                "properties": {
                    "ok": {
                        "const": false
                    },
                    "code": {
                        "type": "string"
                    },
                    "message": {
                        "type": "string"
                    },
                    "error": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object"
                    },
                    "required_scope": {
                        "type": "string"
                    }
                }
            },
            "PageMeta": {
                "type": "object",
                "properties": {
                    "page": {
                        "type": "integer"
                    },
                    "per_page": {
                        "type": "integer"
                    },
                    "total": {
                        "type": "integer"
                    },
                    "last_page": {
                        "type": "integer"
                    }
                }
            },
            "Client": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "business_name": {
                        "type": "string"
                    },
                    "first_name": {
                        "type": "string"
                    },
                    "last_name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "cuit": {
                        "type": "string"
                    },
                    "iva_condition": {
                        "type": "string"
                    },
                    "address": {
                        "type": "string"
                    },
                    "city": {
                        "type": "string"
                    },
                    "province": {
                        "type": "string"
                    },
                    "postal_code": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    }
                }
            },
            "ClientInput": {
                "type": "object",
                "properties": {
                    "business_name": {
                        "type": "string"
                    },
                    "first_name": {
                        "type": "string"
                    },
                    "last_name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string",
                        "format": "email"
                    },
                    "cuit": {
                        "type": "string"
                    },
                    "document_type": {
                        "type": "string"
                    },
                    "document_number": {
                        "type": "string"
                    },
                    "address": {
                        "type": "string"
                    },
                    "city": {
                        "type": "string"
                    },
                    "province": {
                        "type": "string"
                    },
                    "postal_code": {
                        "type": "string"
                    },
                    "iva_condition": {
                        "type": "string"
                    },
                    "person_type": {
                        "type": "string"
                    },
                    "afip_invoicing": {
                        "type": "boolean"
                    },
                    "external_id": {
                        "type": "string"
                    }
                }
            },
            "ClientUpdate": {
                "type": "object",
                "description": "Solo los campos que quieras cambiar.",
                "properties": {
                    "business_name": {
                        "type": "string"
                    },
                    "first_name": {
                        "type": "string"
                    },
                    "last_name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string",
                        "format": "email"
                    },
                    "whatsapp": {
                        "type": "string"
                    },
                    "address": {
                        "type": "string"
                    },
                    "city": {
                        "type": "string"
                    },
                    "province": {
                        "type": "string"
                    },
                    "postal_code": {
                        "type": "string"
                    },
                    "iva_condition": {
                        "type": "string"
                    },
                    "person_type": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    }
                }
            },
            "ClientList": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Client"
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/PageMeta"
                    },
                    "links": {
                        "type": "object",
                        "properties": {
                            "next": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "prev": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            },
            "ClientOne": {
                "type": "object",
                "properties": {
                    "data": {
                        "$ref": "#/components/schemas/Client"
                    }
                }
            },
            "Product": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    },
                    "sku": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string"
                    },
                    "kind": {
                        "enum": [
                            "simple",
                            "variable"
                        ]
                    },
                    "currency": {
                        "type": "string"
                    },
                    "price": {
                        "type": "number"
                    },
                    "tax_rate": {
                        "type": "number"
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "show_on_store": {
                        "type": "boolean"
                    },
                    "track_stock": {
                        "type": "boolean"
                    },
                    "stock": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "variation_attributes": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    },
                    "variations": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "ProductInput": {
                "type": "object",
                "required": [
                    "name"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "sku": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "short_description": {
                        "type": "string"
                    },
                    "type": {
                        "enum": [
                            "physical",
                            "service",
                            "digital"
                        ]
                    },
                    "currency": {
                        "type": "string"
                    },
                    "price": {
                        "type": "number"
                    },
                    "tax_rate": {
                        "type": "number",
                        "description": "Alícuota de IVA: 0, 10.5, 21, 27."
                    },
                    "is_active": {
                        "type": "boolean"
                    },
                    "show_on_store": {
                        "type": "boolean"
                    },
                    "category_id": {
                        "type": "integer"
                    },
                    "track_stock": {
                        "type": "boolean"
                    },
                    "stock_qty": {
                        "type": "integer"
                    },
                    "low_stock_qty": {
                        "type": "integer"
                    },
                    "external_id": {
                        "type": "string"
                    },
                    "variations": {
                        "type": "array",
                        "description": "Variantes: cada una con sus opciones (Talle: M) y su precio. Los atributos se arman solos.",
                        "items": {
                            "type": "object",
                            "required": [
                                "options"
                            ],
                            "properties": {
                                "options": {
                                    "type": "object",
                                    "additionalProperties": {
                                        "type": "string"
                                    },
                                    "example": {
                                        "Talle": "M"
                                    }
                                },
                                "sku": {
                                    "type": "string"
                                },
                                "price": {
                                    "type": "number"
                                },
                                "is_active": {
                                    "type": "boolean"
                                },
                                "track_stock": {
                                    "type": "boolean"
                                },
                                "stock_qty": {
                                    "type": "integer"
                                }
                            }
                        }
                    }
                }
            },
            "ProductList": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Product"
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/PageMeta"
                    },
                    "links": {
                        "type": "object",
                        "properties": {
                            "next": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "prev": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            },
            "ProductOne": {
                "type": "object",
                "properties": {
                    "data": {
                        "$ref": "#/components/schemas/Product"
                    }
                }
            },
            "Invoice": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "number": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "currency": {
                        "type": "string"
                    },
                    "subtotal": {
                        "type": "number"
                    },
                    "tax_total": {
                        "type": "number"
                    },
                    "total": {
                        "type": "number"
                    },
                    "balance": {
                        "type": "number"
                    },
                    "issued_at": {
                        "type": "string"
                    },
                    "due_at": {
                        "type": "string"
                    },
                    "afip_cae": {
                        "type": "string"
                    },
                    "client": {
                        "$ref": "#/components/schemas/Client"
                    },
                    "pay_url": {
                        "type": "string"
                    },
                    "pdf_url": {
                        "type": "string"
                    }
                }
            },
            "InvoiceInput": {
                "type": "object",
                "required": [
                    "items"
                ],
                "properties": {
                    "client_id": {
                        "type": "integer"
                    },
                    "client": {
                        "$ref": "#/components/schemas/ClientInput"
                    },
                    "items": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": [
                                "description",
                                "unit_price"
                            ],
                            "properties": {
                                "description": {
                                    "type": "string"
                                },
                                "quantity": {
                                    "type": "number"
                                },
                                "unit_price": {
                                    "type": "number"
                                },
                                "tax_rate": {
                                    "type": "number"
                                }
                            }
                        }
                    },
                    "currency": {
                        "type": "string"
                    },
                    "notes": {
                        "type": "string"
                    },
                    "emit": {
                        "type": "boolean"
                    },
                    "notify": {
                        "type": "boolean"
                    },
                    "mode": {
                        "enum": [
                            "internal",
                            "afip"
                        ]
                    },
                    "external_id": {
                        "type": "string"
                    }
                }
            },
            "InvoiceList": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Invoice"
                        }
                    },
                    "meta": {
                        "$ref": "#/components/schemas/PageMeta"
                    },
                    "links": {
                        "type": "object",
                        "properties": {
                            "next": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "prev": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            },
            "InvoiceOne": {
                "type": "object",
                "properties": {
                    "data": {
                        "$ref": "#/components/schemas/Invoice"
                    }
                }
            },
            "CreditNoteInput": {
                "type": "object",
                "properties": {
                    "invoice_id": {
                        "type": "integer"
                    },
                    "external_id": {
                        "type": "string"
                    },
                    "reason": {
                        "type": "string"
                    },
                    "notes": {
                        "type": "string"
                    },
                    "notify": {
                        "type": "boolean"
                    }
                }
            },
            "PaymentInput": {
                "type": "object",
                "required": [
                    "amount"
                ],
                "properties": {
                    "invoice_id": {
                        "type": "integer"
                    },
                    "client_id": {
                        "type": "integer"
                    },
                    "amount": {
                        "type": "number"
                    },
                    "currency": {
                        "type": "string"
                    },
                    "payment_method": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "paid_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "reference": {
                        "type": "string"
                    },
                    "external_id": {
                        "type": "string"
                    }
                }
            },
            "PaymentOne": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object"
                    },
                    "applied_amount": {
                        "type": "number"
                    },
                    "credit_remaining": {
                        "type": "number"
                    },
                    "invoice": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "created": {
                        "type": "boolean"
                    }
                }
            },
            "StockAdjustInput": {
                "type": "object",
                "required": [
                    "delta"
                ],
                "properties": {
                    "product_id": {
                        "type": "integer"
                    },
                    "sku": {
                        "type": "string"
                    },
                    "delta": {
                        "type": "integer"
                    },
                    "reason": {
                        "type": "string"
                    },
                    "warehouse_id": {
                        "type": "integer"
                    }
                }
            },
            "BudgetInput": {
                "type": "object",
                "properties": {
                    "client_id": {
                        "type": "integer"
                    },
                    "client": {
                        "type": "object"
                    },
                    "title": {
                        "type": "string"
                    },
                    "items": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "description": {
                                    "type": "string"
                                },
                                "quantity": {
                                    "type": "number"
                                },
                                "unit_price": {
                                    "type": "number"
                                }
                            }
                        }
                    },
                    "currency": {
                        "type": "string"
                    },
                    "expires_at": {
                        "type": "string"
                    }
                }
            }
        }
    },
    "x-scopes": {
        "clients:read": "Clientes — lectura",
        "clients:write": "Clientes — lectura y escritura",
        "products:read": "Productos — lectura",
        "products:write": "Productos — lectura y escritura",
        "stock:read": "Stock — lectura",
        "stock:write": "Stock — lectura y escritura",
        "invoices:read": "Facturas y notas de crédito — lectura",
        "invoices:write": "Facturas y notas de crédito — lectura y escritura",
        "orders:read": "Pedidos y ventas — lectura",
        "orders:write": "Pedidos y ventas — lectura y escritura",
        "payments:read": "Cobros — lectura",
        "payments:write": "Cobros — lectura y escritura",
        "crm:read": "CRM — lectura",
        "crm:write": "CRM — lectura y escritura",
        "budgets:read": "Presupuestos — lectura",
        "budgets:write": "Presupuestos — lectura y escritura",
        "purchases:read": "Compras y proveedores — lectura",
        "purchases:write": "Compras y proveedores — lectura y escritura",
        "webhooks:read": "Webhooks — lectura",
        "webhooks:write": "Webhooks — lectura y escritura",
        "mcp:write": "Asistentes de IA (MCP) — permitir herramientas que escriben"
    }
}