API Reference
API expuesta en https://api.gurzbrain.ai. Autenticación por Bearer token.
Autenticación
Todas las requests requieren:
Authorization: Bearer gbr_live_...
Formato de API key: gbr_{env}_{40 chars}. Env es live o test. Keys se hashean con SHA256 en la DB, plaintext solo se devuelve una vez al crearse.
Endpoints principales
POST /v1/chat
Prompt al agent. Retorna respuesta + tool_calls ejecutadas.
curl -X POST https://api.gurzbrain.ai/v1/chat \
-H "Authorization: Bearer gbr_live_..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "cuantos proyectos tiene el hub?",
"persona": "default",
"max_iterations": 5
}'
Response:
{
"response": "El hub tiene 31 proyectos...",
"iterations": 2,
"tools_called": ["list_hub_projects", "read_memory"],
"tokens_used": 847,
"duration_sec": 3.2
}
POST /v1/license/check
Phone-home para validar que la license sigue activa. Clientes la llaman cada 24h.
curl -X POST https://api.gurzbrain.ai/v1/license/check \
-H "Authorization: Bearer gbr_live_..." \
-d '{"client_version":"1.0.0","host":"myserver.com"}'
Response:
{
"status": "active",
"next_check_in_hours": 24,
"grace_period_hours": 72,
"latest_model": "llama3.1:8b",
"plan": "pro",
"quota_remaining": 48234
}
GET /v1/tools
Lista las tools disponibles para tu tenant.
POST /v1/prompts/{slug}/render
Renderiza un prompt de la library con variables.
GET /v1/health
Health check público. Returns {"ok":true,"ts":"..."}.
Rate limits
Por plan: - Free: 500 req/mes - Starter: 5,000 req/mes - Pro: 50,000 req/mes - Business: 500,000 req/mes - Enterprise: ilimitado con contrato
Headers de response incluyen:
X-RateLimit-Limit: 50000
X-RateLimit-Remaining: 48234
X-RateLimit-Reset: 1735689600
Errores
| Status | Significado |
|---|---|
| 401 | Bearer token inválido o revocado |
| 403 | Tenant suspendido o plan no incluye endpoint |
| 429 | Rate limit excedido |
| 500 | Error interno |
Body de error:
{"error":"rate_limited","message":"Quota mensual agotada (50000/50000)","retry_after":2592000}