{"openapi":"3.1.0","info":{"title":"Meu Agente API","version":"1.0.0","description":"API do Meu Agente (bichinho virtual + assistente). Autenticação: entre por /api/auth/sign-in/email (ou Google) e use o token do cabeçalho de resposta `set-auth-token` em `Authorization: Bearer <token>`. Informe o app em `X-Client` (web, extensao, celular) e o idioma em `X-Locale` (pt-BR, en, es). Erros: `{ error: { code, message, field? } }`."},"servers":[{"url":"https://evobit.app"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"responses":{"Error":{"description":"Erro com código estável (unauthorized, not_found, invalid, game_rule, focus_early, agent_daily_limit...).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"field":{"type":"string"}}}}}}}}}},"tags":[{"name":"Conta","description":"Criar conta, entrar e sair. O token volta no cabeçalho `set-auth-token`: use em Authorize."},{"name":"Perfil","description":"Dados da pessoa, fuso e avisos."},{"name":"Bichinho e loja","description":"Estado do bichinho, espécie, acessórios e compras com moedas."},{"name":"Missões do dia","description":"3 por dia (vêm em `pet.missions`). Cumpriu? Pegue as moedas; as 3 pegas dão bônus."},{"name":"Jogos","description":"Minijogos: o servidor abre a partida, confere tempo e pontuação e paga (até 5 partidas premiadas por dia)."},{"name":"Tarefas","description":"Concluir tarefa rende moedas e XP (uma vez por tarefa)."},{"name":"Foco","description":"Pomodoro: o servidor confere o tempo antes de pagar."},{"name":"Agente","description":"Conversa com a IA, que cria e conclui tarefas sozinha."},{"name":"Chaves de IA","description":"Cada pessoa usa a própria chave (Gemini ou Claude), guardada cifrada."},{"name":"Compartilhar","description":"Link público do bichinho para as redes sociais (só o bichinho, nunca os dados da pessoa)."},{"name":"Notificações","description":"Web Push neste aparelho."}],"paths":{"/api/auth/sign-up/email":{"post":{"summary":"Cria conta com e-mail e senha","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","email","password"],"properties":{"name":{"type":"string"},"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":8}}}}}},"responses":{"200":{"description":"{ token, user } e o cabeçalho set-auth-token"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Conta"]}},"/api/auth/sign-in/email":{"post":{"summary":"Entra com e-mail e senha","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":8}}}}}},"responses":{"200":{"description":"{ token, user } e o cabeçalho set-auth-token"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Conta"]}},"/api/auth/sign-out":{"post":{"summary":"Sai (invalida o token)","responses":{"200":{"description":"{ success }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Conta"]}},"/api/v1/me":{"get":{"summary":"Pessoa logada","responses":{"200":{"description":"Perfil"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Perfil"]},"patch":{"summary":"Muda nome, fuso, idioma e avisos","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"timezone":{"type":"string"},"locale":{"type":"string","enum":["pt-BR","en","es"]},"morningHour":{"type":"integer","minimum":0,"maximum":23},"nudges":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Perfil"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Perfil"]}},"/api/v1/pet":{"get":{"summary":"O bichinho agora (humor, fome, energia, moedas, nível, sequência)","responses":{"200":{"description":"Bichinho"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Bichinho e loja"]},"patch":{"summary":"Nome, espécie ou acessórios em uso","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":24},"species":{"type":"string","enum":["bit","lumi","pip","nebula","fofo","brasa"]},"equip":{"type":"object","propertyNames":{"type":"string","enum":["cabeca","rosto","pescoco"]},"additionalProperties":{"type":["string","null"]}}}}}}},"responses":{"200":{"description":"Bichinho"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Bichinho e loja"]}},"/api/v1/shop":{"get":{"summary":"Itens da loja","responses":{"200":{"description":"{ items }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Bichinho e loja"]}},"/api/v1/shop/buy":{"post":{"summary":"Compra um item (comida é usada na hora; acessório fica e já entra em uso)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"item":{"type":"string","enum":["cafe","energetico","pizza","salada","protetor","chapeu","laco","bone","fones","coroa","oculos","oculos-sol","cachecol","gravata","estrela","aureola","oculos-coracao","monoculo","faixa","medalha"]}},"required":["item"]}}}},"responses":{"200":{"description":"Bichinho"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Bichinho e loja"]}},"/api/v1/missions/{id}/claim":{"post":{"summary":"Pega a recompensa de uma missão cumprida: { coins, bonus, pet }","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ coins, bonus, pet }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Missões do dia"]}},"/api/v1/games":{"post":{"summary":"Abre uma partida: { id, game, startedAt }","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"game":{"type":"string","enum":["pega-comida","memoria"]}},"required":["game"]}}}},"responses":{"200":{"description":"Partida"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Jogos"]}},"/api/v1/games/{id}/finish":{"post":{"summary":"Fecha a partida com a pontuação: { coins, capped, score, record, pet }","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":1000}},"required":["score"]}}}},"responses":{"200":{"description":"Resultado"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Jogos"]}},"/api/v1/tasks":{"get":{"summary":"Lista tarefas","parameters":[{"name":"status","in":"query","schema":{"enum":["abertas","concluidas","todas"]}},{"name":"limit","in":"query","schema":{"type":"integer","maximum":200}}],"responses":{"200":{"description":"{ tasks }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Tarefas"]},"post":{"summary":"Cria tarefa","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"notes":{"type":"string","maxLength":2000},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"remindAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["title"]}}}},"responses":{"201":{"description":"Tarefa"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Tarefas"]}},"/api/v1/tasks/{id}":{"patch":{"summary":"Edita (done: true conclui)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"notes":{"type":"string","maxLength":2000},"dueDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"remindAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"done":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Tarefa"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Tarefas"]},"delete":{"summary":"Apaga","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Tarefas"]}},"/api/v1/tasks/{id}/complete":{"post":{"summary":"Conclui: { task, reward, pet }","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Conclusão"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Tarefas"]}},"/api/v1/focus":{"get":{"summary":"Foco em andamento","responses":{"200":{"description":"{ focus }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Foco"]},"post":{"summary":"Começa foco","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"minutes":{"default":25,"type":"integer","minimum":5,"maximum":90},"taskId":{"type":"string"}}}}}},"responses":{"201":{"description":"Foco"}},"tags":["Foco"]}},"/api/v1/focus/{id}/finish":{"post":{"summary":"Conclui foco (o servidor confere o tempo)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ focus, reward, pet }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Foco"]}},"/api/v1/focus/{id}/cancel":{"post":{"summary":"Cancela foco","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Foco"]}},"/api/v1/agent":{"get":{"summary":"Histórico da conversa","responses":{"200":{"description":"{ messages }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Agente"]},"post":{"summary":"Fala com o agente (ele executa ações)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["text"],"properties":{"text":{"type":"string","maxLength":2000},"client":{"type":"string","description":"voz, quando veio de fala"}}}}}},"responses":{"200":{"description":"{ reply, actions, pet, simulated }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Agente"]},"delete":{"summary":"Apaga o histórico","responses":{"200":{"description":"{ ok }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Agente"]}},"/api/v1/agent/page":{"post":{"summary":"Resume a página aberta ou extrai dela as tarefas (cria)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"action":{"type":"string","enum":["resumir","tarefas"]},"url":{"type":"string","maxLength":2000},"title":{"type":"string","maxLength":300},"text":{"type":"string","minLength":40,"maxLength":60000}},"required":["action","text"]}}}},"responses":{"200":{"description":"{ reply, actions, pet, simulated }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Agente"]}},"/api/v1/ai-keys":{"get":{"summary":"Chaves de IA da pessoa (só os 4 últimos caracteres) e estimativa de gasto do mês","responses":{"200":{"description":"{ keys, monthEstimateUsd }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Chaves de IA"]},"post":{"summary":"Cadastra/troca a chave de um fornecedor (testada antes de salvar; guardada cifrada)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"provider":{"type":"string","enum":["anthropic","gemini"]},"apiKey":{"type":"string","minLength":20,"maxLength":400},"model":{"type":"string","maxLength":80}},"required":["provider","apiKey"]}}}},"responses":{"200":{"description":"{ keys, monthEstimateUsd }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Chaves de IA"]}},"/api/v1/ai-keys/{provider}":{"patch":{"summary":"{ primary: true } torna a principal","parameters":[{"name":"provider","in":"path","required":true,"schema":{"enum":["gemini","anthropic"]}}],"responses":{"200":{"description":"{ keys }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Chaves de IA"]},"delete":{"summary":"Remove a chave","parameters":[{"name":"provider","in":"path","required":true,"schema":{"enum":["gemini","anthropic"]}}],"responses":{"200":{"description":"{ keys }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Chaves de IA"]}},"/api/v1/push/test":{"post":{"summary":"Manda uma notificação de teste aos aparelhos da pessoa: { devices, sent }","responses":{"200":{"description":"{ devices, sent }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Notificações"]}},"/api/v1/share":{"get":{"summary":"Se o link público está ligado: { enabled, url?, imageUrl?, text? }","responses":{"200":{"description":"Situação"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Compartilhar"]},"post":{"summary":"Liga o link público do bichinho (ou devolve o atual): { url, imageUrl, text }","responses":{"200":{"description":"Links"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Compartilhar"]},"delete":{"summary":"Desliga o link público","responses":{"200":{"description":"{ ok }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Compartilhar"]}},"/api/v1/push":{"get":{"summary":"Chave pública VAPID","security":[],"responses":{"200":{"description":"{ publicKey }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Notificações"]},"post":{"summary":"Liga notificações neste aparelho","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"endpoint":{"type":"string","format":"uri"},"keys":{"type":"object","properties":{"p256dh":{"type":"string","minLength":10},"auth":{"type":"string","minLength":5}},"required":["p256dh","auth"]},"label":{"type":"string","maxLength":60}},"required":["endpoint","keys"]}}}},"responses":{"200":{"description":"{ ok }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Notificações"]},"delete":{"summary":"Desliga notificações neste aparelho","responses":{"200":{"description":"{ ok }"},"default":{"$ref":"#/components/responses/Error"}},"tags":["Notificações"]}}}}