{
 "info": {
  "_postman_id": "fa8dbf13-07c8-4d7e-93b2-fede719150fe",
  "name": "Totum Cobrança — API v2 (LGPD)",
  "description": "API v2 com autenticação JWT e identificadores UUID (LGPD). Configure client_id e secret_id nas variáveis da collection.",
  "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
 },
 "event": [
  {
   "listen": "prerequest",
   "script": {
    "type": "text/javascript",
    "exec": [
     "// Auto-renova JWT se necessário",
     "const token = pm.collectionVariables.get('jwt_token');",
     "if (!token) {",
     "    pm.sendRequest({",
     "        url: pm.collectionVariables.get('base_url') + '/Auth',",
     "        method: 'POST',",
     "        header: [{ key: 'Content-Type', value: 'application/json' }],",
     "        body: {",
     "            mode: 'raw',",
     "            raw: JSON.stringify({",
     "                ClientId: pm.collectionVariables.get('client_id'),",
     "                SecretId: pm.collectionVariables.get('secret_id')",
     "            })",
     "        }",
     "    }, function(err, res) {",
     "        if (!err && res.json().Token) {",
     "            pm.collectionVariables.set('jwt_token', res.json().Token);",
     "        }",
     "    });",
     "}"
    ]
   }
  }
 ],
 "variable": [
  {
   "key": "base_url",
   "value": "https://app4.sistematotum.com.br/Homologacao/cobranca/Api/v2",
   "type": "string"
  },
  {
   "key": "client_id",
   "value": "3csistemas",
   "type": "string"
  },
  {
   "key": "secret_id",
   "value": "2oomBZpYeh8U3zGP",
   "type": "string"
  },
  {
   "key": "jwt_token",
   "value": "",
   "type": "string"
  },
  {
   "key": "id_agente",
   "value": "",
   "type": "string"
  }
 ],
 "item": [
  {
   "name": "Autenticação",
   "item": [
    {
     "name": "Auth — Obter JWT",
     "event": [
      {
       "listen": "test",
       "script": {
        "type": "text/javascript",
        "exec": [
         "if (pm.response.code === 200) {",
         "    pm.collectionVariables.set('jwt_token', pm.response.json().Token);",
         "}"
        ]
       }
      }
     ],
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "body": {
       "mode": "raw",
       "raw": "{\n  \"ClientId\": \"{{client_id}}\",\n  \"SecretId\": \"{{secret_id}}\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      },
      "url": {
       "raw": "{{base_url}}/Auth",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "Auth"
       ]
      },
      "description": "Preencha client_id e secret_id nas variáveis da collection. O token JWT será salvo automaticamente."
     },
     "response": []
    }
   ]
  },
  {
   "name": "Geral",
   "item": [
    {
     "name": "Status",
     "request": {
      "method": "GET",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/Status",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "Status"
       ]
      }
     },
     "response": []
    },
    {
     "name": "Consulta Acessos",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ConsultaAcessos",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ConsultaAcessos"
       ]
      }
     },
     "response": []
    }
   ]
  },
  {
   "name": "Consultas",
   "item": [
    {
     "name": "Consulta Débitos — por IdCliente",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ConsultaDebitos",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ConsultaDebitos"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdCliente\": \"18cb0064-bbf4-63e8-6bfa-c8e55d768635\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Consulta Débitos — por IdContrato",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ConsultaDebitos",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ConsultaDebitos"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdContrato\": \"89ee95b0-fee1-cfaa-f974-4f34083c3b04\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Consulta Débitos — por CPFouCNPJ",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ConsultaDebitos",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ConsultaDebitos"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"CPFouCNPJ\": \"123.123.123-87\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Consulta Condições do Acordo",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ConsultaCondicoesAcordo",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ConsultaCondicoesAcordo"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdOferta\": \"89ee95b0-fee1-cfaa-f974-4f34083c3b04\",\n  \"ValorEntrada\": \"1.000,00\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      },
      "description": "Cada opção de Opcoes traz FormasPagamento próprio (ex.: \"PIX\", \"BOLETO\", \"CARTÃO DE CRÉDITO\"). Escolher IdNegociacao + DataEntrada e usar no CadastroAcordo."
     },
     "response": []
    },
    {
     "name": "Consulta Cliente por Telefone",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ConsultaClienteTelefone",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ConsultaClienteTelefone"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"DDDTelefone\": \"21972923945\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Consulta Termo de Acordo",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ConsultaTermoAcordo",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ConsultaTermoAcordo"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdContrato\": \"ee6f854f-0bb9-5786-f661-3b085485bca0\",\n  \"IdAcordo\": \"b88dfd82-faf8-ad2d-5ac3-88677109f3cb\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Detalhe Títulos",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/DetalheTitulos",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "DetalheTitulos"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdContrato\": \"ee6f854f-0bb9-5786-f661-3b085485bca0\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Status do Acordo",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/StatusAcordo",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "StatusAcordo"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdAcordo\": \"b88dfd82-faf8-ad2d-5ac3-88677109f3cb\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    }
   ]
  },
  {
   "name": "Listar",
   "item": [
    {
     "name": "Listar Carteiras",
     "request": {
      "method": "GET",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ListarCarteiras",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ListarCarteiras"
       ]
      }
     },
     "response": []
    },
    {
     "name": "Listar Filas",
     "request": {
      "method": "GET",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ListarFilas",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ListarFilas"
       ]
      }
     },
     "response": []
    },
    {
     "name": "Listar Clientes Fila",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ListarClientesFila",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ListarClientesFila"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdFila\": 1,\n  \"Acordos\": false,\n  \"Agendados\": false\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Listar Documentos",
     "request": {
      "method": "GET",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ListarDocumentos",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ListarDocumentos"
       ]
      }
     },
     "response": []
    },
    {
     "name": "Listar Ocorrências",
     "request": {
      "method": "GET",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ListarOcorrencias",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ListarOcorrencias"
       ]
      }
     },
     "response": []
    },
    {
     "name": "Listar Regras",
     "request": {
      "method": "GET",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ListarRegras",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ListarRegras"
       ]
      }
     },
     "response": []
    }
   ]
  },
  {
   "name": "Negociação",
   "item": [
    {
     "name": "Cadastro do Acordo",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/CadastroAcordo",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "CadastroAcordo"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdOferta\": \"89ee95b0-fee1-cfaa-f974-4f34083c3b04\",\n  \"IdNegociacao\": 1,\n  \"DataEntrada\": \"2026-07-01\",\n  \"FormaPagamento\": \"PIX\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      },
      "description": "FormaPagamento (opcional): usar um dos valores retornados em FormasPagamento do ConsultaCondicoesAcordo. Valores possíveis: \"PIX\", \"BOLETO\", \"CARTÃO DE CRÉDITO\"."
     },
     "response": []
    },
    {
     "name": "Consulta Parcela",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/ConsultaParcela",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "ConsultaParcela"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdAcordo\": \"f4ce3fc0-25f8-e4c8-8e34-74ad3e642b8e\",\n  \"Parcela\": 1\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Cancelar Acordo",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/CancelarAcordo",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "CancelarAcordo"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdAcordo\": \"b88dfd82-faf8-ad2d-5ac3-88677109f3cb\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    }
   ]
  },
  {
   "name": "Processos",
   "item": [
    {
     "name": "Incluir Cliente",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/IncluirCliente",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "IncluirCliente"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"Cliente\": {\n    \"CPFouCNPJ\": \"12312312387\",\n    \"Nome\": \"JOSELITO DA SILVA E SOUZA\",\n    \"DataNascimento\": \"1975-05-02\",\n    \"Sexo\": \"M\"\n  },\n  \"ListaTelefones\": {\n    \"Telefones\": [\n      {\n        \"DDDTelefone\": \"21972923945\",\n        \"Tipo\": \"WhatsApp\",\n        \"Preferecial\": true\n      }\n    ]\n  },\n  \"Contrato\": {\n    \"IdCarteira\": 1,\n    \"Numero\": \"FAT-2024-0001\",\n    \"DataContrato\": \"2024-01-04\"\n  },\n  \"ListaTitulos\": {\n    \"Titulos\": [\n      {\n        \"Parcela\": \"01/03\",\n        \"Documento\": \"Fatura\",\n        \"Numero\": \"FAT-00012024\",\n        \"Emissao\": \"2024-01-01\",\n        \"Vencimento\": \"2024-01-05\",\n        \"Valor\": 100.5\n      }\n    ]\n  }\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Incluir Ocorrência",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/IncluirOcorrencia",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "IncluirOcorrencia"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdContrato\": \"89ee95b0-fee1-cfaa-f974-4f34083c3b04\",\n  \"IdOcorrencia\": \"0011\",\n  \"DataHora\": \"2025-08-14 14:00:00\",\n  \"DDDTelefone\": \"21972923945\",\n  \"Observacao\": \"Cliente solicitou retorno em 2 dias\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Atualizar E-mail",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/AtualizaEmail",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "AtualizaEmail"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdCliente\": \"18cb0064-bbf4-63e8-6bfa-c8e55d768635\",\n  \"Email\": \"joselito@exemplo.com.br\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Atualizar Telefone",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/AtualizaTelefone",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "AtualizaTelefone"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdCliente\": \"18cb0064-bbf4-63e8-6bfa-c8e55d768635\",\n  \"DDDTelefone\": \"21972923945\",\n  \"Tipo\": \"WhatsApp\",\n  \"Observacao\": \"Entre 08:00 e 18:00\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Baixa Contrato",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/BaixaContrato",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "BaixaContrato"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdContrato\": \"89ee95b0-fee1-cfaa-f974-4f34083c3b04\",\n  \"IdMotivo\": \"2\"\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    },
    {
     "name": "Baixa Título",
     "request": {
      "method": "POST",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       },
       {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/BaixaTitulo",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "BaixaTitulo"
       ]
      },
      "body": {
       "mode": "raw",
       "raw": "{\n  \"IdTitulo\": \"11b19d49-fd75-132e-6fdf-1f25ebd21501\",\n  \"IdMotivo\": 2\n}",
       "options": {
        "raw": {
         "language": "json"
        }
       }
      }
     },
     "response": []
    }
   ]
  },
  {
   "name": "Discador",
   "item": [
    {
     "name": "Retorno Ligação (ativa)",
     "request": {
      "method": "GET",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/RetornoLigacao/{{id_agente}}/89ee95b0-fee1-cfaa-f974-4f34083c3b04",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "RetornoLigacao",
        "{{id_agente}}",
        "89ee95b0-fee1-cfaa-f974-4f34083c3b04"
       ]
      },
      "description": "id_agente: ramal do agente. id_contato: UUID do contrato (IdContrato retornado por ConsultaDebitos). Token JWT obrigatório."
     },
     "response": []
    },
    {
     "name": "Retorno Ligação Receptiva",
     "request": {
      "method": "GET",
      "header": [
       {
        "key": "Authorization",
        "value": "Bearer {{jwt_token}}",
        "type": "text"
       }
      ],
      "url": {
       "raw": "{{base_url}}/RetornoLigacaoReceptiva/{{id_agente}}/21972923945",
       "host": [
        "{{base_url}}"
       ],
       "path": [
        "RetornoLigacaoReceptiva",
        "{{id_agente}}",
        "21972923945"
       ]
      },
      "description": "id_agente: ramal do agente. ddd_telefone: número DDD+telefone do cliente (sem formatação). Token JWT obrigatório."
     },
     "response": []
    }
   ]
  }
 ]
}