{"openapi":"3.1.0","info":{"title":"AR Tools API","version":"0.1.0","description":"Datos y validaciones argentinas para agentes de IA. Cobro por créditos prepagos. También disponible como servidor MCP remoto en /mcp."},"servers":[{"url":"https://ar-tools-api-103907796853.us-east1.run.app"}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"API key con prefijo ak_"}}},"security":[{"apiKey":[]}],"paths":{"/v1/keys":{"post":{"operationId":"crearKeyDePrueba","summary":"Crear una API key de prueba con 50 créditos (sin registro)","security":[],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Key creada. El campo `key` se muestra una sola vez.","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"key_id":{"type":"string"},"credits":{"type":"integer"}}}}}},"429":{"description":"Demasiadas keys creadas desde esta IP","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}}}}},"/v1/balance":{"get":{"operationId":"consultarSaldo","summary":"Saldo de créditos y últimos movimientos de la key","responses":{"200":{"description":"Saldo","content":{"application/json":{"schema":{"type":"object","properties":{"key_id":{"type":"string"},"credits":{"type":"integer"},"recent":{"type":"array","items":{"type":"object"}}}}}}},"401":{"description":"Key faltante o inválida","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}}}}},"/v1/packs":{"get":{"operationId":"listarPacks","summary":"Packs de créditos a la venta (producto, créditos, precio)","security":[],"responses":{"200":{"description":"Packs","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/checkout":{"post":{"operationId":"crearCheckout","summary":"Crea un checkout de Polar para recargar la key autenticada y devuelve checkout_url para mostrar al usuario","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"credits":{"type":"integer","description":"Cantidad deseada; se elige el pack más chico que la cubre"},"product_id":{"type":"string","description":"Pack puntual, de /v1/packs"},"email":{"type":"string","description":"Email del comprador, para precargar el checkout"}}}}}},"responses":{"201":{"description":"Checkout creado","content":{"application/json":{"schema":{"type":"object","properties":{"checkout_url":{"type":"string"},"expires_at":{"type":"string"},"pack":{"type":"object"}}}}}},"401":{"description":"Key faltante o inválida","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"503":{"description":"Compra no habilitada","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}}}}},"/v1/tools":{"get":{"operationId":"listarTools","summary":"Lista las tools disponibles con su costo en créditos","security":[],"responses":{"200":{"description":"Tools","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/tools/validar_cuit":{"post":{"operationId":"validar_cuit","summary":"Validar CUIT/CUIL","description":"Valida un CUIT o CUIL argentino (11 dígitos, con o sin guiones): chequea el dígito verificador y devuelve el tipo (persona física o jurídica) y el formato canónico XX-XXXXXXXX-X.\n\nCosto: 1 crédito(s) por llamada exitosa.","x-credits-cost":1,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"cuit":{"type":"string","minLength":11,"maxLength":13,"description":"CUIT/CUIL, ej. 20-12345678-6 o 20123456786"}},"required":["cuit"]},"example":{"cuit":"30-50001091-2"}}}},"responses":{"200":{"description":"Resultado","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object"},"credits":{"type":"object","properties":{"cost":{"type":"integer"},"balance":{"type":"integer"}}}}}}}},"400":{"description":"Input inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"401":{"description":"Key faltante o inválida","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"402":{"description":"Créditos insuficientes. Incluye `checkout_url` para recargar.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"502":{"description":"Falló un proveedor externo. No se cobra.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}}}}},"/v1/tools/validar_cbu":{"post":{"operationId":"validar_cbu","summary":"Validar CBU/CVU","description":"Valida un CBU o CVU argentino de 22 dígitos: chequea ambos dígitos verificadores e identifica la entidad bancaria (o billetera virtual si es CVU), la sucursal y el número de cuenta.\n\nCosto: 1 crédito(s) por llamada exitosa.","x-credits-cost":1,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"cbu":{"type":"string","minLength":22,"maxLength":30,"description":"CBU/CVU de 22 dígitos, con o sin espacios"}},"required":["cbu"]},"example":{"cbu":"0070999000004012345672"}}}},"responses":{"200":{"description":"Resultado","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object"},"credits":{"type":"object","properties":{"cost":{"type":"integer"},"balance":{"type":"integer"}}}}}}}},"400":{"description":"Input inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"401":{"description":"Key faltante o inválida","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"402":{"description":"Créditos insuficientes. Incluye `checkout_url` para recargar.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"502":{"description":"Falló un proveedor externo. No se cobra.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}}}}},"/v1/tools/normalizar_telefono_ar":{"post":{"operationId":"normalizar_telefono_ar","summary":"Normalizar teléfono argentino","description":"Toma un teléfono argentino escrito de cualquier forma (con 0, con 15, con +54, con espacios o guiones) y devuelve el formato E.164, el formato para WhatsApp, el formato nacional y si es celular o fijo.\n\nCosto: 1 crédito(s) por llamada exitosa.","x-credits-cost":1,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"telefono":{"type":"string","minLength":6,"maxLength":30,"description":"Teléfono, ej. 011 15 2345-6789 o +54 9 11 2345 6789"}},"required":["telefono"]},"example":{"telefono":"011 15 2345-6789"}}}},"responses":{"200":{"description":"Resultado","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object"},"credits":{"type":"object","properties":{"cost":{"type":"integer"},"balance":{"type":"integer"}}}}}}}},"400":{"description":"Input inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"401":{"description":"Key faltante o inválida","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"402":{"description":"Créditos insuficientes. Incluye `checkout_url` para recargar.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"502":{"description":"Falló un proveedor externo. No se cobra.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}}}}},"/v1/tools/cotizacion_dolar":{"post":{"operationId":"cotizacion_dolar","summary":"Cotización del dólar en Argentina","description":"Devuelve la cotización actual del dólar en Argentina (compra y venta en pesos) para una casa en particular o para todas: oficial, blue, MEP (bolsa), contado con liquidación, mayorista, cripto y tarjeta.\n\nCosto: 2 crédito(s) por llamada exitosa.","x-credits-cost":2,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"casa":{"description":"Casa de cambio. Si se omite, devuelve todas.","type":"string","enum":["oficial","blue","bolsa","contadoconliqui","mayorista","cripto","tarjeta"]}}},"example":{"casa":"blue"}}}},"responses":{"200":{"description":"Resultado","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object"},"credits":{"type":"object","properties":{"cost":{"type":"integer"},"balance":{"type":"integer"}}}}}}}},"400":{"description":"Input inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"401":{"description":"Key faltante o inválida","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"402":{"description":"Créditos insuficientes. Incluye `checkout_url` para recargar.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"502":{"description":"Falló un proveedor externo. No se cobra.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}}}}},"/v1/tools/ejecutar":{"post":{"operationId":"ejecutar","summary":"Ejecutar código contra la API (Code Mode)","description":"Corre JavaScript en un sandbox con un objeto `api` ya autenticado: una función async por tool, mismos parámetros y mismo resultado que llamarla directo. Ideal para lotes (validar 50 CBUs, armar 20 cronogramas) o para encadenar llamadas sin volver al modelo. El código puede usar await, console.log y return; el valor retornado vuelve en `resultado`. Costo: 1 crédito por ejecución + la suma de las llamadas internas. Máximo 100 llamadas y 15 s. Sin acceso a red, archivos ni módulos.\n\nFunciones disponibles:\napi.validarCuit({\"cuit\":\"30-50001091-2\"}) → 1 crédito(s): Validar CUIT/CUIL\napi.validarCbu({\"cbu\":\"0070999000004012345672\"}) → 1 crédito(s): Validar CBU/CVU\napi.normalizarTelefonoAr({\"telefono\":\"011 15 2345-6789\"}) → 1 crédito(s): Normalizar teléfono argentino\napi.cotizacionDolar({\"casa\":\"blue\"}) → 2 crédito(s): Cotización del dólar en Argentina\n\nCosto: 1 crédito(s) por llamada exitosa.","x-credits-cost":1,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"codigo":{"type":"string","minLength":1,"maxLength":20000,"description":"JavaScript. Ej: const r = await api.validarCuit({cuit:'20-12345678-6'}); return r.valido;"},"timeout_ms":{"default":5000,"description":"Tiempo máximo total en milisegundos","type":"integer","minimum":100,"maximum":15000}},"required":["codigo"]},"example":{"codigo":"const cuits = ['20-12345678-6','30-50001091-2'];\nconst r = [];\nfor (const c of cuits) r.push(await api.validarCuit({ cuit: c }));\nreturn r.filter(x => x.valido).map(x => x.formateado);"}}}},"responses":{"200":{"description":"Resultado","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object"},"credits":{"type":"object","properties":{"cost":{"type":"integer"},"balance":{"type":"integer"}}}}}}}},"400":{"description":"Input inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"401":{"description":"Key faltante o inválida","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"402":{"description":"Créditos insuficientes. Incluye `checkout_url` para recargar.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}},"502":{"description":"Falló un proveedor externo. No se cobra.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error","message"],"additionalProperties":true}}}}}}}}}