{"openapi":"3.1.0","info":{"title":"DataAtlas","description":"Descubrimiento y cobertura de datos sobre el modelo canónico.","version":"0.18.0"},"paths":{"/coverage/tenants/{tenant_id}":{"get":{"tags":["coverage"],"summary":"Coverage Summary","description":"402 si Users suspendió al tenant (el corte cubre todo lo tenant-scoped).","operationId":"coverage_summary","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantCoverageSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["tenant"]}},"/coverage/tenants/{tenant_id}/tables":{"get":{"tags":["coverage"],"summary":"Coverage Tables","description":"402 si Users suspendió al tenant (el corte cubre todo lo tenant-scoped).","operationId":"coverage_tables","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"domain","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain"}},{"name":"freshness","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Freshness"}},{"name":"order_by","in":"query","required":false,"schema":{"type":"string","default":"row_count","title":"Order By"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantTablesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["tenant"]}},"/coverage/tables/{table_fqn}/tenants":{"get":{"tags":["coverage"],"summary":"Table Tenants","operationId":"table_tenants","parameters":[{"name":"table_fqn","in":"path","required":true,"schema":{"type":"string","title":"Table Fqn"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TableTenantsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/coverage/reconcile":{"post":{"tags":["coverage"],"summary":"Reconcile On Demand","operationId":"reconcile_on_demand","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReconcileRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReconcileResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/search":{"post":{"tags":["discovery"],"summary":"Search","description":"402 si Users suspendió al tenant (el corte cubre todo lo tenant-scoped).","operationId":"search","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["tenant"]}},"/ask":{"post":{"tags":["discovery"],"summary":"Ask","description":"402 si Users suspendió al tenant (el corte cubre todo lo tenant-scoped).","operationId":"ask","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["tenant"]}},"/tables/{table_fqn}":{"get":{"tags":["tables"],"summary":"Table Card","description":"Ficha completa: metadata del registry + cobertura del tenant + linaje + sample_query.\n402 si Users suspendió al tenant (el corte cubre también el catálogo).","operationId":"table_card","parameters":[{"name":"table_fqn","in":"path","required":true,"schema":{"type":"string","title":"Table Fqn"}},{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TableCard"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["tenant"]}},"/tables/{table_fqn}/related":{"get":{"tags":["tables"],"summary":"Table Related","description":"Con qué tablas se une esta y por qué columna — el eslabón que le falta a\nun agente para encadenar SQL sin adivinar. Derivado del catálogo, anotado\ncon qué destinos tienen datos de ESTE tenant. 402 si el tenant está suspendido.","operationId":"table_related","parameters":[{"name":"table_fqn","in":"path","required":true,"schema":{"type":"string","title":"Table Fqn"}},{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RelatedTablesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["tenant"]}},"/tables/{table_fqn}/preview":{"get":{"tags":["tables"],"summary":"Table Preview","description":"402 si Users suspendió al tenant (el corte cubre todo lo tenant-scoped).","operationId":"table_preview","parameters":[{"name":"table_fqn","in":"path","required":true,"schema":{"type":"string","title":"Table Fqn"}},{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["tenant"]}},"/entities":{"get":{"tags":["entities"],"summary":"List Entities","description":"Entidades canónicas declaradas. Objeto abierto de Refinery → lo mapeamos\ndefensivamente a un schema cerrado para el agente.","operationId":"list_entities","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntitiesOut"}}}}},"x-rol-requerido":["tenant"]}},"/feedback":{"post":{"tags":["feedback"],"summary":"Feedback","description":"402 si Users suspendió al tenant (el corte cubre todo lo tenant-scoped).","operationId":"feedback","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["tenant"]}},"/admin/settings":{"get":{"tags":["admin"],"summary":"Get All Settings","description":"Los valores secretos (api_key, password, dsn, token) salen enmascarados:\nuna vez guardados, nunca vuelven a mostrarse enteros — ni al admin.","operationId":"get_all_settings","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get All Settings"}}}}},"x-rol-requerido":["admin"]},"put":{"tags":["admin"],"summary":"Put Setting","description":"Las claves que rompen si están mal (refinery.pg_dsn) se validan con una\nconexión real ANTES de guardar: si no conecta, 400 y no se guarda nada.","operationId":"put_setting","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettingUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettingUpdated"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/api-keys":{"get":{"tags":["admin"],"summary":"List Api Keys","operationId":"list_api_keys","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyList"}}}}},"x-rol-requerido":["admin"]},"post":{"tags":["admin"],"summary":"Create Api Key","operationId":"create_api_key","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreated"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["keys:emit","admin"]}},"/admin/api-keys/{key_id}":{"delete":{"tags":["admin"],"summary":"Revoke Api Key","operationId":"revoke_api_key","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Key Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/asks":{"get":{"tags":["admin"],"summary":"Recent Asks","description":"Log de preguntas con filtros y búsqueda (q busca en pregunta y respuesta).","operationId":"recent_asks","parameters":[{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Q"}},{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}},{"name":"caller_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Caller Name"}},{"name":"language","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language"}},{"name":"composer_used","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Composer Used"}},{"name":"found","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Found"}},{"name":"hours","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Hours"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AsksResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/feedback/missing-report":{"get":{"tags":["admin"],"summary":"Missing Report","description":"Reporte de señales 'missing': gaps de sinónimos/descripciones → registry Fase 1.","operationId":"missing_report","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":7,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissingReport"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/jobs/ranking":{"post":{"tags":["admin"],"summary":"Run Ranking Job","operationId":"run_ranking_job","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RankingJobResult"}}}}},"x-rol-requerido":["admin"]}},"/admin/stats":{"get":{"tags":["admin"],"summary":"Get Stats","operationId":"get_stats","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageStats"}}}}},"x-rol-requerido":["admin"]}},"/admin/audit":{"get":{"tags":["admin"],"summary":"Admin Audit","description":"Auditoría append-only de acciones admin, con verificación de integridad\nde la cadena de hashes en cada lectura.","operationId":"admin_audit","parameters":[{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Q"}},{"name":"caller_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Caller Name"}},{"name":"hours","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Hours"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditLog"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/usage":{"get":{"tags":["admin"],"summary":"Api Usage","description":"Consumo por credencial (search/ask/preview por día agregado): la base de\nmedición para facturar u observar a cada cliente/sistema consumidor.","operationId":"api_usage","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/resources":{"get":{"tags":["admin"],"summary":"Get Resources","description":"Uso de recursos en el tiempo (CPU, memoria, disco, IOPS, presión de la API).\nBase para evaluar capacidad y, a futuro, para las alarmas por umbral.","operationId":"get_resources","parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"integer","default":24,"title":"Hours"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceHistory"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/health":{"get":{"tags":["admin"],"summary":"Get Health","operationId":"get_health","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthReport"}}}}},"x-rol-requerido":["admin"]}},"/admin/repair/{action}":{"post":{"tags":["admin"],"summary":"Post Repair","operationId":"post_repair","parameters":[{"name":"action","in":"path","required":true,"schema":{"type":"string","title":"Action"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RepairResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/connections":{"get":{"tags":["admin"],"summary":"Get Connections","operationId":"get_connections","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectionsList"}}}}},"x-rol-requerido":["admin"]},"post":{"tags":["admin"],"summary":"Post Connection","operationId":"post_connection","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectionCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectionCreated"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/connections/{conn_id}/test":{"post":{"tags":["admin"],"summary":"Post Connection Test","operationId":"post_connection_test","parameters":[{"name":"conn_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Conn Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectionTest"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/connections/{conn_id}/activate":{"post":{"tags":["admin"],"summary":"Post Connection Activate","operationId":"post_connection_activate","parameters":[{"name":"conn_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Conn Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/connections/deactivate":{"post":{"tags":["admin"],"summary":"Post Connections Deactivate","operationId":"post_connections_deactivate","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}}},"x-rol-requerido":["admin"]}},"/admin/connections/{conn_id}":{"delete":{"tags":["admin"],"summary":"Delete Connection","operationId":"delete_connection","parameters":[{"name":"conn_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Conn Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["admin"]}},"/admin/reconciliation-runs":{"get":{"tags":["admin"],"summary":"Reconciliation Runs","operationId":"reconciliation_runs","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReconciliationRunsResponse"}}}}},"x-rol-requerido":["admin"]}},"/api/internal/portal-session":{"post":{"tags":["internal"],"summary":"Create Portal Session","description":"Handoff del Portal para Users: recibe el tenant_uuid (que Users resolvió\nde SU sesión, nunca del navegador) y devuelve una URL de un solo uso y corta\nvida que abre el Portal del cliente ya autenticado. Solo se guarda el hash\ndel token. 404 si el tenant no está aprovisionado en Atlas: eso es un\ndesfasaje de aprovisionamiento, no un error del cliente — se grita en el log.","operationId":"create_portal_session","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalSessionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalSessionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["provisioning","admin"]}},"/api/internal/provision":{"post":{"tags":["internal"],"summary":"Provision Tenant","description":"Alta (o actualización de metadata) de un tenant. Idempotente por\ntenant_uuid: reintentar ante timeout es seguro.","operationId":"provision_tenant","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["provisioning","admin"]}},"/api/internal/tenants/estado":{"post":{"tags":["internal"],"summary":"Tenant State Event","description":"Punto de corte. El vocabulario del evento lo publica Users (2.11.0,\nEventoDeTenant): sin_creditos/suspendido frenan el cómputo del tenant (402\nen search/ask/preview) y silencian sus alertas; registrado/con_creditos/\nhabilitado lo restituyen. La versión es monotónica: un evento repetido o\nviejo no pisa uno nuevo. Un evento desconocido da 400 — jamás un 200 mudo.","operationId":"tenant_state_event","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantStateEvent"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["provisioning","admin"]}},"/api/internal/tenants/{tenant_uuid}":{"get":{"tags":["internal"],"summary":"Get Tenant","operationId":"get_tenant","parameters":[{"name":"tenant_uuid","in":"path","required":true,"schema":{"type":"string","title":"Tenant Uuid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-rol-requerido":["provisioning","admin"]}},"/api/auth/token":{"post":{"tags":["auth"],"summary":"Exchange User Token","description":"Canjea el JWT del usuario (header `Authorization: Bearer <jwt de Clerk>`) por\nun token corto scoped al tenant del usuario. 401 ante cualquier fallo de\nidentidad (uniforme, sin revelar cuál); 403 si el usuario está autenticado pero\nsu empresa no tiene producto o está suspendida; 502 si Users no responde.","operationId":"exchange_user_token","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserTokenResponse"}}}}},"x-rol-requerido":["tenant"]}},"/healthz":{"get":{"summary":"Healthz","operationId":"healthz","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthzResponse"}}}}},"security":[],"x-rol-requerido":["publico"]}},"/whoami":{"get":{"summary":"Whoami","description":"El alcance de TU credencial, dicho por el sistema: rol, tenant al que\nestá acotada y qué familias de operaciones puede llamar. Reemplaza\n«probá endpoints hasta entender» por una llamada, y permite verificar\nuna credencial recién emitida en vez de suponerla.","operationId":"whoami","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhoAmI"}}}}},"x-rol-requerido":["autenticado"]}},"/metrics":{"get":{"summary":"Get Metrics","operationId":"get_metrics","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessMetrics"}}}}},"x-rol-requerido":["admin"]}}},"components":{"schemas":{"ApiKeyCreate":{"properties":{"name":{"type":"string","title":"Name"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"is_admin":{"type":"boolean","title":"Is Admin","default":false},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes","default":[]}},"type":"object","required":["name"],"title":"ApiKeyCreate"},"ApiKeyCreated":{"properties":{"key_id":{"type":"string","title":"Key Id"},"token":{"type":"string","title":"Token"}},"type":"object","required":["key_id","token"],"title":"ApiKeyCreated"},"ApiKeyInfo":{"properties":{"key_id":{"type":"string","title":"Key Id"},"name":{"type":"string","title":"Name"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"is_admin":{"type":"boolean","title":"Is Admin"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes","default":[]},"created_at":{"type":"string","format":"date-time","title":"Created At"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At"}},"type":"object","required":["key_id","name","is_admin","created_at"],"title":"ApiKeyInfo"},"ApiKeyList":{"properties":{"keys":{"items":{"$ref":"#/components/schemas/ApiKeyInfo"},"type":"array","title":"Keys","default":[]}},"type":"object","title":"ApiKeyList"},"AskLogEntry":{"properties":{"ask_id":{"type":"string","format":"uuid","title":"Ask Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"caller":{"type":"string","title":"Caller"},"question":{"type":"string","title":"Question"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language"},"answer_mode":{"type":"string","title":"Answer Mode"},"composer_used":{"type":"boolean","title":"Composer Used"},"latency_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Latency Ms"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"feedback_count":{"type":"integer","title":"Feedback Count"},"found":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Found"},"answer_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Answer Text"},"items":{"items":{"$ref":"#/components/schemas/CandidateRef"},"type":"array","title":"Items","default":[]}},"type":"object","required":["ask_id","tenant_id","caller","question","answer_mode","composer_used","created_at","feedback_count"],"title":"AskLogEntry"},"AskRequest":{"properties":{"question":{"type":"string","maxLength":500,"minLength":2,"title":"Question"},"tenant_id":{"type":"string","title":"Tenant Id"},"include_empty":{"type":"boolean","title":"Include Empty","default":false},"answer_mode":{"type":"string","pattern":"^(structured|natural)$","title":"Answer Mode","default":"structured"},"top_k":{"type":"integer","maximum":20.0,"minimum":1.0,"title":"Top K","default":5}},"type":"object","required":["question","tenant_id"],"title":"AskRequest"},"AskResponse":{"properties":{"ask_id":{"type":"string","title":"Ask Id"},"found":{"type":"boolean","title":"Found"},"not_found_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Not Found Reason"},"warehouse":{"anyOf":[{"$ref":"#/components/schemas/WarehouseRef"},{"type":"null"}]},"language":{"type":"string","title":"Language"},"answer_mode":{"type":"string","title":"Answer Mode"},"answer_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Answer Text"},"composer_fallback_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Composer Fallback Reason"},"candidates":{"items":{"$ref":"#/components/schemas/Candidate"},"type":"array","title":"Candidates","default":[]},"empty_candidates":{"items":{"$ref":"#/components/schemas/Candidate"},"type":"array","title":"Empty Candidates","default":[]},"tenant_domains_with_data":{"items":{"type":"string"},"type":"array","title":"Tenant Domains With Data","default":[]},"notes":{"items":{"type":"string"},"type":"array","title":"Notes","default":[]},"latency_ms":{"type":"integer","title":"Latency Ms"}},"type":"object","required":["ask_id","found","language","answer_mode","latency_ms"],"title":"AskResponse"},"AskStats":{"properties":{"total":{"type":"integer","title":"Total"},"last_7d":{"type":"integer","title":"Last 7D"},"with_composer":{"type":"integer","title":"With Composer"},"composer_fallbacks":{"type":"integer","title":"Composer Fallbacks"},"without_results":{"type":"integer","title":"Without Results"},"p50_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"P50 Ms"},"p95_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"P95 Ms"}},"type":"object","required":["total","last_7d","with_composer","composer_fallbacks","without_results"],"title":"AskStats"},"AsksResponse":{"properties":{"asks":{"items":{"$ref":"#/components/schemas/AskLogEntry"},"type":"array","title":"Asks","default":[]}},"type":"object","title":"AsksResponse"},"AuditEntry":{"properties":{"audit_id":{"type":"integer","title":"Audit Id"},"ts":{"type":"string","format":"date-time","title":"Ts"},"caller":{"type":"string","title":"Caller"},"ip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip"},"method":{"type":"string","title":"Method"},"path":{"type":"string","title":"Path"},"status":{"type":"integer","title":"Status"},"detail":{"additionalProperties":true,"type":"object","title":"Detail","default":{}},"entry_hash":{"type":"string","title":"Entry Hash"}},"type":"object","required":["audit_id","ts","caller","method","path","status","entry_hash"],"title":"AuditEntry"},"AuditLog":{"properties":{"entries":{"items":{"$ref":"#/components/schemas/AuditEntry"},"type":"array","title":"Entries","default":[]},"chain_ok":{"type":"boolean","title":"Chain Ok"},"chain_entries":{"type":"integer","title":"Chain Entries"}},"type":"object","required":["chain_ok","chain_entries"],"title":"AuditLog"},"CallerUsage":{"properties":{"caller":{"type":"string","title":"Caller"},"search":{"type":"integer","title":"Search","default":0},"ask":{"type":"integer","title":"Ask","default":0},"preview":{"type":"integer","title":"Preview","default":0},"total":{"type":"integer","title":"Total","default":0}},"type":"object","required":["caller"],"title":"CallerUsage"},"Candidate":{"properties":{"fqn":{"type":"string","title":"Fqn"},"score":{"type":"number","title":"Score"},"description":{"type":"string","title":"Description","default":""},"why":{"items":{"$ref":"#/components/schemas/WhyItem"},"type":"array","title":"Why","default":[]},"coverage":{"anyOf":[{"$ref":"#/components/schemas/CoverageFacts"},{"type":"null"}]},"sample_query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sample Query"},"populated":{"type":"boolean","title":"Populated"}},"type":"object","required":["fqn","score","populated"],"title":"Candidate"},"CandidateRef":{"properties":{"fqn":{"type":"string","title":"Fqn"},"score":{"type":"number","title":"Score"}},"type":"object","required":["fqn","score"],"title":"CandidateRef"},"ColumnInfo":{"properties":{"name":{"type":"string","title":"Name"},"logical_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logical Type"},"physical_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Physical Type"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"},"catalog_ref":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Catalog Ref"},"description":{"type":"string","title":"Description","default":""},"synonyms":{"items":{"type":"string"},"type":"array","title":"Synonyms","default":[]},"is_sensitive":{"type":"boolean","title":"Is Sensitive","default":false},"is_pk":{"type":"boolean","title":"Is Pk","default":false},"is_required":{"type":"boolean","title":"Is Required","default":false}},"type":"object","required":["name"],"title":"ColumnInfo"},"ConnectionCreate":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"engine":{"type":"string","pattern":"^(duckdb|postgres|snowflake|clickhouse|databricks)$","title":"Engine"},"config":{"additionalProperties":true,"type":"object","title":"Config"}},"type":"object","required":["name","engine","config"],"title":"ConnectionCreate"},"ConnectionCreated":{"properties":{"conn_id":{"type":"string","title":"Conn Id"}},"type":"object","required":["conn_id"],"title":"ConnectionCreated"},"ConnectionInfo":{"properties":{"conn_id":{"type":"string","title":"Conn Id"},"name":{"type":"string","title":"Name"},"engine":{"type":"string","title":"Engine"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"is_active":{"type":"boolean","title":"Is Active"},"last_test_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Test At"},"last_test_ok":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Last Test Ok"},"last_test_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Test Error"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["conn_id","name","engine","config","is_active","created_at"],"title":"ConnectionInfo"},"ConnectionTest":{"properties":{"ok":{"type":"boolean","title":"Ok"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["ok"],"title":"ConnectionTest"},"ConnectionsList":{"properties":{"connections":{"items":{"$ref":"#/components/schemas/ConnectionInfo"},"type":"array","title":"Connections","default":[]}},"type":"object","title":"ConnectionsList"},"ContractSummary":{"properties":{"contract_id":{"type":"string","title":"Contract Id"},"version":{"type":"integer","title":"Version"},"tenant_id":{"type":"string","title":"Tenant Id"},"dataset_id":{"type":"string","title":"Dataset Id"},"target_fqn":{"type":"string","title":"Target Fqn"},"status":{"type":"string","title":"Status"},"approved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Approved At"}},"type":"object","required":["contract_id","version","tenant_id","dataset_id","target_fqn","status"],"title":"ContractSummary"},"CoverageFacts":{"properties":{"row_count":{"type":"integer","title":"Row Count"},"row_count_method":{"type":"string","title":"Row Count Method"},"date_range":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Date Range"},"sources":{"items":{"type":"string"},"type":"array","title":"Sources","default":[]},"freshness":{"type":"string","title":"Freshness"},"last_loaded_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Loaded At"},"quarantine_open":{"type":"integer","title":"Quarantine Open","default":0}},"type":"object","required":["row_count","row_count_method","freshness"],"title":"CoverageFacts"},"CoverageStats":{"properties":{"tenants":{"type":"integer","title":"Tenants"},"tables_populated":{"type":"integer","title":"Tables Populated"},"row_total":{"type":"integer","title":"Row Total"},"reconciled_tables":{"type":"integer","title":"Reconciled Tables"},"quarantine_open":{"type":"integer","title":"Quarantine Open"}},"type":"object","required":["tenants","tables_populated","row_total","reconciled_tables","quarantine_open"],"title":"CoverageStats"},"CoverageTotals":{"properties":{"tables_populated":{"type":"integer","title":"Tables Populated"},"row_total":{"type":"integer","title":"Row Total"},"last_loaded_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Loaded At"},"quarantine_open":{"type":"integer","title":"Quarantine Open"}},"type":"object","required":["tables_populated","row_total","quarantine_open"],"title":"CoverageTotals"},"DayCount":{"properties":{"day":{"type":"string","format":"date","title":"Day"},"asks":{"type":"integer","title":"Asks"}},"type":"object","required":["day","asks"],"title":"DayCount"},"Discrepancy":{"properties":{"type":{"type":"string","title":"Type"},"tenant_id":{"type":"string","title":"Tenant Id"},"table_fqn":{"type":"string","title":"Table Fqn"},"estimate":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Estimate"},"reconciled":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Reconciled"},"row_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Row Count"}},"type":"object","required":["type","tenant_id","table_fqn"],"title":"Discrepancy"},"DomainCoverage":{"properties":{"domain":{"type":"string","title":"Domain"},"tables_populated":{"type":"integer","title":"Tables Populated"},"tables_total":{"type":"integer","title":"Tables Total"},"row_total":{"type":"integer","title":"Row Total"},"last_loaded_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Loaded At"},"freshness_worst":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Freshness Worst"}},"type":"object","required":["domain","tables_populated","tables_total","row_total"],"title":"DomainCoverage"},"EntitiesOut":{"properties":{"entities":{"items":{"$ref":"#/components/schemas/EntityItem"},"type":"array","title":"Entities"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["entities","count"],"title":"EntitiesOut"},"EntityItem":{"properties":{"entidad":{"type":"string","title":"Entidad"},"hub_fqn":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hub Fqn"},"clave_canonica":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clave Canonica"},"clave_resolucion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clave Resolucion"},"crosswalk_fqn":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Crosswalk Fqn"},"descripcion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Descripcion"}},"type":"object","required":["entidad"],"title":"EntityItem","description":"Entidad canónica declarada por DataRefinery (hub + claves + crosswalk). La\nexpone Atlas para que un agente sepa por dónde unir 'datos de la empresa X'."},"FeedbackRequest":{"properties":{"ask_id":{"type":"string","format":"uuid","title":"Ask Id"},"candidate_fqn":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Candidate Fqn"},"signal":{"type":"string","pattern":"^(useful|wrong|missing)$","title":"Signal"},"comment":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Comment"}},"type":"object","required":["ask_id","signal"],"title":"FeedbackRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthCheck":{"properties":{"name":{"type":"string","title":"Name"},"ok":{"type":"boolean","title":"Ok"},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["name","ok","detail"],"title":"HealthCheck"},"HealthReport":{"properties":{"ok":{"type":"boolean","title":"Ok"},"checks":{"items":{"$ref":"#/components/schemas/HealthCheck"},"type":"array","title":"Checks","default":[]}},"type":"object","required":["ok"],"title":"HealthReport"},"HealthzResponse":{"properties":{"status":{"type":"string","title":"Status"},"service":{"type":"string","title":"Service"}},"type":"object","required":["status","service"],"title":"HealthzResponse"},"LanguageCount":{"properties":{"language":{"type":"string","title":"Language"},"asks":{"type":"integer","title":"Asks"}},"type":"object","required":["language","asks"],"title":"LanguageCount"},"LatencyStat":{"properties":{"p50_ms":{"type":"number","title":"P50 Ms"},"p95_ms":{"type":"number","title":"P95 Ms"},"n":{"type":"integer","title":"N"}},"type":"object","required":["p50_ms","p95_ms","n"],"title":"LatencyStat"},"LineageInfo":{"properties":{"contracts":{"items":{"$ref":"#/components/schemas/ContractSummary"},"type":"array","title":"Contracts","default":[]},"last_batch_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Batch Id"},"review_ui_links":{"items":{"type":"string"},"type":"array","title":"Review Ui Links","default":[]},"sources":{"items":{"$ref":"#/components/schemas/LineageSource"},"type":"array","title":"Sources","default":[]},"last_refreshed":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Refreshed"},"freshness":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Freshness"}},"type":"object","title":"LineageInfo"},"LineageSource":{"properties":{"dataset_id":{"type":"string","title":"Dataset Id"},"dataset":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dataset"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"last_data_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Data At"}},"type":"object","required":["dataset_id"],"title":"LineageSource","description":"De qué dataset crudo / sistema de origen sale la tabla, para este tenant."},"MissingReport":{"properties":{"days":{"type":"integer","title":"Days"},"items":{"items":{"$ref":"#/components/schemas/MissingSignal"},"type":"array","title":"Items","default":[]}},"type":"object","required":["days"],"title":"MissingReport"},"MissingSignal":{"properties":{"question":{"type":"string","title":"Question"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language"},"tenant_id":{"type":"string","title":"Tenant Id"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["question","tenant_id","created_at"],"title":"MissingSignal"},"PortalSessionRequest":{"properties":{"tenant_uuid":{"type":"string","format":"uuid","title":"Tenant Uuid"},"actor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor"}},"type":"object","required":["tenant_uuid"],"title":"PortalSessionRequest"},"PortalSessionResponse":{"properties":{"url":{"type":"string","title":"Url"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"}},"type":"object","required":["url","expires_at"],"title":"PortalSessionResponse"},"PreviewResponse":{"properties":{"table_fqn":{"type":"string","title":"Table Fqn"},"tenant_id":{"type":"string","title":"Tenant Id"},"columns":{"items":{"type":"string"},"type":"array","title":"Columns"},"rows":{"items":{"items":{},"type":"array"},"type":"array","title":"Rows"},"masked_columns":{"items":{"type":"string"},"type":"array","title":"Masked Columns"},"limit":{"type":"integer","title":"Limit"},"row_count_returned":{"type":"integer","title":"Row Count Returned"}},"type":"object","required":["table_fqn","tenant_id","columns","rows","masked_columns","limit","row_count_returned"],"title":"PreviewResponse"},"PreviewStats":{"properties":{"total":{"type":"integer","title":"Total"},"last_7d":{"type":"integer","title":"Last 7D"}},"type":"object","required":["total","last_7d"],"title":"PreviewStats"},"ProcessMetrics":{"properties":{"uptime_s":{"type":"integer","title":"Uptime S"},"counters":{"additionalProperties":{"type":"integer"},"type":"object","title":"Counters","default":{}},"latency":{"additionalProperties":{"$ref":"#/components/schemas/LatencyStat"},"type":"object","title":"Latency","default":{}},"gauges":{"additionalProperties":{"type":"number"},"type":"object","title":"Gauges","default":{}}},"type":"object","required":["uptime_s"],"title":"ProcessMetrics"},"ProvisionRequest":{"properties":{"tenant_uuid":{"type":"string","format":"uuid","title":"Tenant Uuid"},"tenant_name":{"type":"string","title":"Tenant Name"},"admin_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Email"},"subdomain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subdomain"},"plan_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan Id"},"refinery_tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refinery Tenant Id"}},"type":"object","required":["tenant_uuid","tenant_name"],"title":"ProvisionRequest"},"ProvisionResponse":{"properties":{"tenant_uuid":{"type":"string","title":"Tenant Uuid"},"created":{"type":"boolean","title":"Created"},"status":{"type":"string","title":"Status"}},"type":"object","required":["tenant_uuid","created","status"],"title":"ProvisionResponse"},"QuestionGap":{"properties":{"question":{"type":"string","title":"Question"},"veces":{"type":"integer","title":"Veces"},"ultima":{"type":"string","format":"date-time","title":"Ultima"}},"type":"object","required":["question","veces","ultima"],"title":"QuestionGap"},"RankingJobResult":{"properties":{"status":{"type":"string","title":"Status"},"adjustments_written":{"type":"integer","title":"Adjustments Written"}},"type":"object","required":["status","adjustments_written"],"title":"RankingJobResult"},"ReconcileRequest":{"properties":{"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"table_fqn":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Table Fqn"}},"type":"object","title":"ReconcileRequest"},"ReconcileResult":{"properties":{"run_id":{"type":"integer","title":"Run Id"},"tables_checked":{"type":"integer","title":"Tables Checked"},"discrepancies":{"items":{"$ref":"#/components/schemas/Discrepancy"},"type":"array","title":"Discrepancies","default":[]}},"type":"object","required":["run_id","tables_checked"],"title":"ReconcileResult"},"ReconciliationRun":{"properties":{"run_id":{"type":"integer","title":"Run Id"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"tables_checked":{"type":"integer","title":"Tables Checked"},"discrepancies":{"type":"integer","title":"Discrepancies"},"status":{"type":"string","title":"Status"}},"type":"object","required":["run_id","started_at","tables_checked","discrepancies","status"],"title":"ReconciliationRun"},"ReconciliationRunDetail":{"properties":{"run_id":{"type":"integer","title":"Run Id"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"tables_checked":{"type":"integer","title":"Tables Checked"},"discrepancies":{"type":"integer","title":"Discrepancies"},"status":{"type":"string","title":"Status"},"detail":{"items":{},"type":"array","title":"Detail","default":[]}},"type":"object","required":["run_id","started_at","tables_checked","discrepancies","status"],"title":"ReconciliationRunDetail"},"ReconciliationRunsResponse":{"properties":{"runs":{"items":{"$ref":"#/components/schemas/ReconciliationRunDetail"},"type":"array","title":"Runs","default":[]}},"type":"object","title":"ReconciliationRunsResponse"},"RelatedTable":{"properties":{"fqn":{"type":"string","title":"Fqn"},"join_column":{"type":"string","title":"Join Column"},"confidence":{"type":"string","title":"Confidence"},"other_side_pk":{"type":"boolean","title":"Other Side Pk"},"shared_by":{"type":"integer","title":"Shared By"},"populated":{"type":"boolean","title":"Populated"},"references_entity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"References Entity"}},"type":"object","required":["fqn","join_column","confidence","other_side_pk","shared_by","populated"],"title":"RelatedTable"},"RelatedTablesResponse":{"properties":{"table_fqn":{"type":"string","title":"Table Fqn"},"related":{"items":{"$ref":"#/components/schemas/RelatedTable"},"type":"array","title":"Related","default":[]}},"type":"object","required":["table_fqn"],"title":"RelatedTablesResponse"},"RepairResult":{"properties":{"action":{"type":"string","title":"Action"}},"additionalProperties":true,"type":"object","required":["action"],"title":"RepairResult","description":"Cada acción agrega sus propios campos (modo, cursor, tablas…): se preservan."},"ResourceBucket":{"properties":{"bucket":{"type":"string","format":"date-time","title":"Bucket"},"cpu_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cpu Pct"},"mem_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Mem Pct"},"disk_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Disk Pct"},"disk_free_gb":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Disk Free Gb"},"iops":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Iops"},"http_rps":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Http Rps"},"http_in_flight":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Http In Flight"},"active_callers":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Active Callers"},"db_connections":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Db Connections"}},"type":"object","required":["bucket"],"title":"ResourceBucket"},"ResourceHistory":{"properties":{"hours":{"type":"integer","title":"Hours"},"buckets":{"items":{"$ref":"#/components/schemas/ResourceBucket"},"type":"array","title":"Buckets","default":[]}},"type":"object","required":["hours"],"title":"ResourceHistory"},"SearchFilters":{"properties":{"domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain"},"freshness":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Freshness"}},"type":"object","title":"SearchFilters"},"SearchRequest":{"properties":{"query":{"type":"string","maxLength":500,"minLength":2,"title":"Query"},"tenant_id":{"type":"string","title":"Tenant Id"},"filters":{"$ref":"#/components/schemas/SearchFilters","default":{}},"include_empty":{"type":"boolean","title":"Include Empty","default":false},"top_k":{"type":"integer","maximum":20.0,"minimum":1.0,"title":"Top K","default":5}},"type":"object","required":["query","tenant_id"],"title":"SearchRequest"},"SearchResult":{"properties":{"found":{"type":"boolean","title":"Found"},"not_found_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Not Found Reason"},"warehouse":{"anyOf":[{"$ref":"#/components/schemas/WarehouseRef"},{"type":"null"}]},"language":{"type":"string","title":"Language"},"query_signature":{"type":"string","title":"Query Signature"},"candidates":{"items":{"$ref":"#/components/schemas/Candidate"},"type":"array","title":"Candidates","default":[]},"empty_candidates":{"items":{"$ref":"#/components/schemas/Candidate"},"type":"array","title":"Empty Candidates","default":[]},"tenant_domains_with_data":{"items":{"type":"string"},"type":"array","title":"Tenant Domains With Data","default":[]},"notes":{"items":{"type":"string"},"type":"array","title":"Notes","default":[]}},"type":"object","required":["found","language","query_signature"],"title":"SearchResult"},"SettingUpdate":{"properties":{"key":{"type":"string","title":"Key"},"value":{"title":"Value"}},"type":"object","required":["key","value"],"title":"SettingUpdate"},"SettingUpdated":{"properties":{"status":{"type":"string","title":"Status"},"key":{"type":"string","title":"Key"}},"type":"object","required":["status","key"],"title":"SettingUpdated"},"StatusResponse":{"properties":{"status":{"type":"string","title":"Status"}},"type":"object","required":["status"],"title":"StatusResponse"},"TableCard":{"properties":{"table":{"$ref":"#/components/schemas/TableInfo"},"tenant_id":{"type":"string","title":"Tenant Id"},"coverage":{"anyOf":[{"$ref":"#/components/schemas/TableCoverage"},{"type":"null"}]},"lineage":{"$ref":"#/components/schemas/LineageInfo"},"joins":{"items":{"$ref":"#/components/schemas/RelatedTable"},"type":"array","title":"Joins","default":[]},"sample_query":{"type":"string","title":"Sample Query"}},"type":"object","required":["table","tenant_id","lineage","sample_query"],"title":"TableCard"},"TableCoverage":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"table_fqn":{"type":"string","title":"Table Fqn"},"row_count":{"type":"integer","title":"Row Count"},"row_count_method":{"type":"string","title":"Row Count Method"},"event_date_column":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event Date Column"},"min_event_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Min Event Date"},"max_event_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Max Event Date"},"source_slugs":{"items":{"type":"string"},"type":"array","title":"Source Slugs","default":[]},"contract_ids":{"items":{"type":"string"},"type":"array","title":"Contract Ids","default":[]},"first_loaded_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"First Loaded At"},"last_loaded_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Loaded At"},"last_batch_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Batch Id"},"expected_cadence":{"anyOf":[{"type":"string","format":"duration"},{"type":"null"}],"title":"Expected Cadence"},"freshness":{"type":"string","title":"Freshness"},"quarantine_open":{"type":"integer","title":"Quarantine Open"},"last_reconciled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Reconciled At"},"computed_at":{"type":"string","format":"date-time","title":"Computed At"}},"type":"object","required":["tenant_id","table_fqn","row_count","row_count_method","freshness","quarantine_open","computed_at"],"title":"TableCoverage"},"TableInfo":{"properties":{"fqn":{"type":"string","title":"Fqn"},"domain":{"type":"string","title":"Domain"},"description":{"type":"string","title":"Description","default":""},"grain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Grain"},"status":{"type":"string","title":"Status","default":"active"},"synonyms":{"items":{"type":"string"},"type":"array","title":"Synonyms","default":[]},"columns":{"items":{"$ref":"#/components/schemas/ColumnInfo"},"type":"array","title":"Columns","default":[]}},"type":"object","required":["fqn","domain"],"title":"TableInfo"},"TableTenant":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"row_count":{"type":"integer","title":"Row Count"},"row_count_method":{"type":"string","title":"Row Count Method"},"min_event_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Min Event Date"},"max_event_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Max Event Date"},"last_loaded_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Loaded At"},"freshness":{"type":"string","title":"Freshness"}},"type":"object","required":["tenant_id","row_count","row_count_method","freshness"],"title":"TableTenant"},"TableTenantsResponse":{"properties":{"table_fqn":{"type":"string","title":"Table Fqn"},"tenants":{"items":{"$ref":"#/components/schemas/TableTenant"},"type":"array","title":"Tenants","default":[]}},"type":"object","required":["table_fqn"],"title":"TableTenantsResponse"},"TenantCoverageSummary":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"totals":{"$ref":"#/components/schemas/CoverageTotals"},"domains":{"items":{"$ref":"#/components/schemas/DomainCoverage"},"type":"array","title":"Domains","default":[]}},"type":"object","required":["tenant_id","totals"],"title":"TenantCoverageSummary"},"TenantStateEvent":{"properties":{"tenant_uuid":{"type":"string","format":"uuid","title":"Tenant Uuid"},"evento":{"type":"string","enum":["tenant.registrado","tenant.sin_creditos","tenant.con_creditos","tenant.suspendido","tenant.habilitado"],"title":"Evento","description":"Vocabulario de Users (EventoDeTenant). Mapeo interno: registrado/con_creditos/habilitado → active; sin_creditos/suspendido → suspended. Desconocido → 400."},"version":{"type":"integer","title":"Version"},"motivo":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Motivo"},"occurred_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Occurred At"}},"type":"object","required":["tenant_uuid","evento","version"],"title":"TenantStateEvent"},"TenantStatus":{"properties":{"tenant_uuid":{"type":"string","title":"Tenant Uuid"},"tenant_name":{"type":"string","title":"Tenant Name"},"subdomain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subdomain"},"plan_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan Id"},"status":{"type":"string","title":"Status"},"status_version":{"type":"integer","title":"Status Version"},"status_motivo":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status Motivo"},"refinery_tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refinery Tenant Id"},"provisioned_at":{"type":"string","format":"date-time","title":"Provisioned At"}},"type":"object","required":["tenant_uuid","tenant_name","status","status_version","provisioned_at"],"title":"TenantStatus"},"TenantTablesResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"tables":{"items":{"$ref":"#/components/schemas/TableCoverage"},"type":"array","title":"Tables","default":[]}},"type":"object","required":["tenant_id"],"title":"TenantTablesResponse"},"UsageResponse":{"properties":{"days":{"type":"integer","title":"Days"},"callers":{"items":{"$ref":"#/components/schemas/CallerUsage"},"type":"array","title":"Callers","default":[]}},"type":"object","required":["days"],"title":"UsageResponse"},"UsageStats":{"properties":{"asks":{"$ref":"#/components/schemas/AskStats"},"asks_by_language":{"items":{"$ref":"#/components/schemas/LanguageCount"},"type":"array","title":"Asks By Language","default":[]},"asks_per_day":{"items":{"$ref":"#/components/schemas/DayCount"},"type":"array","title":"Asks Per Day","default":[]},"feedback":{"additionalProperties":{"type":"integer"},"type":"object","title":"Feedback","default":{}},"top_questions_without_result":{"items":{"$ref":"#/components/schemas/QuestionGap"},"type":"array","title":"Top Questions Without Result","default":[]},"coverage":{"$ref":"#/components/schemas/CoverageStats"},"coverage_lag_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Coverage Lag Seconds"},"last_reconciliation":{"anyOf":[{"$ref":"#/components/schemas/ReconciliationRun"},{"type":"null"}]},"previews":{"$ref":"#/components/schemas/PreviewStats"},"ranking_adjustments":{"type":"integer","title":"Ranking Adjustments"},"process":{"$ref":"#/components/schemas/ProcessMetrics"}},"type":"object","required":["asks","coverage","previews","ranking_adjustments","process"],"title":"UsageStats"},"UserTokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"tenant_id":{"type":"string","title":"Tenant Id"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["access_token","tenant_id","expires_in"],"title":"UserTokenResponse","description":"Token corto scoped a un tenant, canjeado desde el JWT de un usuario final\nverificado (opción B). Se usa como X-API-Key en las consultas de datos; el\ntenant va firmado adentro y no se puede sobreescribir desde el request."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WarehouseRef":{"properties":{"engine":{"type":"string","title":"Engine"},"dialect":{"type":"string","title":"Dialect"},"connection":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connection"},"database":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Database"}},"type":"object","required":["engine","dialect"],"title":"WarehouseRef","description":"Contra qué se ejecuta el sample_query: el consumidor (p. ej. el agente)\nmapea esto a la conexión concreta que guarda por tenant."},"WhoAmI":{"properties":{"name":{"type":"string","title":"Name"},"kind":{"type":"string","title":"Kind"},"tenant_scope":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Scope"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes","default":[]},"puede":{"items":{"type":"string"},"type":"array","title":"Puede","default":[]}},"type":"object","required":["name","kind"],"title":"WhoAmI","description":"Qué puede hacer la credencial que llama: preguntar es mejor que sondear."},"WhyItem":{"properties":{"type":{"type":"string","title":"Type"},"score":{"type":"number","title":"Score"},"column":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Column"},"matched_concept":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Matched Concept"}},"type":"object","required":["type","score"],"title":"WhyItem"}},"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key (atlas_…) creada en /ui/admin, o el admin token. Tipos y alcance: CLIENTE (tenant_id fijo) → consultas de SU tenant: search, ask, coverage, tables, preview, feedback. MULTI-TENANT (sin tenant, sin admin) → las mismas consultas sobre cualquier tenant. SERVICIO scope 'provisioning' → SOLO /api/internal/* (alta y estado de tenants); no lee datos ni administra. SERVICIO scope 'keys:emit' → SOLO POST /admin/api-keys, acotado a emitir keys de cliente (tenant_id obligatorio; admin o servicio → 400); no lista, no revoca, no lee datos. ADMIN → todo. Fuera de su alcance, toda key recibe 403 uniforme."},"CookieAuth":{"type":"apiKey","in":"cookie","name":"atlas_session","description":"Sesión firmada de la UI (login)"}}},"servers":[{"url":"https://atlas.iagro.global","description":"producción"},{"url":"http://localhost:3350","description":"dev"}],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]}],"x-roles":{"publico":"sin credencial","autenticado":"cualquier credencial válida","tenant":"credencial con acceso al tenant referido (cliente de ese tenant, o multi-tenant); el tenant_id se valida SIEMPRE contra la credencial — 403 uniforme, sin fuga de existencia","provisioning":"key de servicio con ese scope (o admin)","keys:emit":"key de servicio con ese scope (o admin); emisión acotada a keys de cliente","admin":"credencial administradora"}}