{"openapi":"3.1.0","info":{"title":"PM8 AI API","version":"1.3.0","description":"API pública do PM8 AI. Autentique com uma chave de API criada no Security Center (Authorization: Bearer pm8_live_…). Cada chave pertence a uma aplicação e tem escopos."},"servers":[{"url":"/api/public/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"pm8_{live|test}_…"}},"responses":{"Error":{"description":"Erro","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}},"schemas":{"Citation":{"type":"object","properties":{"n":{"type":"integer"},"source_title":{"type":"string"},"page":{"type":"integer","nullable":true},"excerpt":{"type":"string"},"similarity":{"type":"number"}}}}},"paths":{"/health":{"get":{"operationId":"health","summary":"Verifica a chave e o tenant","x-scope":null,"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"status":"ok","tenant":"PM8 Education Demo","application":"education-web","scopes":["copilot:query"]}}}},"401":{"$ref":"#/components/responses/Error"}}}},"/knowledge-bases":{"get":{"operationId":"listKnowledgeBases","summary":"Lista Knowledge Bases visíveis à empresa","x-scope":"knowledge:read","responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":[{"id":"uuid","name":"Catálogo de Cursos","description":"…"}]}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}}}},"/knowledge/search":{"post":{"operationId":"searchKnowledge","summary":"Busca semântica em Knowledge Bases","x-scope":"knowledge:read","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"string","maxLength":500},"base_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"k":{"type":"integer","minimum":1,"maximum":20,"default":5}}},"example":{"query":"Qual a carga horária de Ciência de Dados?","k":3}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":[{"n":1,"source_title":"Catálogo 2026","page":null,"excerpt":"…","similarity":0.82}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}}}},"/copilot/query":{"post":{"operationId":"copilotQuery","summary":"Pergunta ao Copilot com respostas fundamentadas e citações","x-scope":"copilot:query","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["question"],"properties":{"question":{"type":"string","maxLength":4000},"base_ids":{"type":"array","items":{"type":"string","format":"uuid"}}}},"example":{"question":"Posso trancar a matrícula no meio do semestre?"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"answer":"Sim, até 60 dias… [1]","grounded":true,"citations":[{"n":1,"source_title":"Regulamento Acadêmico","excerpt":"…"}],"usage":{"input_tokens":1500,"output_tokens":80}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}}}}