{
  "info": {
    "_postman_id": "nexus-api-v1-2026",
    "name": "Nexus Atendimento API v1",
    "description": "Coleção REST v1 (API key) + portal público. Importe no Postman.\n\nBase: {{baseUrl}}/api/v1\nAuth: Authorization Bearer {{apiKey}}",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://molt.lojanexus.com.br" },
    { "key": "apiKey", "value": "nxz_SUA_CHAVE" },
    { "key": "phone", "value": "5511999999999" },
    { "key": "clientId", "value": "1" },
    { "key": "companyId", "value": "1" },
    { "key": "portalToken", "value": "" }
  ],
  "item": [
    {
      "name": "Meta",
      "item": [
        {
          "name": "OpenAPI JSON",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{baseUrl}}/api/v1/openapi.json"
          }
        },
        {
          "name": "Swagger UI",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{baseUrl}}/api/v1/docs"
          }
        }
      ]
    },
    {
      "name": "API v1",
      "item": [
        {
          "name": "Listar conversas",
          "request": {
            "method": "GET",
            "header": [{ "key": "Authorization", "value": "Bearer {{apiKey}}" }],
            "url": "{{baseUrl}}/api/v1/conversations?limit=20"
          }
        },
        {
          "name": "Listar mensagens",
          "request": {
            "method": "GET",
            "header": [{ "key": "Authorization", "value": "Bearer {{apiKey}}" }],
            "url": "{{baseUrl}}/api/v1/conversations/{{phone}}/messages?limit=50"
          }
        },
        {
          "name": "Enviar mensagem",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Authorization", "value": "Bearer {{apiKey}}" },
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"text\": \"Olá! Teste via API Nexus.\"\n}"
            },
            "url": "{{baseUrl}}/api/v1/conversations/{{phone}}/messages"
          }
        },
        {
          "name": "Listar clientes",
          "request": {
            "method": "GET",
            "header": [{ "key": "Authorization", "value": "Bearer {{apiKey}}" }],
            "url": "{{baseUrl}}/api/v1/clients?limit=50"
          }
        },
        {
          "name": "Detalhe cliente",
          "request": {
            "method": "GET",
            "header": [{ "key": "Authorization", "value": "Bearer {{apiKey}}" }],
            "url": "{{baseUrl}}/api/v1/clients/{{clientId}}"
          }
        }
      ]
    },
    {
      "name": "Portal público",
      "item": [
        {
          "name": "Config portal",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/api/public/portal/config?c={{companyId}}"
          }
        },
        {
          "name": "Request OTP",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"phone\": \"{{phone}}\",\n  \"company_id\": {{companyId}}\n}"
            },
            "url": "{{baseUrl}}/api/public/portal/request-otp"
          }
        },
        {
          "name": "Verify OTP",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"phone\": \"{{phone}}\",\n  \"code\": \"123456\",\n  \"company_id\": {{companyId}}\n}"
            },
            "url": "{{baseUrl}}/api/public/portal/verify-otp"
          }
        },
        {
          "name": "Me (dashboard)",
          "request": {
            "method": "GET",
            "header": [{ "key": "Authorization", "value": "Bearer {{portalToken}}" }],
            "url": "{{baseUrl}}/api/public/portal/me"
          }
        }
      ]
    }
  ]
}
