{
  "info": {
    "name": "Avalio API v1",
    "description": "API REST de Avalio: riesgo de cheques y de cliente por CUIT, con datos oficiales (BCRA, ARCA, Boletin Oficial). Configura las variables baseUrl, apiKeyTest y apiKeyLive. Spec OpenAPI: {{baseUrl}}/api/v1/openapi",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://avalio.com.ar" },
    { "key": "apiKeyTest", "value": "avk_test_xxxxxxxxxxxxxxxxxxxxxxxx" },
    { "key": "apiKeyLive", "value": "avk_live_xxxxxxxxxxxxxxxxxxxxxxxx" }
  ],
  "item": [
    {
      "name": "Riesgo de cliente (sandbox - APOC)",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Authorization", "value": "Bearer {{apiKeyTest}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": { "raw": "{{baseUrl}}/api/v1/riesgo", "host": ["{{baseUrl}}"], "path": ["api", "v1", "riesgo"] },
        "body": { "mode": "raw", "raw": "{\n  \"cuit\": \"30700000040\"\n}" },
        "description": "Caso canonico de sandbox: figura en APOC, decision = rechazar. No consume credito."
      }
    },
    {
      "name": "Riesgo de cliente (sandbox - aprobar)",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Authorization", "value": "Bearer {{apiKeyTest}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": { "raw": "{{baseUrl}}/api/v1/riesgo", "host": ["{{baseUrl}}"], "path": ["api", "v1", "riesgo"] },
        "body": { "mode": "raw", "raw": "{\n  \"cuit\": \"30700000016\"\n}" }
      }
    },
    {
      "name": "Riesgo de cliente (produccion)",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Authorization", "value": "Bearer {{apiKeyLive}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": { "raw": "{{baseUrl}}/api/v1/riesgo", "host": ["{{baseUrl}}"], "path": ["api", "v1", "riesgo"] },
        "body": { "mode": "raw", "raw": "{\n  \"cuit\": \"30711039356\",\n  \"monto\": 4800000,\n  \"plazo\": 60\n}" },
        "description": "Datos reales. Consume 1 credito por CUIT (idempotente)."
      }
    },
    {
      "name": "Evaluar un cheque",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Authorization", "value": "Bearer {{apiKeyLive}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": { "raw": "{{baseUrl}}/api/v1/evaluate", "host": ["{{baseUrl}}"], "path": ["api", "v1", "evaluate"] },
        "body": { "mode": "raw", "raw": "{\n  \"cuit\": \"30711039356\",\n  \"monto\": 4800000,\n  \"plazo\": 60\n}" }
      }
    },
    {
      "name": "Analizar y persistir un cheque",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Authorization", "value": "Bearer {{apiKeyLive}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": { "raw": "{{baseUrl}}/api/v1/analisis", "host": ["{{baseUrl}}"], "path": ["api", "v1", "analisis"] },
        "body": { "mode": "raw", "raw": "{\n  \"cuit\": \"30711039356\",\n  \"monto\": 4800000,\n  \"fecha_pago\": \"2026-03-11\"\n}" }
      }
    },
    {
      "name": "Recuperar un analisis por id",
      "request": {
        "method": "GET",
        "header": [ { "key": "Authorization", "value": "Bearer {{apiKeyLive}}" } ],
        "url": { "raw": "{{baseUrl}}/api/v1/analisis/:id", "host": ["{{baseUrl}}"], "path": ["api", "v1", "analisis", ":id"], "variable": [ { "key": "id", "value": "" } ] }
      }
    },
    {
      "name": "Buscar el CUIT de una empresa por nombre",
      "request": {
        "method": "GET",
        "header": [ { "key": "Authorization", "value": "Bearer {{apiKeyLive}}" } ],
        "url": {
          "raw": "{{baseUrl}}/api/v1/empresas/buscar?nombre=Molinos Rio de la Plata",
          "host": ["{{baseUrl}}"], "path": ["api", "v1", "empresas", "buscar"],
          "query": [ { "key": "nombre", "value": "Molinos Rio de la Plata" } ]
        },
        "description": "Resuelve el/los CUIT de una sociedad por su razon social (Boletin Oficial). No consume credito."
      }
    },
    {
      "name": "Riesgo por lote (batch asincrono, sandbox)",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Authorization", "value": "Bearer {{apiKeyTest}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": { "raw": "{{baseUrl}}/api/v1/riesgo/lote", "host": ["{{baseUrl}}"], "path": ["api", "v1", "riesgo", "lote"] },
        "body": { "mode": "raw", "raw": "{\n  \"cuits\": [\"30700000016\", \"30700000040\"]\n}" },
        "description": "Encola hasta 500 CUITs y responde 202 con un job_id. Consultá el resultado en /riesgo/lote/{id} o recibilo por el webhook 'lote.completado'."
      }
    },
    {
      "name": "Estado + resultado de un lote",
      "request": {
        "method": "GET",
        "header": [ { "key": "Authorization", "value": "Bearer {{apiKeyTest}}" } ],
        "url": {
          "raw": "{{baseUrl}}/api/v1/riesgo/lote/:id",
          "host": ["{{baseUrl}}"], "path": ["api", "v1", "riesgo", "lote", ":id"],
          "variable": [ { "key": "id", "value": "" } ]
        },
        "description": "Estado, progreso y resultados del lote. Agrega ?formato=csv para descargar."
      }
    },
    {
      "name": "Historial de evaluaciones (CSV para Excel/Power BI)",
      "request": {
        "method": "GET",
        "header": [ { "key": "Authorization", "value": "Bearer {{apiKeyLive}}" } ],
        "url": {
          "raw": "{{baseUrl}}/api/v1/evaluations?limite=500&formato=json",
          "host": ["{{baseUrl}}"], "path": ["api", "v1", "evaluations"],
          "query": [ { "key": "limite", "value": "500" }, { "key": "formato", "value": "json" } ]
        },
        "description": "Historial de la empresa duena de la clave (aislado por company_id). formato=csv|tsv|html para planillas. No consume credito."
      }
    },
    {
      "name": "Monitorear un CUIT (seguimiento + webhook)",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Authorization", "value": "Bearer {{apiKeyLive}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": { "raw": "{{baseUrl}}/api/v1/monitor", "host": ["{{baseUrl}}"], "path": ["api", "v1", "monitor"] },
        "body": { "mode": "raw", "raw": "{\n  \"cuit\": \"30711039356\",\n  \"cliente\": \"ACME SA\"\n}" },
        "description": "Empieza a vigilar un CUIT. Si su riesgo empeora, dispara el webhook 'emisor.deterioro'. Requiere plan Business."
      }
    },
    {
      "name": "Verificar la firma de una respuesta",
      "request": {
        "method": "POST",
        "header": [ { "key": "Content-Type", "value": "application/json" } ],
        "url": { "raw": "{{baseUrl}}/api/v1/verificar", "host": ["{{baseUrl}}"], "path": ["api", "v1", "verificar"] },
        "body": { "mode": "raw", "raw": "{\n  \"cuit\": \"30711039356\",\n  \"score\": 82,\n  \"decision\": \"aprobar\",\n  \"modo\": \"live\",\n  \"version\": \"v1\",\n  \"generado\": \"2026-10-22T12:00:00.000Z\",\n  \"hmac\": \"<el valor firma.hmac de la respuesta>\"\n}" },
        "description": "Prueba publica (sin API key): confirma que una decision de /riesgo la emitio Avalio y no fue alterada. Reenvia el bloque firma.hmac + los campos firmados."
      }
    },
    {
      "name": "Riesgo desde planilla (CSV, sandbox)",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{baseUrl}}/api/v1/riesgo/consulta?cuit=30700000040&key={{apiKeyTest}}&formato=csv",
          "host": ["{{baseUrl}}"],
          "path": ["api", "v1", "riesgo", "consulta"],
          "query": [
            { "key": "cuit", "value": "30700000040" },
            { "key": "key", "value": "{{apiKeyTest}}" },
            { "key": "formato", "value": "csv" }
          ]
        },
        "description": "Riesgo de un CUIT desde una planilla (=IMPORTDATA / Desde la Web). La clave va en la URL; para datos reales usá una clave de scope 'riesgo'. Cobra 1 credito por CUIT y cachea 12 h."
      }
    },
    {
      "name": "Spec OpenAPI",
      "request": {
        "method": "GET",
        "header": [],
        "url": { "raw": "{{baseUrl}}/api/v1/openapi", "host": ["{{baseUrl}}"], "path": ["api", "v1", "openapi"] }
      }
    },
    {
      "name": "MCP - tools/list",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Authorization", "value": "Bearer {{apiKeyTest}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": { "raw": "{{baseUrl}}/api/mcp", "host": ["{{baseUrl}}"], "path": ["api", "mcp"] },
        "body": { "mode": "raw", "raw": "{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"tools/list\"\n}" },
        "description": "Servidor MCP (JSON-RPC 2.0). Lista las tools: riesgo_cliente, analizar_cheque, consultar_cuit."
      }
    },
    {
      "name": "MCP - tools/call riesgo_cliente (sandbox)",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Authorization", "value": "Bearer {{apiKeyTest}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "url": { "raw": "{{baseUrl}}/api/mcp", "host": ["{{baseUrl}}"], "path": ["api", "mcp"] },
        "body": { "mode": "raw", "raw": "{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 2,\n  \"method\": \"tools/call\",\n  \"params\": {\n    \"name\": \"riesgo_cliente\",\n    \"arguments\": { \"cuit\": \"30700000040\" }\n  }\n}" },
        "description": "Llama la tool riesgo_cliente contra un CUIT de sandbox (gratis con clave avk_test_)."
      }
    }
  ]
}
