{"openapi":"3.1.0","info":{"title":"iClubing API","version":"1.0.0","description":"API do iClubing. Guias em https://docs.iclubing.com.\n\n- **Servidor**: `Authorization: Bearer cf_live_…` (ou `cf_test_…` no ambiente de teste).\n- **Participante (navegador/app)**: `Authorization: Bearer <token do participante>`.\n- **Modo servidor (headless)**: rotas `/v1/me/*` com a chave secreta + `X-Participant: <external_id>`."},"servers":[{"url":"https://api.iclubing.com"}],"components":{"securitySchemes":{"ApiKey":{"type":"http","scheme":"bearer","description":"Chave secreta cf_test_… ou cf_live_… — só no servidor, nunca no navegador."},"ParticipantToken":{"type":"http","scheme":"bearer","description":"Token do participante (15 min), emitido pelo seu servidor em POST /v1/participants/{external_id}/token. Uso no navegador/app."},"Participant":{"type":"apiKey","in":"header","name":"X-Participant","description":"Modo servidor (headless): junto com a chave secreta, o external_id do participante em nome de quem o seu servidor age."}},"schemas":{"Health":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded"]},"version":{"type":"string"},"env":{"type":"string"},"checks":{"type":"object","properties":{"db":{"type":"string","enum":["ok","error","not_configured"]},"kv":{"type":"string","enum":["ok","error"]}},"required":["db","kv"]},"latency_ms":{"type":"number"}},"required":["status","version","env","checks","latency_ms"]},"ProgressLevel":{"type":"object","properties":{"number":{"type":"integer","description":"Nível atual (começa em 1)","example":3},"name":{"type":"string","description":"Nome do nível (o elo no Studio)","example":"Bronze"},"badge_url":{"type":["string","null"],"description":"Imagem do badge, ou null"},"color":{"type":["string","null"],"description":"Cor do nível, ou null","example":"#CD7F32"}},"required":["number","name","badge_url","color"]},"ProgressXp":{"type":"object","properties":{"current":{"type":"number","description":"XP dentro do nível atual","example":90},"required":{"type":"number","description":"XP para completar o nível atual","example":3000},"total":{"type":"number","description":"XP total desde o início","example":4090},"progress":{"type":"number","description":"current / required, de 0 a 1 (1 no último nível)","example":0.03}},"required":["current","required","total","progress"]},"ParticipantProgress":{"type":"object","properties":{"participant":{"type":"object","properties":{"external_id":{"type":"string"},"display_name":{"type":["string","null"]},"avatar_url":{"type":["string","null"]}},"required":["external_id","display_name","avatar_url"]},"level":{"$ref":"#/components/schemas/ProgressLevel"},"xp":{"$ref":"#/components/schemas/ProgressXp"},"next_level":{"$ref":"#/components/schemas/ProgressNextLevel"},"levels":{"type":"array","items":{"type":"object","properties":{"number":{"type":"integer"},"name":{"type":"string"},"xp_required":{"type":["number","null"],"description":"XP para completar o nível; null no último"},"badge_url":{"type":["string","null"]},"color":{"type":["string","null"]}},"required":["number","name","xp_required","badge_url","color"]}},"currencies":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","example":"coins"},"name":{"type":"string","example":"Coins"},"icon":{"type":"string","description":"Código do ícone no Clube ou URL de imagem","example":"coin"},"balance":{"type":"number","example":33}},"required":["code","name","icon","balance"]},"description":"Saldo de cada moeda do clube, na ordem do config (0 se não tiver)"},"updated_at":{"type":"string","example":"2026-09-24T18:00:00.000Z"}},"required":["participant","level","xp","next_level","levels","currencies","updated_at"]},"ProgressNextLevel":{"type":["object","null"],"properties":{"number":{"type":"integer"},"name":{"type":"string"},"badge_url":{"type":["string","null"]}},"required":["number","name","badge_url"],"description":"null quando já está no último nível"},"ParticipantProfile":{"type":"object","properties":{"id":{"type":"string"},"external_id":{"type":"string"},"display_name":{"type":["string","null"]},"avatar_url":{"type":["string","null"]},"xp":{"type":"number"},"level":{"type":"number"},"max_level":{"type":"number"},"level_start_xp":{"type":"number"},"next_level_xp":{"type":["number","null"]},"remaining_xp":{"type":"number"},"percent":{"type":"number"},"tier":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"color":{"type":["string","null"]},"badge":{"type":["string","null"]},"vip":{"type":"boolean"}},"required":["code","name","color","badge","vip"]},"next_tier":{"type":["object","null"],"properties":{"code":{"type":"string"},"name":{"type":"string"},"starts_at_level":{"type":"number"}},"required":["code","name","starts_at_level"]},"benefits":{"type":"array","items":{"type":"string"}},"currencies":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"icon":{"type":"string"},"balance":{"type":"number"}},"required":["code","name","icon","balance"]}},"flags":{"type":"object","additionalProperties":{}}},"required":["id","external_id","display_name","avatar_url","xp","level","max_level","level_start_xp","next_level_xp","remaining_xp","percent","tier","next_tier","benefits","currencies","flags"]},"ParticipantUpsert":{"type":"object","properties":{"external_id":{"type":"string","minLength":1,"maxLength":128},"display_name":{"type":["string","null"],"maxLength":80},"avatar_url":{"type":["string","null"],"format":"uri"},"email":{"type":["string","null"],"format":"email"},"phone":{"type":["string","null"],"maxLength":32},"tags":{"type":"array","items":{"type":"string","maxLength":32},"maxItems":20}},"required":["external_id"]},"ParticipantRenameReport":{"type":"object","properties":{"env":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"dry_run":{"type":"boolean"},"before":{"type":"object","properties":{"id":{"type":"string"},"external_id":{"type":"string"},"xp":{"type":"number"},"level":{"type":"number"},"balances":{"type":"object","additionalProperties":{"type":"number"}}},"required":["id","external_id","xp","level","balances"]},"merged":{"type":["object","null"],"properties":{"id":{"type":"string"},"external_id":{"type":"string"},"xp":{"type":"number"},"level":{"type":"number"},"balances":{"type":"object","additionalProperties":{"type":"number"}},"duplicates_dropped":{"type":"object","additionalProperties":{"type":"number"}}},"required":["id","external_id","xp","level","balances","duplicates_dropped"]},"after":{"type":"object","properties":{"id":{"type":"string"},"external_id":{"type":"string"},"xp":{"type":"number"},"level":{"type":"number"},"balances":{"type":"object","additionalProperties":{"type":"number"}}},"required":["id","external_id","xp","level","balances"]},"rewritten":{"type":"object","additionalProperties":{"type":"number"},"description":"Linhas em que o ID antigo foi trocado, por tabela.coluna"},"moved":{"type":"object","additionalProperties":{"type":"number"}}},"required":["env","from","to","dry_run","before","merged","after","rewritten","moved"]},"ParticipantRename":{"type":"object","properties":{"new_external_id":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[A-Za-z0-9._:@-]+$","description":"O ID novo do participante no seu sistema","example":"56953539"},"merge":{"type":"boolean","description":"Se já existir um participante com o ID novo, funde-o neste (este é o dono do histórico). Sem isso, a troca é recusada com 409."},"dry_run":{"type":"boolean","description":"Faz a troca e desfaz no fim: devolve o relatório do que mudaria."}},"required":["new_external_id"]},"EventsQueued":{"type":"object","properties":{"queued":{"type":"boolean","enum":[true]},"event_ids":{"type":"array","items":{"type":"string"}}},"required":["queued","event_ids"]},"Delivery":{"type":"object","properties":{"id":{"type":"string"},"participant_id":{"type":"string"},"participant_reward_id":{"type":"string"},"reward_code":{"type":"string"},"status":{"type":"string","enum":["pending","delivered","failed"]},"external_ref":{"type":["string","null"]},"fail_reason":{"type":["string","null"]},"created_at":{"type":"string"},"confirmed_at":{"type":["string","null"]}},"required":["id","participant_id","participant_reward_id","reward_code","status","external_ref","fail_reason","created_at","confirmed_at"]},"Redemption":{"type":"object","properties":{"id":{"type":"string"},"reward_code":{"type":"string"},"title":{"type":"string"},"cost":{"type":"object","properties":{"currency":{"type":"string"},"amount":{"type":"number"}},"required":["currency","amount"]},"balance_after":{"type":"number"},"delivery_status":{"type":"string"},"duplicate":{"type":"boolean"},"effects":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["id","reward_code","title","cost","balance_after","delivery_status","duplicate","effects"]},"GamesSynced":{"type":"object","properties":{"upserted":{"type":"integer"},"deactivated":{"type":"integer"}},"required":["upserted","deactivated"]},"CheckinState":{"type":"object","properties":{"todayKey":{"type":"string"},"currentDayIndex":{"type":"number"},"todayIndex":{"type":"number"},"nextDayAt":{"type":"string"},"period":{"type":"string","enum":["month","streak"]},"daysInPeriod":{"type":"number"},"streak":{"type":"number"},"claimedToday":{"type":"boolean"},"canClaim":{"type":"boolean"},"days":{"type":"array","items":{"type":"string","enum":["claimed","available","locked","missed"]}},"forgivenessUsed":{"type":"number"}},"required":["todayKey","currentDayIndex","todayIndex","nextDayAt","period","daysInPeriod","streak","claimedToday","canClaim","days","forgivenessUsed"]},"ReferralState":{"type":"object","properties":{"enabled":{"type":"boolean"},"code":{"type":"string"},"link":{"type":["string","null"]},"referrerReward":{"type":["string","null"]},"referredReward":{"type":["string","null"]},"qualifyEvent":{"type":"string"},"minAmount":{"type":"number"},"stats":{"type":"object","properties":{"invited":{"type":"number"},"qualified":{"type":"number"},"earned":{"type":["string","null"]}},"required":["invited","qualified","earned"]},"availableCents":{"type":"integer"},"friends":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string","enum":["pending","qualified"]},"since":{"type":"string"}},"required":["name","status","since"]}}},"required":["enabled","code","link","referrerReward","referredReward","qualifyEvent","minAmount","stats","availableCents","friends"]},"Notification":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"title":{"type":"string"},"body":{"type":["string","null"]},"view":{"type":["string","null"]},"createdAt":{"type":"string"},"readAt":{"type":["string","null"]}},"required":["id","kind","title","body","view","createdAt","readAt"]},"CashbackState":{"type":"object","properties":{"enabled":{"type":"boolean"},"mode":{"type":"string","enum":["auto","claim"]},"available":{"type":"number"},"availableDays":{"type":"array","items":{"type":"object","properties":{"dayKey":{"type":"string"},"amount":{"type":"number"},"pct":{"type":"number"},"loss":{"type":"number"}},"required":["dayKey","amount","pct","loss"]}},"today":{"type":"object","properties":{"amount":{"type":"number"},"loss":{"type":"number"},"pct":{"type":"number"},"band":{"type":["string","null"]}},"required":["amount","loss","pct","band"]},"pctRange":{"type":"object","properties":{"min":{"type":"number"},"max":{"type":"number"}},"required":["min","max"]},"nextDayAt":{"type":"string"},"autoHour":{"type":"number"},"claimDays":{"type":"number"},"monthReceived":{"type":"number"}},"required":["enabled","mode","available","availableDays","today","pctRange","nextDayAt","autoHour","claimDays","monthReceived"]},"WheelState":{"type":"object","properties":{"style":{"type":"string","enum":["classica","duo","vip"]},"titleLeft":{"type":"string"},"titleRight":{"type":"string"},"slices":{"type":"array","items":{"type":"object","additionalProperties":{}}},"spinsLeft":{"type":"number"},"nextSpinAt":{"type":["string","null"]}},"required":["style","titleLeft","titleRight","slices","spinsLeft","nextSpinAt"]},"WheelSpinResult":{"type":"object","properties":{"spinId":{"type":"string"},"index":{"type":"number"},"sliceId":{"type":"string"},"label":{"type":"string"},"reward":{"type":["string","null"]},"rewardId":{"type":["string","null"]},"prize":{"type":"object","additionalProperties":{}},"spinsLeft":{"type":"number"},"nextSpinAt":{"type":["string","null"]},"probabilityVersion":{"type":"number"},"duplicate":{"type":"boolean"},"effects":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["spinId","index","sliceId","label","reward","spinsLeft","nextSpinAt","probabilityVersion","duplicate","effects"]}},"parameters":{}},"paths":{"/v1/health":{"get":{"tags":["Sistema"],"summary":"Saúde da API","responses":{"200":{"description":"Estado dos componentes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/v1/participants/progress":{"post":{"tags":["Participantes"],"summary":"Progresso de nível de vários participantes (até 200)","description":"Para sincronizar ou montar rankings sem N chamadas. Mesmos `level` e `xp` do endpoint individual; external_ids que não existem no clube são omitidos.","security":[{"ApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"external_ids":{"type":"array","items":{"type":"string","minLength":1,"maxLength":128},"minItems":1,"maxItems":200}},"required":["external_ids"]}}}},"responses":{"200":{"description":"Itens na ordem pedida","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"external_id":{"type":"string"},"level":{"$ref":"#/components/schemas/ProgressLevel"},"xp":{"$ref":"#/components/schemas/ProgressXp"}},"required":["external_id","level","xp"]}}},"required":["items"]}}}},"422":{"description":"Corpo inválido (lista vazia ou mais de 200 ids)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/participants/{external_id}/progress":{"get":{"tags":["Participantes"],"summary":"Progresso de nível do participante","description":"Nível, XP dentro do nível (para a barra \"90 / 3000 XP · 3%\"), próximo nível e a tabela completa de níveis do clube. Responde do estado atual do participante, sem recalcular histórico; `Cache-Control: private, max-age=15`.","security":[{"ApiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"external_id","in":"path"}],"responses":{"200":{"description":"Progresso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantProgress"}}}},"404":{"description":"Participante não existe neste clube (chave de outro clube também dá 404, para não revelar existência)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/participants":{"post":{"tags":["Participantes"],"summary":"Criar ou atualizar participante","security":[{"ApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantUpsert"}}}},"responses":{"200":{"description":"Perfil","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantProfile"}}}},"401":{"description":"Sem chave","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/participants/{external_id}":{"get":{"tags":["Participantes"],"summary":"Perfil completo do participante","security":[{"ApiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"external_id","in":"path"}],"responses":{"200":{"description":"Perfil","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantProfile"}}}},"404":{"description":"Não encontrado","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/participants/{external_id}/token":{"post":{"tags":["Participantes"],"summary":"Token de sessão do participante (15 min)","description":"Chame no seu backend e passe o token ao widget. Cria o participante se não existir.","security":[{"ApiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"external_id","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"ttl_seconds":{"type":"integer","minimum":60,"maximum":86400}}}}}},"responses":{"200":{"description":"Token","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"expires_at":{"type":"string"},"participant_id":{"type":"string"},"level":{"$ref":"#/components/schemas/ProgressLevel"},"xp":{"$ref":"#/components/schemas/ProgressXp"}},"required":["token","expires_at","participant_id","level","xp"]}}}},"500":{"description":"Segredo ausente","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/participants/{external_id}/rename":{"post":{"tags":["Participantes"],"summary":"Trocar o ID do participante","description":"Troca o `external_id` do participante pelo `new_external_id`, levando tudo o que está ligado a ele (XP, nível, moedas, missões, torneios, check-in, roleta, prêmios, entregas, indicações, avisos, extrato) e reescrevendo o ID antigo onde ele aparece como texto (ids de evento como `signup:<id>`, chaves de idempotência, webhooks gravados). Atômico. Recusa com 409 se o ID novo já existir, a não ser com `merge: true`. Depois da troca, o ID antigo responde 404. Só com chave secreta.","security":[{"ApiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"external_id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantRename"}}}},"responses":{"200":{"description":"Trocado (ou simulado, com dry_run)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParticipantRenameReport"}}}},"404":{"description":"Participante não existe neste clube (chave de outro clube também dá 404, para não revelar existência)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Já existe um participante com o ID novo","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"422":{"description":"ID novo inválido ou igual ao atual","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/events":{"post":{"tags":["Eventos"],"summary":"Enviar um evento","description":"Registra o evento, avalia as regras do clube e devolve os efeitos aplicados. Envie `Idempotency-Key` (ou `id`) para repetir com segurança.","security":[{"ApiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":128},"required":false,"name":"idempotency-key","in":"header"},{"schema":{"type":"string"},"required":false,"name":"prefer","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"participant":{"type":"string","minLength":1,"maxLength":128},"type":{"type":"string","minLength":3,"maxLength":64,"pattern":"^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"},"amount":{"type":"number"},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"BRL"},"occurred_at":{"type":"string","format":"date-time"},"meta":{"type":"object","additionalProperties":{},"default":{}}},"required":["participant","type"]}}}},"responses":{"200":{"description":"Efeitos aplicados","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"duplicate":{"type":"boolean"},"effects":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["xp_granted"]},"amount":{"type":"number"},"rule_id":{"type":"string"}},"required":["type","amount","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["xp_debited"]},"amount":{"type":"number"},"rule_id":{"type":"string"}},"required":["type","amount","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["currency_granted"]},"currency":{"type":"string"},"amount":{"type":"number"},"rule_id":{"type":"string"}},"required":["type","currency","amount","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["currency_debited"]},"currency":{"type":"string"},"amount":{"type":"number"},"rule_id":{"type":"string"}},"required":["type","currency","amount","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["level_up"]},"from":{"type":"number"},"to":{"type":"number"}},"required":["type","from","to"]},{"type":"object","properties":{"type":{"type":"string","enum":["tier_changed"]},"from":{"type":"string"},"to":{"type":"string"}},"required":["type","from","to"]},{"type":"object","properties":{"type":{"type":"string","enum":["mission_progressed"]},"mission_id":{"type":"string"},"progress":{"type":"number"},"target":{"type":"number"}},"required":["type","mission_id","progress","target"]},{"type":"object","properties":{"type":{"type":"string","enum":["mission_completed"]},"mission_id":{"type":"string"},"period":{"type":"string"}},"required":["type","mission_id","period"]},{"type":"object","properties":{"type":{"type":"string","enum":["reward_granted"]},"reward_code":{"type":"string"},"rule_id":{"type":"string"},"reward_id":{"type":"string"},"delivery_id":{"type":"string"}},"required":["type","reward_code","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["badge_granted"]},"badge_code":{"type":"string"},"rule_id":{"type":"string"}},"required":["type","badge_code","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["leaderboard_points"]},"campaign_id":{"type":"string"},"points":{"type":"number"},"rule_id":{"type":"string"}},"required":["type","campaign_id","points","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["tagged"]},"tag":{"type":"string"},"rule_id":{"type":"string"}},"required":["type","tag","rule_id"]}]}}},"required":["event_id","duplicate","effects"]}}}},"202":{"description":"Enfileirado (`Prefer: respond-async`): processado em segundos","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsQueued"}}}}}}},"/v1/events/batch":{"post":{"tags":["Eventos"],"summary":"Enviar até 500 eventos","security":[{"ApiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"prefer","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"participant":{"type":"string","minLength":1,"maxLength":128},"type":{"type":"string","minLength":3,"maxLength":64,"pattern":"^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"},"amount":{"type":"number"},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"BRL"},"occurred_at":{"type":"string","format":"date-time"},"meta":{"type":"object","additionalProperties":{},"default":{}}},"required":["participant","type"]},"minItems":1,"maxItems":500}},"required":["events"]}}}},"responses":{"200":{"description":"Resultado por evento, na mesma ordem","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"event_id":{"type":"string"},"duplicate":{"type":"boolean"},"effects":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["xp_granted"]},"amount":{"type":"number"},"rule_id":{"type":"string"}},"required":["type","amount","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["xp_debited"]},"amount":{"type":"number"},"rule_id":{"type":"string"}},"required":["type","amount","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["currency_granted"]},"currency":{"type":"string"},"amount":{"type":"number"},"rule_id":{"type":"string"}},"required":["type","currency","amount","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["currency_debited"]},"currency":{"type":"string"},"amount":{"type":"number"},"rule_id":{"type":"string"}},"required":["type","currency","amount","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["level_up"]},"from":{"type":"number"},"to":{"type":"number"}},"required":["type","from","to"]},{"type":"object","properties":{"type":{"type":"string","enum":["tier_changed"]},"from":{"type":"string"},"to":{"type":"string"}},"required":["type","from","to"]},{"type":"object","properties":{"type":{"type":"string","enum":["mission_progressed"]},"mission_id":{"type":"string"},"progress":{"type":"number"},"target":{"type":"number"}},"required":["type","mission_id","progress","target"]},{"type":"object","properties":{"type":{"type":"string","enum":["mission_completed"]},"mission_id":{"type":"string"},"period":{"type":"string"}},"required":["type","mission_id","period"]},{"type":"object","properties":{"type":{"type":"string","enum":["reward_granted"]},"reward_code":{"type":"string"},"rule_id":{"type":"string"},"reward_id":{"type":"string"},"delivery_id":{"type":"string"}},"required":["type","reward_code","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["badge_granted"]},"badge_code":{"type":"string"},"rule_id":{"type":"string"}},"required":["type","badge_code","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["leaderboard_points"]},"campaign_id":{"type":"string"},"points":{"type":"number"},"rule_id":{"type":"string"}},"required":["type","campaign_id","points","rule_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["tagged"]},"tag":{"type":"string"},"rule_id":{"type":"string"}},"required":["type","tag","rule_id"]}]}}},"required":["event_id","duplicate","effects"]}}},"required":["results"]}}}},"202":{"description":"Enfileirados (`Prefer: respond-async`), na mesma ordem","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsQueued"}}}}}}},"/v1/deliveries":{"get":{"tags":["Entregas"],"summary":"Listar entregas pendentes","security":[{"ApiKey":[]}],"parameters":[{"schema":{"type":"string","enum":["pending","delivered","failed"]},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"Entregas","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/Delivery"}}},"required":["deliveries"]}}}}}}},"/v1/deliveries/{id}/confirm":{"post":{"tags":["Entregas"],"summary":"Confirmar que o prêmio foi creditado","description":"Chame depois de creditar o prêmio no seu sistema. Repetir a chamada é seguro.","security":[{"ApiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"external_ref":{"type":"string","maxLength":200},"details":{"type":"object","properties":{"spins":{"type":"integer","exclusiveMinimum":0,"maximum":10000},"game":{"type":"string","maxLength":80},"game_code":{"type":"string","maxLength":80},"game_image":{"type":"string","maxLength":2000,"format":"uri"},"play_url":{"type":"string","maxLength":2000}}}}}}}},"responses":{"200":{"description":"Entrega atualizada","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Delivery"}}}},"404":{"description":"Não encontrada","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Já encerrada","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/deliveries/{id}/fail":{"post":{"tags":["Entregas"],"summary":"Informar que a entrega falhou","description":"O participante vê o prêmio como falho e a equipe do clube é avisada no Studio.","security":[{"ApiKey":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["reason"]}}}},"responses":{"200":{"description":"Entrega atualizada","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Delivery"}}}},"404":{"description":"Não encontrada","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Já encerrada","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/config":{"get":{"tags":["Clube"],"summary":"Configuração publicada do clube","description":"Tema, moedas, progressão, módulos, check-in, catálogo de prêmios e FAQ — o mesmo JSON que o Clube hospedado usa. Cacheie por 60 s.","security":[{"ApiKey":[]}],"responses":{"200":{"description":"Configuração","content":{"application/json":{"schema":{"type":"object","properties":{"club_id":{"type":"string"},"env":{"type":"string","enum":["test","live"]},"config":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60,"default":"Clube"},"templateCode":{"type":"string"},"theme":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"colors":{"type":"object","properties":{"bg":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"surface":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"primary":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"secondary":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"muted":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"success":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$","default":"#22C55E"},"warning":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$","default":"#F59E0B"},"danger":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$","default":"#EF4444"}},"required":["bg","surface","primary","secondary","text","muted"]},"logoUrl":{"type":"string","maxLength":200000},"logoPngUrl":{"type":"string","maxLength":2000},"font":{"type":"string","minLength":1,"maxLength":60,"default":"Plus Jakarta Sans"},"radius":{"type":"integer","minimum":0,"maximum":40,"default":16},"glow":{"type":"boolean","default":false},"cardStyle":{"type":"string","enum":["gradient","glass","flat"],"default":"flat"},"buttonStyle":{"type":"string","enum":["flat","bevel"],"default":"flat"},"background":{"type":"string","enum":["solid","stars","image"],"default":"solid"},"backgroundImage":{"type":"string","format":"uri"},"badgeSet":{"type":"string","enum":["spades-3d","shields","gems"],"default":"shields"},"illustrationStyle":{"type":"string","enum":["3d","flat"],"default":"flat"},"motionLevel":{"type":"string","enum":["full","light","none"],"default":"full"}},"required":["name","colors"]},"currencies":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":2,"maxLength":24,"pattern":"^[a-z][a-z0-9_]*$"},"name":{"type":"string","minLength":1,"maxLength":40},"icon":{"type":"string","default":"coin"},"decimals":{"type":"integer","minimum":0,"maximum":2,"default":0},"expiresInDays":{"type":["integer","null"],"exclusiveMinimum":0,"default":null}},"required":["code","name"]},"minItems":1},"progression":{"type":"object","properties":{"curve":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["preset"]},"preset":{"type":"string","enum":["suave","media","dificil"]},"base":{"type":"integer","exclusiveMinimum":0,"default":1000},"maxLevel":{"type":"integer","minimum":2,"maximum":500,"default":60}},"required":["kind","preset"]},{"type":"object","properties":{"kind":{"type":"string","enum":["table"]},"thresholds":{"type":"array","items":{"type":"integer","minimum":0},"minItems":1}},"required":["kind","thresholds"]}]},"tiers":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":32},"name":{"type":"string","minLength":1,"maxLength":40},"levels":{"type":"array","prefixItems":[{"type":"integer","exclusiveMinimum":0},{"type":["integer","null"],"exclusiveMinimum":0}]},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"badge":{"type":"string"},"benefits":{"type":"array","items":{"type":"string"},"default":[]},"vip":{"type":"boolean","default":false}},"required":["code","name","levels"]},"minItems":1},"benefits":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":240},"icon":{"type":"string"},"compliance":{"type":"string","enum":["ok","review"],"default":"ok"}},"required":["code","name"]},"default":[]},"demotion":{"type":"string","enum":["never","monthly_review"],"default":"never"}},"required":["curve","tiers"]},"checkin":{"type":"object","properties":{"enabled":{"type":"boolean","default":true},"days":{"anyOf":[{"type":"number","enum":[7]},{"type":"number","enum":[14]},{"type":"number","enum":[15]},{"type":"number","enum":[30]},{"type":"number","enum":[31]}],"default":30},"rewards":{"type":"array","items":{"type":"object","properties":{"reward":{"type":"string","minLength":1},"label":{"type":"string","maxLength":40},"illustration":{"type":"string"},"multiplier":{"type":"number","exclusiveMinimum":0,"default":1}},"required":["reward"]}},"highlightDays":{"type":"array","items":{"type":"integer","exclusiveMinimum":0},"default":[]},"period":{"type":"string","enum":["month","streak"],"default":"month"},"missedDay":{"type":"string","enum":["restart","continue","forgive_one"],"default":"restart"},"timezone":{"type":"string","default":"America/Sao_Paulo"},"resetHour":{"type":"integer","minimum":0,"maximum":23,"default":0},"requireEvent":{"type":["string","null"],"default":null}},"required":["rewards"]},"wheel":{"type":"object","properties":{"enabled":{"type":"boolean","default":true},"style":{"type":"string","enum":["classica","duo","vip"],"default":"classica"},"titleLeft":{"type":"string","maxLength":12,"default":"ROLETA"},"titleRight":{"type":"string","maxLength":12,"default":"GRATUITA"},"slices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z0-9-]{1,32}$"},"label":{"type":"string","minLength":1,"maxLength":14},"sublabel":{"type":"string","maxLength":14},"image":{"type":"string","maxLength":2000},"reward":{"type":["string","null"],"minLength":1,"default":null},"payload":{"type":"object","properties":{"kind":{"type":"string","enum":["free_spins","bonus","cash"]},"spins":{"type":"integer","exclusiveMinimum":0,"maximum":10000},"amount_cents":{"type":"integer","exclusiveMinimum":0},"rollover":{"type":"number","exclusiveMinimum":0,"maximum":200},"game":{"type":"string","maxLength":80},"game_code":{"type":"string","maxLength":80},"game_image":{"type":"string","maxLength":2000,"format":"uri"}},"required":["kind"],"additionalProperties":{}},"weight":{"type":"number","minimum":0,"maximum":1000000,"default":1},"tierQty":{"type":"object","additionalProperties":{"type":"number","minimum":0,"maximum":10000000}}},"required":["id","label"]},"minItems":4,"maxItems":16},"spinsPerDay":{"type":"integer","minimum":0,"maximum":50,"default":1},"probabilityVersion":{"type":"integer","minimum":1,"default":1}},"required":["slices"]},"referral":{"type":"object","properties":{"enabled":{"type":"boolean","default":true},"referrerReward":{"type":"string","pattern":"^(xp:\\d+(\\.\\d+)?|[a-z][a-z0-9_]*:\\d+(\\.\\d+)?|reward:[a-z0-9-]+)$","default":"coins:200"},"referredReward":{"type":["string","null"],"pattern":"^(xp:\\d+(\\.\\d+)?|[a-z][a-z0-9_]*:\\d+(\\.\\d+)?|reward:[a-z0-9-]+)$","default":"coins:100"},"qualifyEvent":{"type":"string","enum":["signup","deposit.confirmed","bet.placed"],"default":"deposit.confirmed"},"minAmount":{"type":"number","minimum":0,"default":20},"dailyLimit":{"type":"integer","minimum":1,"maximum":100,"default":10},"shareUrl":{"type":"string","maxLength":500,"default":""}}},"games":{"type":"object","properties":{"exclude":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":20,"default":[]},"providers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":100,"default":[]},"games":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","maxLength":120}},"required":["id"]},"maxItems":500,"default":[]}},"default":{"categories":[],"providers":[],"games":[]}}}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string","maxLength":120},"enabled":{"type":"boolean","default":true},"trigger":{"type":"object","properties":{"event":{"type":"string","minLength":3,"maxLength":64,"pattern":"^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"}},"required":["event"]},"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"type":"string","enum":[">",">=","<","<=","==","!=","in","not_in"]},"value":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"boolean"},{"type":"array","items":{"anyOf":[{"type":"number"},{"type":"string"}]}}]}},"required":["field","op","value"]},{"type":"object","properties":{"segment":{"type":"string","minLength":1}},"required":["segment"]},{"type":"object","properties":{"segment_not":{"type":"string","minLength":1}},"required":["segment_not"]},{"type":"object","properties":{"tier_in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["tier_in"]},{"type":"object","properties":{"first_time":{"type":"boolean","enum":[true]}},"required":["first_time"]},{"type":"object","properties":{"nth":{"type":"integer","exclusiveMinimum":0}},"required":["nth"]}]},"default":[]},"games":{"type":"object","properties":{"only":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":20,"default":[]},"providers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":100,"default":[]},"games":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","maxLength":120}},"required":["id"]},"maxItems":500,"default":[]}},"default":{"categories":[],"providers":[],"games":[]}},"exclude":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":20,"default":[]},"providers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":100,"default":[]},"games":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","maxLength":120}},"required":["id"]},"maxItems":500,"default":[]}},"default":{"categories":[],"providers":[],"games":[]}}}},"effects":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["grant_xp"]},"amount":{"anyOf":[{"type":"number"},{"type":"string","minLength":1}]}},"required":["type","amount"]},{"type":"object","properties":{"type":{"type":"string","enum":["grant_currency"]},"currency":{"type":"string"},"amount":{"anyOf":[{"type":"number"},{"type":"string","minLength":1}]}},"required":["type","currency","amount"]},{"type":"object","properties":{"type":{"type":"string","enum":["debit_currency"]},"currency":{"type":"string"},"amount":{"anyOf":[{"type":"number"},{"type":"string","minLength":1}]}},"required":["type","currency","amount"]},{"type":"object","properties":{"type":{"type":"string","enum":["grant_reward"]},"reward":{"type":"string"}},"required":["type","reward"]},{"type":"object","properties":{"type":{"type":"string","enum":["progress_mission"]},"mission":{"type":"string"},"increment":{"anyOf":[{"type":"number"},{"type":"string","minLength":1}],"default":1}},"required":["type","mission"]},{"type":"object","properties":{"type":{"type":"string","enum":["add_leaderboard_points"]},"campaign":{"type":"string"},"points":{"anyOf":[{"type":"number"},{"type":"string","minLength":1}]}},"required":["type","campaign","points"]},{"type":"object","properties":{"type":{"type":"string","enum":["grant_badge"]},"badge":{"type":"string"}},"required":["type","badge"]},{"type":"object","properties":{"type":{"type":"string","enum":["notify"]},"template":{"type":"string"}},"required":["type","template"]},{"type":"object","properties":{"type":{"type":"string","enum":["webhook"]},"event":{"type":"string"}},"required":["type","event"]},{"type":"object","properties":{"type":{"type":"string","enum":["tag_participant"]},"tag":{"type":"string"}},"required":["type","tag"]}]},"minItems":1},"limits":{"type":"object","properties":{"per_participant_per_day":{"type":"object","additionalProperties":{"type":"number","exclusiveMinimum":0}},"max_runs_per_participant":{"type":"integer","exclusiveMinimum":0},"cooldown_seconds":{"type":"integer","minimum":0}},"default":{}},"idempotency":{"type":"string","default":"event.id"}},"required":["id","trigger","effects"]},"default":[]},"rewards":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48,"pattern":"^[a-z0-9-]+$"},"title":{"type":"string","minLength":1,"maxLength":60},"description":{"type":"string","maxLength":200},"illustration":{"type":"string","default":"gift"},"type":{"type":"string","enum":["internal","client_delivered","manual","partner"],"default":"internal"},"payload":{"type":"object","additionalProperties":{},"default":{}},"expiresInDays":{"type":["integer","null"],"exclusiveMinimum":0,"default":null},"howToUse":{"type":"string","maxLength":160},"cost":{"type":["object","null"],"properties":{"currency":{"type":"string","minLength":1},"amount":{"type":"number","exclusiveMinimum":0}},"default":null,"required":["currency","amount"]}},"required":["code","title"]},"default":[]},"missions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":48,"pattern":"^[a-z0-9-]+$"},"title":{"type":"string","minLength":1,"maxLength":60},"description":{"type":"string","maxLength":200},"illustration":{"type":"string","default":"target"},"event":{"type":"string","minLength":3,"maxLength":64,"pattern":"^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"},"conditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"type":"string","enum":[">",">=","<","<=","==","!=","in","not_in"]},"value":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"boolean"},{"type":"array","items":{"anyOf":[{"type":"number"},{"type":"string"}]}}]}},"required":["field","op","value"]},"default":[]},"games":{"type":"object","properties":{"only":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":20,"default":[]},"providers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":100,"default":[]},"games":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","maxLength":120}},"required":["id"]},"maxItems":500,"default":[]}},"default":{"categories":[],"providers":[],"games":[]}},"exclude":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":20,"default":[]},"providers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":100,"default":[]},"games":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","maxLength":120}},"required":["id"]},"maxItems":500,"default":[]}},"default":{"categories":[],"providers":[],"games":[]}}}},"goal":{"type":"object","properties":{"kind":{"type":"string","enum":["count","sum"],"default":"count"},"field":{"type":"string","minLength":1,"default":"amount"},"target":{"type":"number","exclusiveMinimum":0}},"required":["target"]},"period":{"type":"string","enum":["once","daily","weekly","monthly"],"default":"once"},"reward":{"type":"string","minLength":1},"claim":{"type":"string","enum":["auto","manual"],"default":"manual"},"enabled":{"type":"boolean","default":true},"audienceTag":{"type":"string","maxLength":60,"pattern":"^[a-z0-9:_-]+$"},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"order":{"type":"integer","minimum":0,"default":0}},"required":["id","title","event","goal","reward"]},"default":[]},"tournaments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":48,"pattern":"^[a-z0-9-]+$"},"title":{"type":"string","minLength":1,"maxLength":60},"description":{"type":"string","maxLength":200},"illustration":{"type":"string","default":"trophy"},"event":{"type":"string","minLength":3,"maxLength":64,"pattern":"^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"},"conditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"type":"string","enum":[">",">=","<","<=","==","!=","in","not_in"]},"value":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"boolean"},{"type":"array","items":{"anyOf":[{"type":"number"},{"type":"string"}]}}]}},"required":["field","op","value"]},"default":[]},"games":{"type":"object","properties":{"only":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":20,"default":[]},"providers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":100,"default":[]},"games":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","maxLength":120}},"required":["id"]},"maxItems":500,"default":[]}},"default":{"categories":[],"providers":[],"games":[]}},"exclude":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":20,"default":[]},"providers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":100,"default":[]},"games":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","maxLength":120}},"required":["id"]},"maxItems":500,"default":[]}},"default":{"categories":[],"providers":[],"games":[]}}}},"scoring":{"type":"string","enum":["sum","count","max_ratio"],"default":"sum"},"field":{"type":"string","minLength":1,"default":"amount"},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"recurrence":{"type":"string","enum":["none","weekly"],"default":"none"},"prizes":{"type":"array","items":{"type":"object","properties":{"from":{"type":"integer","exclusiveMinimum":0},"to":{"type":"integer","exclusiveMinimum":0},"reward":{"type":"string","minLength":1}},"required":["from","to","reward"]},"minItems":1},"minScore":{"type":"number","minimum":0,"default":0},"enabled":{"type":"boolean","default":true}},"required":["id","title","event","startsAt","endsAt","prizes"]},"default":[]},"officialTournaments":{"type":"object","properties":{"enabled":{"type":"boolean","default":false},"timezone":{"type":"string","minLength":1,"default":"America/Sao_Paulo"},"daily":{"type":"object","properties":{"enabled":{"type":"boolean","default":true},"poolPercent":{"type":"number","minimum":0,"maximum":100,"default":10},"seed":{"type":"number","minimum":0,"maximum":1000000,"default":0},"split":{"type":"array","items":{"type":"number","exclusiveMinimum":0,"maximum":100},"minItems":1,"maxItems":10,"default":[100]},"minWager":{"type":"number","minimum":0,"default":0}},"default":{"enabled":true,"poolPercent":10,"seed":0,"split":[100],"minWager":0}},"monthly":{"type":"object","properties":{"enabled":{"type":"boolean","default":true},"poolPercent":{"type":"number","minimum":0,"maximum":100,"default":10},"seed":{"type":"number","minimum":0,"maximum":1000000,"default":0},"split":{"type":"array","items":{"type":"number","exclusiveMinimum":0,"maximum":100},"minItems":1,"maxItems":10,"default":[100]},"minWager":{"type":"number","minimum":0,"default":0}},"default":{"enabled":true,"poolPercent":10,"seed":0,"split":[100],"minWager":0}},"tracks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":24,"pattern":"^[a-z0-9-]+$"},"title":{"type":"string","minLength":1,"maxLength":40},"icon":{"type":"string","maxLength":300,"default":"slots"},"image":{"type":"string","maxLength":500},"games":{"type":"object","properties":{"only":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":20,"default":[]},"providers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":100,"default":[]},"games":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","maxLength":120}},"required":["id"]},"maxItems":500,"default":[]}},"default":{"categories":[],"providers":[],"games":[]}},"exclude":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":20,"default":[]},"providers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":100,"default":[]},"games":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","maxLength":120}},"required":["id"]},"maxItems":500,"default":[]}},"default":{"categories":[],"providers":[],"games":[]}}}},"enabled":{"type":"boolean","default":true}},"required":["id","title","games"]},"maxItems":6,"default":[{"id":"slots","title":"Slots","icon":"slots","image":"/torneios/slots.webp","games":{"only":{"categories":["video-slots"],"providers":[],"games":[]},"exclude":{"categories":[],"providers":[],"games":[]}},"enabled":true},{"id":"aviator","title":"Aviator","icon":"aviator","image":"/torneios/aviator.webp","games":{"only":{"categories":["crash","fast-games"],"providers":[],"games":[]},"exclude":{"categories":[],"providers":[],"games":[]}},"enabled":true},{"id":"ao-vivo","title":"Ao vivo","icon":"live","image":"/torneios/ao-vivo.webp","games":{"only":{"categories":["live-casino"],"providers":[],"games":[]},"exclude":{"categories":[],"providers":[],"games":[]}},"enabled":true}]}}},"home":{"type":"array","items":{"anyOf":[{"type":"string","enum":["hero","profile","next-action","modules","recent-rewards","leaderboard","faq"]},{"type":"object","properties":{"block":{"type":"string","enum":["hero","profile","next-action","modules","recent-rewards","leaderboard","faq"]},"enabled":{"type":"boolean","default":true},"title":{"type":"string","maxLength":60},"subtitle":{"type":"string","maxLength":120}},"required":["block"]}]},"default":[{"block":"modules","enabled":true}]},"moduleCards":{"type":"array","items":{"type":"object","properties":{"module":{"type":"string","enum":["profile","checkin","codes","rewards","currencies","missions","store","wheel","leaderboard","notifications","cashback","referral","badges","seasons","minigames"]},"enabled":{"type":"boolean","default":true},"title":{"type":"string","maxLength":40},"subtitle":{"type":"string","maxLength":60},"illustration":{"type":"string","default":"gift"},"cta":{"type":"string","maxLength":24,"default":"Saiba mais"},"group":{"type":"string","enum":["hoje","jogar","resgate"]},"layout":{"type":"string","enum":["grid","row"]},"tone":{"anyOf":[{"type":"string","enum":["elixir","real","arena","ouro","fogo","gelo","princesa","aco","tesouro"]},{"type":"string","enum":["none"]}]}},"required":["module","title","subtitle"]},"default":[]},"faq":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string"},"question":{"type":"string"},"answer":{"type":"string"}},"required":["category","question","answer"]},"default":[]},"avatars":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z0-9-]{1,24}$"},"url":{"type":"string","format":"uri"},"name":{"type":"string","maxLength":40}},"required":["id","url"]},"maxItems":48,"default":[]},"icons":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z0-9-]{1,24}$"},"url":{"type":"string","format":"uri"},"name":{"type":"string","maxLength":40}},"required":["id","url"]},"maxItems":96,"default":[]},"allowedOrigins":{"type":"array","items":{"type":"string","format":"uri"},"default":[]},"legalNote":{"type":"string","maxLength":300}},"required":["theme","currencies","progression"]}},"required":["club_id","env","config"]}}}}}}},"/v1/cashback":{"get":{"tags":["Clube"],"summary":"Programa de cashback do clube","description":"Faixas, percentuais, horário, modo de recebimento e cashback do 1º dia, como salvos no módulo de cashback. Use para qualquer texto do seu site sobre cashback. Vale na hora (não depende de publicar). Cacheie por 60 s.","security":[{"ApiKey":[]}],"responses":{"200":{"description":"Programa de cashback","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"mode":{"type":"string","enum":["auto","claim"]},"hour":{"type":"integer"},"claim_days":{"type":"integer"},"min_loss":{"type":"number"},"min_pct":{"type":"number"},"max_pct":{"type":"number"},"tiers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"min_loss":{"type":"number"},"pct":{"type":"number"}},"required":["name","min_loss","pct"]}},"welcome":{"type":"object","properties":{"enabled":{"type":"boolean"},"pct":{"type":"number"},"max":{"type":"number"}},"required":["enabled","pct","max"]},"text":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"boolean"}]}}},"required":["enabled","mode","hour","claim_days","min_loss","min_pct","max_pct","tiers","welcome","text"]}}}}}}},"/v1/redemptions":{"post":{"tags":["Resgates"],"summary":"Resgatar em nome de um participante","security":[{"ApiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":8,"maxLength":120},"required":false,"name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"participant":{"type":"string","minLength":1,"description":"Seu id do participante"},"reward":{"type":"string","minLength":1}},"required":["participant","reward"]}}}},"responses":{"200":{"description":"Resgatado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Redemption"}}}},"404":{"description":"Participante ou prêmio não encontrado","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Saldo insuficiente","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"422":{"description":"Prêmio sem preço","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/referrals":{"post":{"tags":["Indique e ganhe"],"summary":"Registrar indicação no cadastro","description":"Chame no cadastro de um novo usuário que chegou com código de indicação (`?ref=`). Só o `external_id` do novo usuário e o código atravessam. A indicação fica `pending` até o indicado cumprir a regra do clube (ex.: primeiro depósito) — aí os dois ganham.","security":[{"ApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"referred_external_id":{"type":"string","minLength":1,"maxLength":128},"code":{"type":"string","minLength":4,"maxLength":16}},"required":["referred_external_id","code"]}}}},"responses":{"201":{"description":"Indicação registrada","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","qualified"]}},"required":["id","status"]}}}},"404":{"description":"Código inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Não conta (própria, já indicado, jogador antigo, limite)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/affiliates/attributions":{"post":{"tags":["Afiliados"],"summary":"Registrar jogador vindo de afiliado","description":"Chame no cadastro de quem chegou por um link de afiliado (`?aff=CODIGO`). Só o `external_id` do jogador e o código atravessam. A partir daí, depósitos, saques e apostas desse jogador contam para o afiliado.","security":[{"ApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"participant_external_id":{"type":"string","minLength":1,"maxLength":128},"code":{"type":"string","minLength":4,"maxLength":16},"signup_at":{"type":"string","format":"date-time"}},"required":["participant_external_id","code"]}}}},"responses":{"201":{"description":"Atribuído","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"affiliate_link":{"type":"string"},"backfilled":{"type":"number"}},"required":["id","affiliate_link","backfilled"]}}}},"404":{"description":"Código inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Já é de um afiliado, conta antiga ou afiliado pausado","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/games":{"post":{"tags":["Jogos"],"summary":"Enviar o catálogo de jogos","description":"Upsert por `id` (o mesmo `meta.game_id` das apostas). Dá nome e categoria aos jogos no Studio e marca quais aceitam giros grátis (`free_spins`).","security":[{"ApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"games":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","minLength":1,"maxLength":160},"provider":{"type":"string","maxLength":60,"default":""},"provider_label":{"type":"string","maxLength":80,"default":""},"category":{"type":"string","maxLength":40,"default":""},"free_spins":{"type":"boolean","default":false},"active":{"type":"boolean","default":true},"image":{"type":["string","null"],"maxLength":500}},"required":["id","name"]},"maxItems":1000},"prune_before":{"type":"string","format":"date-time"}},"required":["games"]}}}},"responses":{"200":{"description":"Catálogo atualizado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GamesSynced"}}}}}},"get":{"tags":["Jogos"],"summary":"Listar o catálogo de jogos","description":"Jogos ativos do catálogo. `free_spins=true` lista só os que aceitam giros grátis.","security":[{"ApiKey":[]}],"parameters":[{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"free_spins","in":"query"},{"schema":{"type":"string","maxLength":40},"required":false,"name":"category","in":"query"},{"schema":{"type":"string","maxLength":60},"required":false,"name":"provider","in":"query"}],"responses":{"200":{"description":"Jogos","content":{"application/json":{"schema":{"type":"object","properties":{"games":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","minLength":1,"maxLength":160},"provider":{"type":"string","maxLength":60,"default":""},"provider_label":{"type":"string","maxLength":80,"default":""},"category":{"type":"string","maxLength":40,"default":""},"free_spins":{"type":"boolean","default":false},"active":{"type":"boolean","default":true},"image":{"type":["string","null"],"maxLength":500}},"required":["id","name"]}}},"required":["games"]}}}}}}},"/v1/public/{slug}/official-tournaments":{"get":{"tags":["Público"],"summary":"Torneios oficiais para o widget do site (sem login): prêmio, relógio e top 3","parameters":[{"schema":{"type":"string","pattern":"^[a-z0-9-]{1,64}$"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","enum":["live","test"],"default":"live"},"required":false,"name":"env","in":"query"}],"responses":{"200":{"description":"Torneios oficiais do dia","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"theme":{"type":["object","null"],"additionalProperties":{}},"tracks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string"},"image":{"type":["string","null"]},"daily":{"type":"object","properties":{"enabled":{"type":"boolean"},"pool":{"type":"number"},"endsAt":{"type":"string"},"participants":{"type":"number"},"top":{"type":"array","items":{"type":"object","properties":{"position":{"type":"number"},"id":{"type":"string"},"avatar":{"type":["string","null"]},"score":{"type":"number"},"prize":{"type":["number","null"]}},"required":["position","id","avatar","score","prize"]}}},"required":["enabled","pool","endsAt","participants","top"]}},"required":["id","title","icon","image","daily"]}}},"required":["enabled","theme","tracks"]}}}},"404":{"description":"Clube não encontrado","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/me":{"get":{"tags":["Participante (widget)"],"summary":"Meu perfil","responses":{"200":{"description":"Perfil","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]},"patch":{"tags":["Participante (widget)"],"summary":"Editar nome e avatar","description":"Avatar: `preset:01`…`preset:08` (galeria do clube), `initials` ou uma URL https. Nome de 2 a 40 caracteres.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"display_name":{"type":"string","minLength":2,"maxLength":40},"avatar":{"anyOf":[{"type":"string","enum":["initials"]},{"type":"string","pattern":"^preset:0[1-8]$"},{"type":"string","format":"uri"}]},"show_in_leaderboard":{"type":"boolean"},"show_public_name":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Perfil atualizado","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Sem token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/config":{"get":{"tags":["Participante (widget)"],"summary":"Configuração publicada do clube (tema, blocos, progressão)","description":"Com `?preview=draft` devolve o rascunho em vez da versão publicada — só no ambiente de teste, para o preview do Studio.","parameters":[{"schema":{"type":"string","enum":["draft"]},"required":false,"name":"preview","in":"query"}],"responses":{"200":{"description":"ClubConfig","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/checkin":{"get":{"tags":["Participante (widget)"],"summary":"Estado do check-in e calendário","responses":{"200":{"description":"Estado","content":{"application/json":{"schema":{"type":"object","properties":{"state":{"$ref":"#/components/schemas/CheckinState"},"calendar":{"type":"object","additionalProperties":{}}},"required":["state","calendar"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Módulo desligado","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]},"post":{"tags":["Participante (widget)"],"summary":"Fazer o check-in de hoje","responses":{"200":{"description":"Recompensa do dia concedida","content":{"application/json":{"schema":{"type":"object","properties":{"dayIndex":{"type":"number"},"dayKey":{"type":"string"},"streak":{"type":"number"},"reward":{"type":"object","properties":{"ref":{"type":"string"},"label":{"type":["string","null"]}},"required":["ref","label"]},"effects":{"type":"array","items":{"type":"object","additionalProperties":{}}},"state":{"$ref":"#/components/schemas/CheckinState"}},"required":["dayIndex","dayKey","streak","reward","effects","state"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Módulo desligado","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Já feito hoje","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/referral":{"get":{"tags":["Participante (widget)"],"summary":"Indique e ganhe: meu código, link, indicados e ganhos","responses":{"200":{"description":"Indicação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralState"}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/notifications":{"get":{"tags":["Participante (widget)"],"summary":"Meus avisos (os 50 mais recentes) e quantos não li","responses":{"200":{"description":"Avisos","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Notification"}},"unread":{"type":"number"}},"required":["items","unread"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/notifications/read":{"post":{"tags":["Participante (widget)"],"summary":"Marcar avisos como lidos","description":"Sem `ids`, marca todos.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","minLength":1},"maxItems":200}}}}}},"responses":{"200":{"description":"Não lidos depois da marcação","content":{"application/json":{"schema":{"type":"object","properties":{"unread":{"type":"number"}},"required":["unread"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/cashback":{"get":{"tags":["Participante (widget)"],"summary":"Meu cashback: disponível para resgatar e acumulando hoje","responses":{"200":{"description":"Estado do cashback","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CashbackState"}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/cashback/claim":{"post":{"tags":["Participante (widget)"],"summary":"Resgatar o cashback disponível","description":"Paga de uma vez os dias fechados ainda não resgatados (modo resgate). Cada dia paga no máximo uma vez.","responses":{"200":{"description":"Cashback creditado","content":{"application/json":{"schema":{"type":"object","properties":{"claimed":{"type":"number"},"days":{"type":"number"},"effects":{"type":"array","items":{"type":"object","additionalProperties":{}}},"deliveries":{"type":"array","items":{"type":"object","properties":{"delivery_id":{"type":"string"},"reward_id":{"type":["string","null"]},"day":{"type":"string"},"amount":{"type":"number"}},"required":["delivery_id","reward_id","day","amount"]}},"state":{"$ref":"#/components/schemas/CashbackState"}},"required":["claimed","days","effects","deliveries","state"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Cashback desligado","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Nada para resgatar (ou o clube paga automático)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/codes/redeem":{"post":{"tags":["Participante (widget)"],"summary":"Ativar código promocional","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":2,"maxLength":40}},"required":["code"]}}}},"responses":{"200":{"description":"Prêmio concedido","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"reward":{"type":"object","properties":{"ref":{"type":"string"},"title":{"type":["string","null"]}},"required":["ref","title"]},"effects":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["code","reward","effects"]}}}},"400":{"description":"Código inválido, expirado ou já usado","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/wheel":{"get":{"tags":["Participante (widget)"],"summary":"Roleta: lâminas (sem as chances), giros restantes e próximo giro","responses":{"200":{"description":"Estado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WheelState"}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Roleta desligada","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/wheel/spin":{"post":{"tags":["Participante (widget)"],"summary":"Girar a roleta","description":"O servidor sorteia e concede; a animação só recebe `index`. `spinId` (gerado pelo widget) torna o giro idempotente: repetir devolve o mesmo resultado.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"spinId":{"type":"string","minLength":8,"maxLength":64,"pattern":"^[A-Za-z0-9_-]+$"}},"required":["spinId"]}}}},"responses":{"200":{"description":"Resultado do giro","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WheelSpinResult"}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Roleta desligada","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Sem giros hoje","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/rewards":{"get":{"tags":["Participante (widget)"],"summary":"Meus prêmios","parameters":[{"schema":{"type":"string","enum":["available","used","expired","all"],"default":"all"},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"Lista","content":{"application/json":{"schema":{"type":"object","properties":{"rewards":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["rewards"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/rewards/{id}/use":{"post":{"tags":["Participante (widget)"],"summary":"Usar um prêmio disponível","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Usado","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"},"used_at":{"type":"string"}},"required":["id","status","used_at"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Não encontrado ou já usado","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/ledger":{"get":{"tags":["Participante (widget)"],"summary":"Extrato de XP e moedas","parameters":[{"schema":{"type":"string"},"required":false,"name":"currency","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"before","in":"query"}],"responses":{"200":{"description":"Lançamentos, do mais novo para o mais antigo","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number"},"balance_after":{"type":"number"},"reason":{"type":"string"},"ref_type":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["id","currency","amount","balance_after","reason","ref_type","created_at"]}},"next_before":{"type":["string","null"]}},"required":["entries","next_before"]}}}},"401":{"description":"Sem token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/missions":{"get":{"tags":["Participante (widget)"],"summary":"Minhas missões (período atual)","responses":{"200":{"description":"Missões","content":{"application/json":{"schema":{"type":"object","properties":{"missions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"illustration":{"type":"string"},"period":{"type":"string","enum":["once","daily","weekly","monthly"]},"periodKey":{"type":"string"},"progress":{"type":"number"},"target":{"type":"number"},"reward":{"type":"string"},"rewardLabel":{"type":"string"},"status":{"type":"string","enum":["in_progress","completed","claimed"]},"claim":{"type":"string","enum":["auto","manual"]},"resetsAt":{"type":["string","null"]}},"required":["id","title","illustration","period","periodKey","progress","target","reward","rewardLabel","status","claim","resetsAt"]}}},"required":["missions"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/missions/{id}/claim":{"post":{"tags":["Participante (widget)"],"summary":"Resgatar o prêmio de uma missão concluída","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Prêmio concedido","content":{"application/json":{"schema":{"type":"object","properties":{"mission":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"reward":{"type":"string"}},"required":["id","title","reward"]},"effects":{"type":"array","items":{"type":"object","additionalProperties":{}}},"missions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"illustration":{"type":"string"},"period":{"type":"string","enum":["once","daily","weekly","monthly"]},"periodKey":{"type":"string"},"progress":{"type":"number"},"target":{"type":"number"},"reward":{"type":"string"},"rewardLabel":{"type":"string"},"status":{"type":"string","enum":["in_progress","completed","claimed"]},"claim":{"type":"string","enum":["auto","manual"]},"resetsAt":{"type":["string","null"]}},"required":["id","title","illustration","period","periodKey","progress","target","reward","rewardLabel","status","claim","resetsAt"]}}},"required":["mission","effects","missions"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Missão não encontrada","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Ainda não concluída ou já resgatada","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/tournaments":{"get":{"tags":["Participante (widget)"],"summary":"Torneios em andamento, próximos e recém-fechados, com o meu lugar","responses":{"200":{"description":"Torneios","content":{"application/json":{"schema":{"type":"object","properties":{"tournaments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"illustration":{"type":"string"},"scoring":{"type":"string","enum":["sum","count","max_ratio"]},"startsAt":{"type":"string"},"endsAt":{"type":"string"},"status":{"type":"string","enum":["upcoming","running","closed"]},"prizes":{"type":"array","items":{"type":"object","properties":{"from":{"type":"integer","exclusiveMinimum":0},"to":{"type":"integer","exclusiveMinimum":0},"reward":{"type":"string","minLength":1},"rewardLabel":{"type":"string"}},"required":["from","to","reward","rewardLabel"]}},"top":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","exclusiveMinimum":0},"participantId":{"type":"string"},"name":{"type":"string"},"avatar":{"type":["string","null"]},"score":{"type":"number"},"me":{"type":"boolean"}},"required":["position","participantId","name","score","me"]}},"me":{"type":"object","properties":{"position":{"type":["number","null"]},"score":{"type":"number"}},"required":["position","score"]},"participants":{"type":"number"}},"required":["id","title","illustration","scoring","startsAt","endsAt","status","prizes","top","me","participants"]}}},"required":["tournaments"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/official-tournaments":{"get":{"tags":["Participante (widget)"],"summary":"Torneios oficiais: pote em dinheiro, placar do dia e do mês e últimos vencedores","responses":{"200":{"description":"Torneios oficiais","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"timezone":{"type":"string"},"tracks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string"},"image":{"type":["string","null"]},"daily":{"type":"object","properties":{"period":{"type":"string","enum":["daily","monthly"]},"enabled":{"type":"boolean"},"key":{"type":"string"},"startsAt":{"type":"string"},"endsAt":{"type":"string"},"pool":{"type":"number"},"seed":{"type":"number"},"split":{"type":"array","items":{"type":"number"}},"minWager":{"type":"number"},"participants":{"type":"number"},"top":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","exclusiveMinimum":0},"id":{"type":"string"},"avatar":{"type":["string","null"]},"score":{"type":"number"},"prize":{"type":["number","null"]},"me":{"type":"boolean"}},"required":["position","id","avatar","score","prize","me"]}},"me":{"type":"object","properties":{"position":{"type":["number","null"]},"score":{"type":"number"},"toNext":{"type":["number","null"]}},"required":["position","score","toNext"]}},"required":["period","enabled","key","startsAt","endsAt","pool","seed","split","minWager","participants","top","me"]},"monthly":{"type":"object","properties":{"period":{"type":"string","enum":["daily","monthly"]},"enabled":{"type":"boolean"},"key":{"type":"string"},"startsAt":{"type":"string"},"endsAt":{"type":"string"},"pool":{"type":"number"},"seed":{"type":"number"},"split":{"type":"array","items":{"type":"number"}},"minWager":{"type":"number"},"participants":{"type":"number"},"top":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","exclusiveMinimum":0},"id":{"type":"string"},"avatar":{"type":["string","null"]},"score":{"type":"number"},"prize":{"type":["number","null"]},"me":{"type":"boolean"}},"required":["position","id","avatar","score","prize","me"]}},"me":{"type":"object","properties":{"position":{"type":["number","null"]},"score":{"type":"number"},"toNext":{"type":["number","null"]}},"required":["position","score","toNext"]}},"required":["period","enabled","key","startsAt","endsAt","pool","seed","split","minWager","participants","top","me"]},"winners":{"type":"array","items":{"type":"object","properties":{"period":{"type":"string","enum":["daily","monthly"]},"key":{"type":"string"},"position":{"type":"number"},"id":{"type":"string"},"avatar":{"type":["string","null"]},"amount":{"type":"number"},"me":{"type":"boolean"}},"required":["period","key","position","id","avatar","amount","me"]}}},"required":["id","title","icon","image","daily","monthly","winners"]}}},"required":["enabled","timezone","tracks"]}}}},"401":{"description":"Token inválido","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/me/redemptions":{"post":{"tags":["Participante (widget)"],"summary":"Resgatar um prêmio com saldo","description":"Debita o preço do prêmio e reserva o item na mesma transação. Repetir a mesma `Idempotency-Key` devolve o resgate original.","parameters":[{"schema":{"type":"string","minLength":8,"maxLength":120},"required":false,"name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reward":{"type":"string","minLength":1}},"required":["reward"]}}}},"responses":{"200":{"description":"Resgatado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Redemption"}}}},"401":{"description":"Sem token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Prêmio não existe","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Saldo insuficiente","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"422":{"description":"Prêmio sem preço","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}},"security":[{"ParticipantToken":[]},{"ApiKey":[],"Participant":[]}]}},"/v1/dev/session":{"post":{"tags":["Dev"],"summary":"Sessão de demonstração (só em dev)","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","default":"demo"},"participant":{"type":"string","default":"demo_user"},"name":{"type":"string"},"reset":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Token e identificação do clube demo","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"expires_at":{"type":"string"},"club_id":{"type":"string"},"slug":{"type":"string"}},"required":["token","expires_at","club_id","slug"]}}}},"500":{"description":"Sem segredo ou banco","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}}},"webhooks":{}}