{
    "info": {
        "_postman_id": "32637f37-00f7-b2ea-880f-d7d27da185c5",
        "name": "Caserol · Vessel POS API",
        "description": "Colección oficial de la API del POS. Ejecuta primero Autenticación / Generar token.",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "auth": {
        "type": "bearer",
        "bearer": [
            {
                "key": "token",
                "value": "{{bearer_token}}",
                "type": "string"
            }
        ]
    },
    "event": [
        {
            "listen": "prerequest",
            "script": {
                "type": "text/javascript",
                "exec": [
                    "pm.request.headers.upsert({ key: 'Accept', value: 'application/json' });"
                ]
            }
        }
    ],
    "item": [
        {
            "name": "Autenticación",
            "description": "Obtén el Bearer Token que se utiliza en el resto de solicitudes.",
            "item": [
                {
                    "name": "Generar token",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/login",
                        "description": "Autentica por correo y contraseña. Máximo 10 intentos por minuto y combinación de IP/correo.\n\nPermiso: Público",
                        "auth": {
                            "type": "noauth"
                        },
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"email\": \"{{email}}\",\n    \"password\": \"{{password}}\",\n    \"token_name\": \"Postman\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "const json = pm.response.json();",
                                    "if (json && json.data && json.data.token) pm.collectionVariables.set('bearer_token', json.data.token);",
                                    "pm.test('Token recibido', () => pm.expect(json.data.token).to.be.a('string').and.not.empty);"
                                ]
                            }
                        }
                    ]
                }
            ]
        },
        {
            "name": "Catálogo",
            "description": "Productos, categorías y adicionales del tenant del dominio.",
            "item": [
                {
                    "name": "Listar productos",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/products?is_active=1&page=1&per_page=20",
                        "description": "Admite q, category, is_active, page y per_page.\n\nPermiso: api.catalog.read"
                    },
                    "response": []
                },
                {
                    "name": "Buscar productos",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/products/search?q={{product_query}}&is_active=1&page=1&per_page=20",
                        "description": "Busca por ID, nombre, SKU, código o categoría. Las frases se evalúan palabra por palabra, los resultados se ordenan por relevancia y cada producto incluye un score de 0 a 100. El parámetro q es obligatorio.\n\nPermiso: api.catalog.read"
                    },
                    "response": [
                        {
                            "name": "Respuesta correcta",
                            "originalRequest": {
                                "method": "GET",
                                "header": [
                                    {
                                        "key": "Accept",
                                        "value": "application/json",
                                        "type": "text"
                                    }
                                ],
                                "url": "{{base_url}}api/products/search?q={{product_query}}&is_active=1&page=1&per_page=20",
                                "description": "Busca por ID, nombre, SKU, código o categoría. Las frases se evalúan palabra por palabra, los resultados se ordenan por relevancia y cada producto incluye un score de 0 a 100. El parámetro q es obligatorio.\n\nPermiso: api.catalog.read"
                            },
                            "status": "OK",
                            "code": 200,
                            "_postman_previewlanguage": "json",
                            "header": [
                                {
                                    "key": "Content-Type",
                                    "value": "application/json; charset=UTF-8"
                                }
                            ],
                            "cookie": [],
                            "body": "{\n    \"status\": 200,\n    \"success\": true,\n    \"message\": \"Listado de productos obtenido correctamente.\",\n    \"data\": {\n        \"products\": [\n            {\n                \"id\": 15,\n                \"sku\": \"AME-001\",\n                \"code\": \"AMERICANO\",\n                \"name\": \"AMERICANO\",\n                \"category\": \"CAFÉ\",\n                \"price\": 55,\n                \"cost\": 18,\n                \"is_active\": 1,\n                \"score\": 35,\n                \"images_list\": [],\n                \"main_image\": null,\n                \"add_ons_list\": []\n            }\n        ],\n        \"pagination\": {\n            \"current_page\": 1,\n            \"per_page\": 20,\n            \"total\": 1,\n            \"page_count\": 1\n        }\n    }\n}"
                        }
                    ]
                },
                {
                    "name": "Crear producto",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/products",
                        "description": "Crea un producto dentro del tenant autenticado.\n\nPermiso: api.catalog.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"name\": \"CAPUCHINO\",\n    \"sku\": \"CAP-001\",\n    \"category\": \"hot_drinks\",\n    \"price\": 65,\n    \"cost\": 22,\n    \"is_active\": 1,\n    \"visible_pos\": 1,\n    \"visible_app\": 1,\n    \"visible_kiosk\": 1\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Consultar producto",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/products/{{product_id}}",
                        "description": "Permiso: api.catalog.read"
                    },
                    "response": []
                },
                {
                    "name": "Actualizar producto",
                    "request": {
                        "method": "PUT",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/products/{{product_id}}",
                        "description": "Envía solamente los campos que desees modificar.\n\nPermiso: api.catalog.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"price\": 68,\n    \"visible_kiosk\": 1\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Eliminar producto",
                    "request": {
                        "method": "DELETE",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/products/{{product_id}}",
                        "description": "Permiso: api.catalog.write"
                    },
                    "response": []
                },
                {
                    "name": "Listar categorías",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/categories?page=1&per_page=50",
                        "description": "Permiso: api.catalog.read"
                    },
                    "response": []
                },
                {
                    "name": "Crear categoría",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/categories",
                        "description": "Permiso: api.catalog.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"code\": \"desserts\",\n    \"name\": \"POSTRES\",\n    \"is_active\": 1,\n    \"visible_pos\": 1\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Consultar categoría",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/categories/{{category_id}}",
                        "description": "Permiso: api.catalog.read"
                    },
                    "response": []
                },
                {
                    "name": "Actualizar categoría",
                    "request": {
                        "method": "PUT",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/categories/{{category_id}}",
                        "description": "Permiso: api.catalog.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"name\": \"POSTRES Y PANADERÍA\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Eliminar categoría",
                    "request": {
                        "method": "DELETE",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/categories/{{category_id}}",
                        "description": "Permiso: api.catalog.write"
                    },
                    "response": []
                },
                {
                    "name": "Listar adicionales",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/addons?is_active=1",
                        "description": "Permiso: api.catalog.read"
                    },
                    "response": []
                },
                {
                    "name": "Listar grupos de adicionales",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/addons/groups",
                        "description": "Permiso: api.catalog.read"
                    },
                    "response": []
                },
                {
                    "name": "Crear adicional",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/addons",
                        "description": "Permiso: api.catalog.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"name\": \"LECHE DE AVENA\",\n    \"group_code\": \"milk\",\n    \"group_name\": \"Leche\",\n    \"price\": 12,\n    \"is_active\": 1\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Consultar adicional",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/addons/{{addon_id}}",
                        "description": "Permiso: api.catalog.read"
                    },
                    "response": []
                },
                {
                    "name": "Actualizar adicional",
                    "request": {
                        "method": "PUT",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/addons/{{addon_id}}",
                        "description": "Permiso: api.catalog.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"price\": 14\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Eliminar adicional",
                    "request": {
                        "method": "DELETE",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/addons/{{addon_id}}",
                        "description": "Permiso: api.catalog.write"
                    },
                    "response": []
                }
            ]
        },
        {
            "name": "Contenido",
            "description": "Publicaciones visibles en la aplicación del cliente.",
            "item": [
                {
                    "name": "Listar publicaciones",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/posts?page=1&per_page=20",
                        "description": "Permiso: api.content.read"
                    },
                    "response": []
                },
                {
                    "name": "Crear publicación",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/posts",
                        "description": "Permiso: api.content.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"type\": \"news\",\n    \"title\": \"Nueva temporada\",\n    \"status\": \"active\",\n    \"summary\": \"Conoce las novedades.\",\n    \"body\": \"<p>Contenido de la publicación.</p>\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Consultar publicación",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/posts/{{post_id}}",
                        "description": "Permiso: api.content.read"
                    },
                    "response": []
                },
                {
                    "name": "Actualizar publicación",
                    "request": {
                        "method": "PUT",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/posts/{{post_id}}",
                        "description": "Permiso: api.content.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"title\": \"Nueva temporada 2026\",\n    \"status\": \"active\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Eliminar publicación",
                    "request": {
                        "method": "DELETE",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/posts/{{post_id}}",
                        "description": "Permiso: api.content.write"
                    },
                    "response": []
                }
            ]
        },
        {
            "name": "Marketing y lealtad",
            "description": "Promociones y reglas para otorgar puntos.",
            "item": [
                {
                    "name": "Listar promociones",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/promos?active=1",
                        "description": "Permiso: api.marketing.read"
                    },
                    "response": []
                },
                {
                    "name": "Crear promoción",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/promos",
                        "description": "Permiso: api.marketing.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"name\": \"2x1 del martes\",\n    \"description\": \"Promoción válida los martes.\",\n    \"start_date\": \"2026-09-15 00:00:00\",\n    \"end_date\": \"2026-12-31 23:59:59\",\n    \"status\": \"active\",\n    \"is_active\": 1,\n    \"product_ids\": [\n        1\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Consultar promoción",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/promos/{{promo_id}}",
                        "description": "Permiso: api.marketing.read"
                    },
                    "response": []
                },
                {
                    "name": "Actualizar promoción",
                    "request": {
                        "method": "PUT",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/promos/{{promo_id}}",
                        "description": "Permiso: api.marketing.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"status\": \"paused\",\n    \"is_active\": 0\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Eliminar promoción",
                    "request": {
                        "method": "DELETE",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/promos/{{promo_id}}",
                        "description": "Permiso: api.marketing.write"
                    },
                    "response": []
                },
                {
                    "name": "Listar reglas de puntos",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/loyalty-points/rules",
                        "description": "Permiso: api.loyalty.read"
                    },
                    "response": []
                },
                {
                    "name": "Consultar regla",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/loyalty-points/rules/{{rule_id}}",
                        "description": "Permiso: api.loyalty.read"
                    },
                    "response": []
                },
                {
                    "name": "Crear o actualizar regla",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/loyalty-points/rules",
                        "description": "Para actualizar incluye id.\n\nPermiso: api.loyalty.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"name\": \"Regla general\",\n    \"min_spend\": 0,\n    \"max_spend\": 1000,\n    \"points_per_mxn\": 0.1,\n    \"is_active\": 1\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Eliminar regla",
                    "request": {
                        "method": "DELETE",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/loyalty-points/rules/{{rule_id}}",
                        "description": "Permiso: api.loyalty.write"
                    },
                    "response": []
                }
            ]
        },
        {
            "name": "Sucursales, terminales y cajas",
            "description": "Configuración del punto de venta y control de sesiones de caja.",
            "item": [
                {
                    "name": "Listar sucursales",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/pos/branches",
                        "description": "Permiso: api.pos.read"
                    },
                    "response": []
                },
                {
                    "name": "Listar terminales",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/pos/registers?branch_id={{branch_id}}",
                        "description": "Permiso: api.pos.read"
                    },
                    "response": []
                },
                {
                    "name": "Crear terminal",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/pos/registers",
                        "description": "Permiso: api.pos.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"branch_id\": 1,\n    \"name\": \"Caja principal\",\n    \"serial_number\": \"POS-001\",\n    \"status\": \"active\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Consultar terminal",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/pos/registers/{{cash_register_id}}",
                        "description": "Permiso: api.pos.read"
                    },
                    "response": []
                },
                {
                    "name": "Actualizar terminal",
                    "request": {
                        "method": "PUT",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/pos/registers/{{cash_register_id}}",
                        "description": "Permiso: api.pos.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"name\": \"Caja principal 1\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Eliminar terminal",
                    "request": {
                        "method": "DELETE",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/pos/registers/{{cash_register_id}}",
                        "description": "Permiso: api.pos.write"
                    },
                    "response": []
                },
                {
                    "name": "Listar sesiones de caja",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/pos/sessions?cash_register_id={{cash_register_id}}",
                        "description": "Permiso: api.cash.read"
                    },
                    "response": []
                },
                {
                    "name": "Consultar sesión abierta",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/pos/sessions/current?cash_register_id={{cash_register_id}}",
                        "description": "Permiso: api.cash.read"
                    },
                    "response": []
                },
                {
                    "name": "Abrir caja",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/pos/sessions/open",
                        "description": "Permiso: api.cash.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"cash_register_id\": 1,\n    \"opening_amount\": 1000\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Cerrar caja",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/pos/sessions/close",
                        "description": "Permiso: api.cash.write",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"session_id\": 1,\n    \"counted_amount\": 3450.5\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                }
            ]
        },
        {
            "name": "Pedidos",
            "description": "Creación segura, consulta y actualización del ciclo operativo del pedido.",
            "item": [
                {
                    "name": "Listar pedidos",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/orders?status=cart&page=1&per_page=20",
                        "description": "Admite status, source, branch_id, cash_register_id, customer_id, q, page y per_page.\n\nPermiso: api.orders.read"
                    },
                    "response": []
                },
                {
                    "name": "Buscar pedidos",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/orders/search?q={{order_query}}&page=1&per_page=20",
                        "description": "Busca por ID, folio, nombre del cliente o referencia de pago. También admite status, source, branch_id, cash_register_id y customer_id.\n\nPermiso: api.orders.read"
                    },
                    "response": []
                },
                {
                    "name": "Crear pedido",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Idempotency-Key",
                                "value": "{{$guid}}",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/orders",
                        "description": "Usa Idempotency-Key. El servidor ignora precios enviados y los calcula desde el catálogo.\n\nPermiso: api.orders.create",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"branch_id\": 1,\n    \"cash_register_id\": 1,\n    \"cash_session_id\": 1,\n    \"customer_id\": null,\n    \"pos_customer_name\": \"Público General\",\n    \"source\": \"api\",\n    \"ticket_type\": \"takeaway\",\n    \"status\": \"cart\",\n    \"payment_status\": \"open\",\n    \"items\": [\n        {\n            \"product_id\": 1,\n            \"qty\": 2,\n            \"selection\": {\n                \"presentation_group_id\": \"base_group\",\n                \"presentation_id\": \"base\",\n                \"single_groups\": {\n                    \"milk\": \"LECHE DE AVENA\"\n                },\n                \"multi_groups\": {\n                    \"extras\": [\n                        \"SHOT EXTRA\"\n                    ]\n                },\n                \"notes\": \"Sin azúcar\",\n                \"takeaway\": true\n            }\n        }\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "const json = pm.response.json();",
                                    "if (json && json.data && json.data.id) pm.collectionVariables.set('order_id', json.data.id);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Consultar pedido",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/orders/{{order_id}}",
                        "description": "También acepta el código de pedido en lugar del ID.\n\nPermiso: api.orders.read"
                    },
                    "response": []
                },
                {
                    "name": "Actualizar pedido",
                    "request": {
                        "method": "PUT",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/orders/{{order_id}}",
                        "description": "Permiso: api.orders.update",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"status\": \"preparing\",\n    \"internal_state\": \"preparation\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Actualizar estado operativo",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/orders/{{order_id}}/status",
                        "description": "Permiso: api.orders.update",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"status\": \"ready\",\n    \"internal_state\": \"ready\",\n    \"kitchen_status\": \"ready\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": []
                },
                {
                    "name": "Cancelar pedido",
                    "request": {
                        "method": "DELETE",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/orders/{{order_id}}",
                        "description": "Permiso: api.orders.cancel"
                    },
                    "response": []
                }
            ]
        },
        {
            "name": "Reportes y estadísticas",
            "description": "Indicadores de ventas, productos, promociones, puntos, usuarios, cajas e inventario por almacén.",
            "item": [
                {
                    "name": "Consultar reporte analítico",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json",
                                "type": "text"
                            }
                        ],
                        "url": "{{base_url}}api/reports/analytics?date_from={{report_date_from}}&date_to={{report_date_to}}&branch_id={{report_branch_id}}",
                        "description": "El rango máximo es de 366 días. branch_id es opcional; omítelo para consolidar todas las sucursales. Devuelve ventas, ingresos por fecha y día de semana, productos, promociones, métodos de pago, sucursales, cajas e inventario por almacén. Cada almacén incluye los totales y el detalle de existencias, consumo y consumo sin respaldo.\n\nPermiso: api.reports.read"
                    },
                    "response": [
                        {
                            "name": "Respuesta correcta",
                            "originalRequest": {
                                "method": "GET",
                                "header": [
                                    {
                                        "key": "Accept",
                                        "value": "application/json",
                                        "type": "text"
                                    }
                                ],
                                "url": "{{base_url}}api/reports/analytics?date_from={{report_date_from}}&date_to={{report_date_to}}&branch_id={{report_branch_id}}",
                                "description": "El rango máximo es de 366 días. branch_id es opcional; omítelo para consolidar todas las sucursales. Devuelve ventas, ingresos por fecha y día de semana, productos, promociones, métodos de pago, sucursales, cajas e inventario por almacén. Cada almacén incluye los totales y el detalle de existencias, consumo y consumo sin respaldo.\n\nPermiso: api.reports.read"
                            },
                            "status": "OK",
                            "code": 200,
                            "_postman_previewlanguage": "json",
                            "header": [
                                {
                                    "key": "Content-Type",
                                    "value": "application/json; charset=UTF-8"
                                }
                            ],
                            "cookie": [],
                            "body": "{\n    \"status\": 200,\n    \"success\": true,\n    \"message\": \"Reporte generado correctamente.\",\n    \"data\": {\n        \"range\": {\n            \"from\": \"2026-09-01\",\n            \"to\": \"2026-09-20\",\n            \"days\": 20,\n            \"branch_id\": null\n        },\n        \"summary\": {\n            \"revenue\": 28450.5,\n            \"previous_revenue\": 25120,\n            \"revenue_change_percent\": 13.3,\n            \"orders_count\": 186,\n            \"average_ticket\": 152.96,\n            \"promotion_redemptions\": 12,\n            \"active_points\": 8450,\n            \"customers_with_points\": 74,\n            \"earned_points\": 16200,\n            \"registered_users\": 342,\n            \"new_users\": 18,\n            \"best_weekday\": {\n                \"weekday\": \"Sábado\",\n                \"revenue\": 6890,\n                \"orders_count\": 41\n            }\n        },\n        \"daily_sales\": [\n            {\n                \"date\": \"2026-09-20\",\n                \"orders_count\": 14,\n                \"revenue\": 2180.5\n            }\n        ],\n        \"top_days\": [\n            {\n                \"date\": \"2026-09-19\",\n                \"orders_count\": 41,\n                \"revenue\": 6890\n            }\n        ],\n        \"weekday_sales\": [\n            {\n                \"weekday\": \"Lunes\",\n                \"orders_count\": 24,\n                \"revenue\": 3650\n            }\n        ],\n        \"top_products\": [\n            {\n                \"product_id\": 15,\n                \"product_name\": \"CAPUCHINO\",\n                \"units\": 58,\n                \"revenue\": 3770\n            }\n        ],\n        \"top_promotions\": [\n            {\n                \"promotion_id\": 3,\n                \"promotion_name\": \"2x1 del martes\",\n                \"redemptions\": 12\n            }\n        ],\n        \"payment_methods\": [\n            {\n                \"payment_method\": \"card\",\n                \"orders_count\": 122,\n                \"revenue\": 19820.5\n            }\n        ],\n        \"branches\": [\n            {\n                \"branch_id\": 1,\n                \"branch_name\": \"Sucursal Centro\",\n                \"orders_count\": 186,\n                \"revenue\": 28450.5\n            }\n        ],\n        \"inventory\": {\n            \"summary\": {\n                \"stock_by_unit\": {\n                    \"KGS\": 48.725,\n                    \"PZA\": 320\n                },\n                \"consumed_by_unit\": {\n                    \"KGS\": 7.275,\n                    \"PZA\": 84\n                },\n                \"closing_value\": 18750.35,\n                \"consumed_value\": 4260.8,\n                \"unverified_value\": 185.5\n            },\n            \"warehouses\": [\n                {\n                    \"warehouse_id\": 1,\n                    \"warehouse_name\": \"Almacén principal\",\n                    \"branch_name\": \"Sucursal Centro\",\n                    \"stock_by_unit\": {\n                        \"KGS\": 48.725,\n                        \"PZA\": 320\n                    },\n                    \"consumed_by_unit\": {\n                        \"KGS\": 7.275,\n                        \"PZA\": 84\n                    },\n                    \"stock_details\": [\n                        {\n                            \"supply_id\": 8,\n                            \"code\": \"MATCHA-001\",\n                            \"name\": \"MATCHA SHIZUOKA\",\n                            \"unit\": \"KGS\",\n                            \"quantity\": 1.275,\n                            \"average_cost\": 3288.79,\n                            \"value\": 4193.21\n                        }\n                    ],\n                    \"consumption_details\": [\n                        {\n                            \"supply_id\": 8,\n                            \"code\": \"MATCHA-001\",\n                            \"name\": \"MATCHA SHIZUOKA\",\n                            \"unit\": \"KGS\",\n                            \"quantity\": 0.027,\n                            \"unverified_quantity\": 0,\n                            \"value\": 88.8,\n                            \"unverified_value\": 0,\n                            \"average_cost\": 3288.79\n                        }\n                    ],\n                    \"closing_value\": 18750.35,\n                    \"consumed_value\": 4260.8,\n                    \"unverified_value\": 185.5,\n                    \"supplies_consumed\": 23,\n                    \"last_snapshot_at\": \"2026-09-20 22:15:00\",\n                    \"stock_source\": \"snapshot\"\n                }\n            ]\n        },\n        \"cash_registers\": {\n            \"summary\": {\n                \"sessions\": 6,\n                \"closed\": 5,\n                \"open\": 1,\n                \"sales\": 28450.5,\n                \"opening\": 6000,\n                \"expected\": 34450.5,\n                \"counted\": 34380.5,\n                \"difference\": -70\n            },\n            \"registers\": [\n                {\n                    \"cash_register_id\": 1,\n                    \"register_name\": \"Caja principal\",\n                    \"branch_name\": \"Sucursal Centro\",\n                    \"sessions\": 6,\n                    \"closed\": 5,\n                    \"open\": 1,\n                    \"orders\": 186,\n                    \"sales\": 28450.5,\n                    \"opening\": 6000,\n                    \"expected\": 34450.5,\n                    \"counted\": 34380.5,\n                    \"difference\": -70\n                }\n            ]\n        },\n        \"generated_at\": \"2026-09-20T22:16:00-06:00\"\n    }\n}"
                        }
                    ]
                }
            ]
        }
    ],
    "variable": [
        {
            "key": "base_url",
            "value": "https://caserol.vesselpos.com/",
            "type": "string"
        },
        {
            "key": "bearer_token",
            "value": "",
            "type": "string"
        },
        {
            "key": "email",
            "value": "",
            "type": "string"
        },
        {
            "key": "password",
            "value": "",
            "type": "string"
        },
        {
            "key": "product_query",
            "value": "CAPUCHINO",
            "type": "string"
        },
        {
            "key": "order_query",
            "value": "ORD-",
            "type": "string"
        },
        {
            "key": "product_id",
            "value": "1",
            "type": "string"
        },
        {
            "key": "category_id",
            "value": "1",
            "type": "string"
        },
        {
            "key": "addon_id",
            "value": "1",
            "type": "string"
        },
        {
            "key": "post_id",
            "value": "1",
            "type": "string"
        },
        {
            "key": "promo_id",
            "value": "1",
            "type": "string"
        },
        {
            "key": "rule_id",
            "value": "1",
            "type": "string"
        },
        {
            "key": "branch_id",
            "value": "1",
            "type": "string"
        },
        {
            "key": "cash_register_id",
            "value": "1",
            "type": "string"
        },
        {
            "key": "cash_session_id",
            "value": "1",
            "type": "string"
        },
        {
            "key": "customer_id",
            "value": "",
            "type": "string"
        },
        {
            "key": "order_id",
            "value": "1",
            "type": "string"
        },
        {
            "key": "report_date_from",
            "value": "2026-09-01",
            "type": "string"
        },
        {
            "key": "report_date_to",
            "value": "2026-09-25",
            "type": "string"
        },
        {
            "key": "report_branch_id",
            "value": "",
            "type": "string"
        }
    ]
}