{"openapi":"3.1.0","info":{"title":"Bracket Intelligence API","version":"1.0.0","description":"Tournament structures, participants and match graphs.\n\nA match declares where each of its two occupants comes from (`slotA` / `slotB`), rather than pointing forward at the match it feeds. One shape therefore describes an elimination tree, a losers bracket, group standings and an unpaired Swiss slot.\n\nAdditive changes ship without notice. Anything else waits for v2, and deprecated shapes are supported for at least 12 months."},"servers":[{"url":"/api/v1"}],"paths":{"/engine/generate":{"post":{"operationId":"generateStructure","summary":"Build a bracket from a field","description":"Pure function over HTTP: no account, nothing stored, and identical input always returns identical output — so responses are cacheable indefinitely. Chain calls by passing the returned structure back in.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateRequest"}}}},"responses":{"200":{"description":"The structure, plus any renderings that were asked for","content":{"application/json":{"schema":{"type":"object","properties":{"structure":{"$ref":"#/components/schemas/Structure"},"text":{"type":"string"},"svg":{"type":"string"}},"required":["structure"]}}}},"400":{"description":"The request did not validate. The message names the field and the fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The engine could not complete the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/engine/apply":{"post":{"operationId":"applyResult","summary":"Report a result against a structure","description":"Returns the new result map plus what the change invalidated. Nothing is written, so this doubles as a dry run for anything destructive.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyRequest"}}}},"responses":{"200":{"description":"New results, what was cleared, and what changed","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"object","additionalProperties":true},"cleared":{"type":"array","items":{"type":"string"}},"changed":{"type":"array","items":{"type":"string"}},"text":{"type":"string"}}}}}},"400":{"description":"The request did not validate. The message names the field and the fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The engine could not complete the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/engine/render":{"post":{"operationId":"renderStructure","summary":"Render a structure as text, JSON or SVG","description":"Text is the default because it is what a model can afford to read — several times smaller than the equivalent match array.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenderRequest"}}}},"responses":{"200":{"description":"The rendering","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"},"svg":{"type":"string"},"matches":{"type":"object","additionalProperties":true}}}}}},"400":{"description":"The request did not validate. The message names the field and the fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The engine could not complete the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/tournaments/create":{"post":{"operationId":"createTournament","summary":"Store a bracket against your account","description":"Unlisted by default — saving a draft is not asking to publish it. Requires a Supabase bearer token.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTournamentRequest"}}}},"responses":{"200":{"description":"The stored tournament","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TournamentDetail"}}}},"400":{"description":"The request did not validate. The message names the field and the fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/tournaments/{slug}/matches":{"post":{"operationId":"reportResult","summary":"Report a result","description":"Send Idempotency-Key so a retry replays the first response instead of advancing the bracket twice, and If-Match so a stale write is rejected rather than silently overwriting. Add ?dryRun=1 to see what a change would clear without making it.","security":[{"bearerAuth":[]}],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}},{"name":"dryRun","in":"query","required":false,"description":"Plan the change and return what it would clear, without writing.","schema":{"type":"string","enum":["1"]}},{"name":"Idempotency-Key","in":"header","required":false,"description":"A retry with the same key replays the original response.","schema":{"type":"string"}},{"name":"If-Match","in":"header","required":false,"description":"The ETag you loaded. A stale value is rejected with 409.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportScoreRequest"}}}},"responses":{"200":{"description":"The new version, what was cleared, and what changed","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"cleared":{"type":"array","items":{"type":"string"}},"changed":{"type":"array","items":{"type":"string"}}}}}}},"400":{"description":"The request did not validate. The message names the field and the fix.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Authenticated, but not permitted on this tournament.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such tournament.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Idempotency key reused for a different request, or a stale If-Match.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/tournaments/{slug}/live":{"get":{"operationId":"streamTournament","summary":"Live updates as server-sent events","description":"Emits `snapshot` on connect and `update` whenever the tournament changes, plus periodic `ping`. Reconnect as normal; the stream caps its own lifetime.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"An event stream","content":{"text/event-stream":{"schema":{"type":"string"}}}},"404":{"description":"No such tournament"}}}},"/tournaments/{slug}/pdf":{"get":{"operationId":"renderTournamentPdf","summary":"The bracket as a PDF","description":"Vector, selectable text, one page sized to the bracket rather than to A4 — a large field squeezed onto letter is single-page and unreadable.","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}},{"name":"theme","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"The PDF","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"No such tournament.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"The engine could not complete the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/tournaments":{"get":{"operationId":"listTournaments","summary":"List public tournaments","description":"Summary rows only. Fetch a single tournament by slug for participants and matches.","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["live","upcoming","complete","archived"]}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"cursor","in":"query","required":false,"description":"The nextCursor value from a previous response.","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of tournaments","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TournamentList"}}}},"400":{"description":"Invalid query parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/tournaments/{slug}":{"get":{"operationId":"getTournament","summary":"Get one tournament with its full match graph","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-None-Match","in":"header","required":false,"description":"Echo a previous ETag to receive 304 when unchanged.","schema":{"type":"string"}}],"responses":{"200":{"description":"The tournament","headers":{"ETag":{"description":"Tournament version. Send as If-Match on writes.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TournamentDetail"}}}},"304":{"description":"Unchanged since the supplied ETag"},"404":{"description":"No such tournament","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}},"components":{"schemas":{"Source":{"$schema":"https://json-schema.org/draft/2020-12/schema","oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"seed"},"n":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","n"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"winner"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"loser"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"standing"},"groupId":{"type":"string","minLength":1},"place":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","groupId","place"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"thirdPlace"},"groups":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bye"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"open"}},"required":["kind"],"additionalProperties":false}]},"Participant":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"shortName":{"type":"string"},"seed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"region":{"type":"string"},"logoUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"primaryColor":{"anyOf":[{"type":"string"},{"type":"null"}]},"record":{"type":"string"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"eliminated":{"type":"boolean"},"checkedIn":{"type":"boolean"},"meta":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","name","shortName","seed","region","logoUrl","primaryColor","record","summary","eliminated","checkedIn","meta"],"additionalProperties":false},"Match":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string"},"round":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"side":{"type":"string","enum":["winners","losers","final","third_place","group"]},"slotA":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"seed"},"n":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","n"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"winner"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"loser"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"standing"},"groupId":{"type":"string","minLength":1},"place":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","groupId","place"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"thirdPlace"},"groups":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bye"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"open"}},"required":["kind"],"additionalProperties":false}]},"slotB":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"seed"},"n":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","n"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"winner"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"loser"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"standing"},"groupId":{"type":"string","minLength":1},"place":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","groupId","place"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"thirdPlace"},"groups":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bye"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"open"}},"required":["kind"],"additionalProperties":false}]},"slotAId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"slotBId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"winnerId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"scoreA":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"scoreB":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"status":{"type":"string","enum":["scheduled","ready","live","final","bye","void","disputed"]},"scheduledTime":{"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))$"},{"type":"null"}]}},"required":["id","round","position","side","slotA","slotB","slotAId","slotBId","winnerId","scoreA","scoreB","status","scheduledTime"],"additionalProperties":false},"Group":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"participantIds":{"type":"array","items":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}}},"required":["id","name","position","participantIds"],"additionalProperties":false},"Tournament":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"slug":{"type":"string"},"name":{"type":"string"},"sport":{"type":"string"},"format":{"type":"string","enum":["SINGLE_ELIM","DOUBLE_ELIM","ROUND_ROBIN","SWISS","TWO_STAGE","GROUP_KNOCKOUT","SERIES"]},"status":{"type":"string","enum":["upcoming","live","complete","archived"]},"visibility":{"type":"string","enum":["public","unlisted","private"]},"source":{"type":"string","enum":["curated","user"]},"subtitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"accent":{"anyOf":[{"type":"string"},{"type":"null"}]},"bestOf":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"startDate":{"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))$"},{"type":"null"}]},"endDate":{"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))$"},{"type":"null"}]},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","slug","name","sport","format","status","visibility","source","subtitle","accent","bestOf","startDate","endDate","config","version"],"additionalProperties":false},"TournamentDetail":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"slug":{"type":"string"},"name":{"type":"string"},"sport":{"type":"string"},"format":{"type":"string","enum":["SINGLE_ELIM","DOUBLE_ELIM","ROUND_ROBIN","SWISS","TWO_STAGE","GROUP_KNOCKOUT","SERIES"]},"status":{"type":"string","enum":["upcoming","live","complete","archived"]},"visibility":{"type":"string","enum":["public","unlisted","private"]},"source":{"type":"string","enum":["curated","user"]},"subtitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"accent":{"anyOf":[{"type":"string"},{"type":"null"}]},"bestOf":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"startDate":{"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))$"},{"type":"null"}]},"endDate":{"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))$"},{"type":"null"}]},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"participants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"shortName":{"type":"string"},"seed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"region":{"type":"string"},"logoUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"primaryColor":{"anyOf":[{"type":"string"},{"type":"null"}]},"record":{"type":"string"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"eliminated":{"type":"boolean"},"checkedIn":{"type":"boolean"},"meta":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","name","shortName","seed","region","logoUrl","primaryColor","record","summary","eliminated","checkedIn","meta"],"additionalProperties":false}},"groups":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"participantIds":{"type":"array","items":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}}},"required":["id","name","position","participantIds"],"additionalProperties":false}},"matches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"round":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"side":{"type":"string","enum":["winners","losers","final","third_place","group"]},"slotA":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"seed"},"n":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","n"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"winner"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"loser"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"standing"},"groupId":{"type":"string","minLength":1},"place":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","groupId","place"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"thirdPlace"},"groups":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bye"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"open"}},"required":["kind"],"additionalProperties":false}]},"slotB":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"seed"},"n":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","n"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"winner"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"loser"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"standing"},"groupId":{"type":"string","minLength":1},"place":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","groupId","place"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"thirdPlace"},"groups":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bye"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"open"}},"required":["kind"],"additionalProperties":false}]},"slotAId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"slotBId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"winnerId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"scoreA":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"scoreB":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"status":{"type":"string","enum":["scheduled","ready","live","final","bye","void","disputed"]},"scheduledTime":{"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))$"},{"type":"null"}]}},"required":["id","round","position","side","slotA","slotB","slotAId","slotBId","winnerId","scoreA","scoreB","status","scheduledTime"],"additionalProperties":false}}},"required":["id","slug","name","sport","format","status","visibility","source","subtitle","accent","bestOf","startDate","endDate","config","version","participants","groups","matches"],"additionalProperties":false},"TournamentList":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"slug":{"type":"string"},"name":{"type":"string"},"sport":{"type":"string"},"format":{"type":"string","enum":["SINGLE_ELIM","DOUBLE_ELIM","ROUND_ROBIN","SWISS","TWO_STAGE","GROUP_KNOCKOUT","SERIES"]},"status":{"type":"string","enum":["upcoming","live","complete","archived"]},"visibility":{"type":"string","enum":["public","unlisted","private"]},"source":{"type":"string","enum":["curated","user"]},"subtitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"accent":{"anyOf":[{"type":"string"},{"type":"null"}]},"bestOf":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"startDate":{"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))$"},{"type":"null"}]},"endDate":{"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))$"},{"type":"null"}]},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","slug","name","sport","format","status","visibility","source","subtitle","accent","bestOf","startDate","endDate","config","version"],"additionalProperties":false}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","nextCursor"],"additionalProperties":false},"ApiError":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["invalid_request","unauthorized","forbidden","not_found","conflict","rate_limited","internal"]},"message":{"type":"string","minLength":1},"details":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"],"additionalProperties":false}}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false},"Structure":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"format":{"type":"string","enum":["SINGLE_ELIM","DOUBLE_ELIM","ROUND_ROBIN","SWISS","TWO_STAGE"]},"participants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"seed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","name","seed"],"additionalProperties":false}},"matches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"round":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"side":{"type":"string","enum":["winners","losers","final","third_place","group"]},"slotA":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"seed"},"n":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","n"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"winner"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"loser"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"standing"},"groupId":{"type":"string","minLength":1},"place":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","groupId","place"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"thirdPlace"},"groups":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bye"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"open"}},"required":["kind"],"additionalProperties":false}]},"slotB":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"seed"},"n":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","n"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"winner"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"loser"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"standing"},"groupId":{"type":"string","minLength":1},"place":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","groupId","place"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"thirdPlace"},"groups":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bye"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"open"}},"required":["kind"],"additionalProperties":false}]},"onlyIf":{"type":"object","properties":{"matchId":{"type":"string"},"winner":{"type":"string","enum":["A","B"]}},"required":["matchId","winner"],"additionalProperties":false}},"required":["id","round","position","side","slotA","slotB"],"additionalProperties":false}},"seed":{"type":"string"}},"required":["format","participants","matches","seed"],"additionalProperties":false},"GenerateRequest":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"format":{"type":"string","enum":["SINGLE_ELIM","DOUBLE_ELIM","ROUND_ROBIN","SWISS","TWO_STAGE"]},"participants":{"maxItems":1024,"type":"array","items":{"anyOf":[{"type":"string","minLength":1,"maxLength":120},{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":120},"name":{"type":"string","minLength":1,"maxLength":120},"seed":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["name"],"additionalProperties":false}]}},"options":{"type":"object","properties":{"thirdPlace":{"type":"boolean"},"randomize":{"type":"boolean"},"grandFinalReset":{"type":"boolean"},"iterations":{"type":"integer","minimum":1,"maximum":3},"swissRounds":{"type":"integer","minimum":1,"maximum":20},"groups":{"type":"integer","minimum":2,"maximum":26},"advancePerGroup":{"type":"integer","minimum":1,"maximum":8},"extraQualifiers":{"type":"integer","minimum":0,"maximum":16},"placements":{"type":"integer","minimum":2,"maximum":8}},"additionalProperties":false},"seed":{"type":"string","minLength":1,"maxLength":200},"render":{"default":["text"],"type":"array","items":{"type":"string","enum":["text","svg"]}}},"required":["format","participants","render"],"additionalProperties":false},"ApplyRequest":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"structure":{"type":"object","properties":{"format":{"type":"string","enum":["SINGLE_ELIM","DOUBLE_ELIM","ROUND_ROBIN","SWISS","TWO_STAGE"]},"participants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"seed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","name","seed"],"additionalProperties":false}},"matches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"round":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"side":{"type":"string","enum":["winners","losers","final","third_place","group"]},"slotA":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"seed"},"n":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","n"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"winner"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"loser"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"standing"},"groupId":{"type":"string","minLength":1},"place":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","groupId","place"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"thirdPlace"},"groups":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bye"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"open"}},"required":["kind"],"additionalProperties":false}]},"slotB":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"seed"},"n":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","n"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"winner"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"loser"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"standing"},"groupId":{"type":"string","minLength":1},"place":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","groupId","place"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"thirdPlace"},"groups":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bye"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"open"}},"required":["kind"],"additionalProperties":false}]},"onlyIf":{"type":"object","properties":{"matchId":{"type":"string"},"winner":{"type":"string","enum":["A","B"]}},"required":["matchId","winner"],"additionalProperties":false}},"required":["id","round","position","side","slotA","slotB"],"additionalProperties":false}},"seed":{"type":"string"}},"required":["format","participants","matches","seed"],"additionalProperties":false},"results":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"winner":{"type":"string","enum":["A","B"]},"scoreA":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"scoreB":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["winner"],"additionalProperties":false}},"report":{"type":"object","properties":{"matchId":{"type":"string","minLength":1},"winner":{"type":"string","enum":["A","B"]},"scoreA":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"scoreB":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["matchId","winner"],"additionalProperties":false}},"required":["structure","results","report"],"additionalProperties":false},"RenderRequest":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"structure":{"type":"object","properties":{"format":{"type":"string","enum":["SINGLE_ELIM","DOUBLE_ELIM","ROUND_ROBIN","SWISS","TWO_STAGE"]},"participants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"seed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","name","seed"],"additionalProperties":false}},"matches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"round":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"side":{"type":"string","enum":["winners","losers","final","third_place","group"]},"slotA":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"seed"},"n":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","n"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"winner"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"loser"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"standing"},"groupId":{"type":"string","minLength":1},"place":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","groupId","place"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"thirdPlace"},"groups":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bye"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"open"}},"required":["kind"],"additionalProperties":false}]},"slotB":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"seed"},"n":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","n"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"winner"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"loser"},"matchId":{"type":"string","minLength":1}},"required":["kind","matchId"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"standing"},"groupId":{"type":"string","minLength":1},"place":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["kind","groupId","place"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"thirdPlace"},"groups":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","groups"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"bye"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"open"}},"required":["kind"],"additionalProperties":false}]},"onlyIf":{"type":"object","properties":{"matchId":{"type":"string"},"winner":{"type":"string","enum":["A","B"]}},"required":["matchId","winner"],"additionalProperties":false}},"required":["id","round","position","side","slotA","slotB"],"additionalProperties":false}},"seed":{"type":"string"}},"required":["format","participants","matches","seed"],"additionalProperties":false},"results":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"winner":{"type":"string","enum":["A","B"]},"scoreA":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"scoreB":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["winner"],"additionalProperties":false}},"as":{"default":"text","type":"string","enum":["text","json","svg"]}},"required":["structure","results","as"],"additionalProperties":false},"CreateTournamentRequest":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"format":{"type":"string","enum":["SINGLE_ELIM","DOUBLE_ELIM","ROUND_ROBIN","SWISS","TWO_STAGE"]},"participants":{"minItems":2,"maxItems":1024,"type":"array","items":{"type":"string","minLength":1,"maxLength":120}},"options":{"default":{},"type":"object","properties":{"randomize":{"type":"boolean"},"thirdPlace":{"type":"boolean"},"grandFinalReset":{"type":"boolean"},"iterations":{"type":"integer","minimum":1,"maximum":3},"swissRounds":{"type":"integer","minimum":1,"maximum":20},"groups":{"type":"integer","minimum":2,"maximum":26},"advancePerGroup":{"type":"integer","minimum":1,"maximum":8},"extraQualifiers":{"type":"integer","minimum":0,"maximum":16},"placements":{"type":"integer","minimum":2,"maximum":8}},"additionalProperties":false},"seed":{"type":"string","minLength":1,"maxLength":200},"visibility":{"default":"unlisted","type":"string","enum":["public","unlisted","private"]}},"required":["name","format","participants","options","visibility"],"additionalProperties":false},"ReportScoreRequest":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"matchId":{"type":"string","minLength":1,"description":"Match key, e.g. \"W1.2\" or \"GF\"."},"winnerId":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Participant id of the winner."},"scoreA":{"type":"integer","minimum":0,"maximum":9007199254740991},"scoreB":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["matchId","winnerId"],"additionalProperties":false}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"A Supabase session access token."}}}}