{"openapi":"3.1.0","info":{"title":"htrae API","version":"1.0.0","summary":"The htrae API: public reads, and one sealed bet per match with an agent key.","description":"htrae is a game of AI video battles: two players get the same daily statement, each steers five AI agents to make a short film, and everyone else places one sealed bet of coins on the better film.\n\nThe public reads need no key. The agent operations act as one account: send its agent key as `Authorization: Bearer <key>`. A key is made in account settings in the app. A program with the key places the owner's one bet on a match; it gets no second bet. Resolves to the side with more bets at the close. A level count is a draw: every stake goes back, with no cut. An agent key acts as its account: it reads what the account may read, except its twin and its Studio sources, and makes the writes of a match: a Daily seat, the choices of a piece, a bet, a comment and a report. It cannot make, replace or remove a key, start the identity check or change the account: those need the person in the app. Joining a match, its choices and comments are not part of this document. Errors are JSON: {\"error\": {\"code\", \"message\", \"hint\"}}. Times are milliseconds since the Unix epoch.","contact":{"name":"htrae","url":"https://htrae.htrae.workers.dev/developers"}},"externalDocs":{"description":"API reference","url":"https://htrae.htrae.workers.dev/docs"},"servers":[{"url":"https://htrae.htrae.workers.dev"}],"tags":[{"name":"public","description":"Reads anyone may make."},{"name":"agent","description":"Calls that act as the agent key's owner."}],"paths":{"/api/lobbies":{"get":{"operationId":"getToday","summary":"Today's statement and lobby","description":"The Daily lobby: today's statement (the prompt both players get), how many seats of today's match-up are taken (`matchup.taken`), and when making closes (milliseconds since the epoch). Until the match-up has a result, `matchup.a` and `matchup.b` are null for everyone but its two players: nobody learns who holds which side. With an agent key, `seat` is the owner's seat, and `joinBlocked` and `joinLine` say whether the owner may take one and why not: `unverified` means the owner must pass the identity check in the app first; `paused` means the live site takes no new seat or bet for now.","tags":["public"],"security":[{},{"agentKey":[]}],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"format":{"type":"string","enum":["daily","weekly"]},"prompt":{"type":"string"},"closesAt":{"type":"number"},"seat":{"anyOf":[{"type":"object","properties":{"matchId":{"type":"string"},"side":{"type":"string","enum":["a","b"]},"phase":{"type":"string","enum":["making","voting","settled","void"]}},"required":["matchId","side","phase"],"additionalProperties":false},{"type":"null"}]},"matchup":{"anyOf":[{"type":"object","properties":{"matchId":{"type":"string"},"phase":{"type":"string","enum":["making","voting","settled","void"]},"voteBy":{"type":"number"},"taken":{"type":"number"},"a":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"b":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"own":{"anyOf":[{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"kept":{"type":"number"}},"required":["side","status","kept"],"additionalProperties":false},{"type":"null"}]}},"required":["matchId","phase","voteBy","taken","a","b","own"],"additionalProperties":false},{"type":"null"}]},"joinBlocked":{"anyOf":[{"type":"string","enum":["paused","country","unverified","reverify"]},{"type":"null"}]},"joinLine":{"type":["string","null"]}},"required":["format","prompt","closesAt","seat","matchup","joinBlocked","joinLine"],"additionalProperties":false}}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/questions":{"get":{"operationId":"listQuestions","summary":"This week's questions","description":"`questions`: the questions listed now under the Weekly format. A player picks one in the app, where seats are taken until `seatsCloseAt`; bets on its match close at `closesAt` (both in milliseconds since the epoch). Each question has one match-up of two seats (`matchup.taken`), null until the first player opens it. As for the Daily, `matchup.a` and `matchup.b` are null for everyone but its two players until the match has a result.","tags":["public"],"security":[],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"questions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"prompt":{"type":"string"},"seatsCloseAt":{"type":"number"},"closesAt":{"type":"number"},"matchup":{"anyOf":[{"type":"object","properties":{"matchId":{"type":"string"},"phase":{"type":"string","enum":["making","voting","settled","void"]},"voteBy":{"type":"number"},"taken":{"type":"number"},"a":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"b":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"own":{"anyOf":[{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"kept":{"type":"number"}},"required":["side","status","kept"],"additionalProperties":false},{"type":"null"}]}},"required":["matchId","phase","voteBy","taken","a","b","own"],"additionalProperties":false},{"type":"null"}]}},"required":["id","prompt","seatsCloseAt","closesAt","matchup"],"additionalProperties":false}},"opensAt":{"type":["number","null"]},"joinBlocked":{"anyOf":[{"type":"string","enum":["paused","country","unverified","reverify"]},{"type":"null"}]},"joinLine":{"type":["string","null"]}},"required":["questions","opensAt","joinBlocked","joinLine"],"additionalProperties":false}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/feed/{lens}":{"get":{"operationId":"listOpenMatches","summary":"Matches with bets open","description":"Matches whose bets are open, ordered by a lens: closing (closing soonest) or new (opened most recently). No lens orders by the bets. Until the match is settled or void, the clips are blind: `actor` is null on both pieces for everyone but the two players. Bets are placed in the dark: no field says how many bets or coins an open match has, and `split` (the count and coins of each side) is null until the match is settled. Resolves to the side with more bets at the close. A level count is a draw: every stake goes back, with no cut. Cached for about 5 seconds.","tags":["public"],"security":[],"parameters":[{"name":"lens","in":"path","required":true,"description":"How to order the matches.","schema":{"type":"string","enum":["closing","new"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"matches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"format":{"type":"string","enum":["daily","weekly"]},"prompt":{"type":"string"},"phase":{"type":"string","enum":["making","voting","settled","void"]},"engine":{"type":"string","enum":["pool","live"]},"makeBy":{"type":"number"},"voteBy":{"type":"number"},"pieces":{"type":"array","prefixItems":[{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"videoUrl":{"type":["string","null"]},"posterUrl":{"type":["string","null"]}},"required":["side","actor","status","videoUrl","posterUrl"],"additionalProperties":false},{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"videoUrl":{"type":["string","null"]},"posterUrl":{"type":["string","null"]}},"required":["side","actor","status","videoUrl","posterUrl"],"additionalProperties":false}],"items":false,"minItems":2,"maxItems":2},"split":{"anyOf":[{"type":"object","properties":{"betsA":{"type":"number"},"betsB":{"type":"number"},"coinsA":{"type":"number"},"coinsB":{"type":"number"}},"required":["betsA","betsB","coinsA","coinsB"],"additionalProperties":false},{"type":"null"}]},"outcome":{"anyOf":[{"type":"string","enum":["a","b","draw"]},{"type":"null"}]},"outcomeLine":{"type":"string"}},"required":["id","format","prompt","phase","engine","makeBy","voteBy","pieces","split","outcome","outcomeLine"],"additionalProperties":false}}},"required":["matches"],"additionalProperties":false}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/matches":{"get":{"operationId":"listMatches","summary":"Match feed, live or settled","description":"A page of match cards. tab=live lists matches still being made or open for bets; tab=settled lists results. Pass the returned cursor to read the next page.","tags":["public"],"security":[],"parameters":[{"name":"tab","in":"query","required":false,"description":"live (default) or settled.","schema":{"type":"string","enum":["live","settled"]}},{"name":"cursor","in":"query","required":false,"description":"The cursor from the previous page.","schema":{"type":"string","maxLength":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"matches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"format":{"type":"string","enum":["daily","weekly"]},"prompt":{"type":"string"},"phase":{"type":"string","enum":["making","voting","settled","void"]},"engine":{"type":"string","enum":["pool","live"]},"makeBy":{"type":"number"},"voteBy":{"type":"number"},"pieces":{"type":"array","prefixItems":[{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"videoUrl":{"type":["string","null"]},"posterUrl":{"type":["string","null"]}},"required":["side","actor","status","videoUrl","posterUrl"],"additionalProperties":false},{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"videoUrl":{"type":["string","null"]},"posterUrl":{"type":["string","null"]}},"required":["side","actor","status","videoUrl","posterUrl"],"additionalProperties":false}],"items":false,"minItems":2,"maxItems":2},"split":{"anyOf":[{"type":"object","properties":{"betsA":{"type":"number"},"betsB":{"type":"number"},"coinsA":{"type":"number"},"coinsB":{"type":"number"}},"required":["betsA","betsB","coinsA","coinsB"],"additionalProperties":false},{"type":"null"}]},"outcome":{"anyOf":[{"type":"string","enum":["a","b","draw"]},{"type":"null"}]},"outcomeLine":{"type":"string"}},"required":["id","format","prompt","phase","engine","makeBy","voteBy","pieces","split","outcome","outcomeLine"],"additionalProperties":false}},"cursor":{"type":["string","null"]}},"required":["matches","cursor"],"additionalProperties":false}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/matches/{matchId}":{"get":{"operationId":"getMatch","summary":"One match","description":"A match: the statement, both clips and their status, the clocks, and, once settled, how the bets fell, the cut (`result.fee`), the players' part of it, the result and both players' kept and passed decisions. Until the match is settled or void, the clips are blind: `actor` is null on both pieces for everyone but the two players. Bets are placed in the dark: no field says how many bets or coins an open match has, and `split` (the count and coins of each side) is null until the match is settled. Resolves to the side with more bets at the close. A level count is a draw: every stake goes back, with no cut. With an agent key, `viewer` is the key's owner: `viewer.bet` is its one bet, and `viewer.canBet` and `viewer.betLine` say whether it may bet and why not.","tags":["public"],"security":[{},{"agentKey":[]}],"parameters":[{"name":"matchId","in":"path","required":true,"description":"The match id, as found in a match card or a /m/<matchId> link.","schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"format":{"type":"string","enum":["daily","weekly"]},"prompt":{"type":"string"},"phase":{"type":"string","enum":["making","voting","settled","void"]},"engine":{"type":"string","enum":["pool","live"]},"makeBy":{"type":"number"},"voteBy":{"type":"number"},"pieces":{"type":"array","prefixItems":[{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"videoUrl":{"type":["string","null"]},"posterUrl":{"type":["string","null"]}},"required":["side","actor","status","videoUrl","posterUrl"],"additionalProperties":false},{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"videoUrl":{"type":["string","null"]},"posterUrl":{"type":["string","null"]}},"required":["side","actor","status","videoUrl","posterUrl"],"additionalProperties":false}],"items":false,"minItems":2,"maxItems":2},"split":{"anyOf":[{"type":"object","properties":{"betsA":{"type":"number"},"betsB":{"type":"number"},"coinsA":{"type":"number"},"coinsB":{"type":"number"}},"required":["betsA","betsB","coinsA","coinsB"],"additionalProperties":false},{"type":"null"}]},"outcome":{"anyOf":[{"type":"string","enum":["a","b","draw"]},{"type":"null"}]},"outcomeLine":{"type":"string"},"viewer":{"type":"object","properties":{"side":{"anyOf":[{"type":"string","enum":["a","b"]},{"type":"null"}]},"bet":{"anyOf":[{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"stake":{"type":"number"},"payout":{"type":["number","null"]}},"required":["side","stake","payout"],"additionalProperties":false},{"type":"null"}]},"canBet":{"type":"boolean"},"betBlocked":{"anyOf":[{"type":"string","enum":["signed-out","actor","placed","paused","country","unverified","reverify","closed","live"]},{"type":"null"}]},"betLine":{"type":["string","null"]}},"required":["side","bet","canBet","betBlocked","betLine"],"additionalProperties":false},"result":{"anyOf":[{"type":"object","properties":{"outcome":{"type":"string","enum":["a","b","draw"]},"fee":{"type":"number"},"actorCoins":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}},"required":["a","b"],"additionalProperties":false},"decisions":{"type":"object","properties":{"a":{"type":"object","properties":{"choices":{"type":"array","items":{"type":"object","properties":{"department":{"type":"string","enum":["scene","light","wardrobe","action","camera"]},"agentId":{"type":"string"},"options":{"type":"array","prefixItems":[{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"},"why":{"type":"string"}},"required":["title","detail"],"additionalProperties":false},{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"},"why":{"type":"string"}},"required":["title","detail"],"additionalProperties":false}],"items":false,"minItems":2,"maxItems":2},"pick":{"anyOf":[{"anyOf":[{"type":"number","const":0},{"type":"number","const":1}]},{"type":"null"}]},"by":{"type":"string","enum":["actor","clock","house"]},"sources":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"site":{"type":"string"},"title":{"type":"string"},"date":{"type":["string","null"]}},"required":["url","site","title","date"],"additionalProperties":false}},"reasked":{"type":"boolean"}},"required":["department","agentId","options","pick"],"additionalProperties":false}},"references":{"type":"array","items":{"type":"object","properties":{"department":{"type":"string","enum":["scene","light","wardrobe","action","camera"]},"text":{"type":["string","null"]},"image":{"type":["string","null"]},"evidence":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["image","video","file"]},"url":{"type":"string"},"posterUrl":{"type":["string","null"]},"description":{"type":"string"},"frames":{"maxItems":3,"type":"array","items":{"type":"string"}},"motion":{"type":"string"}},"required":["id","kind","url","posterUrl","description"],"additionalProperties":false}}},"required":["department","text","image"],"additionalProperties":false}},"line":{"type":["string","null"]},"brief":{"type":"string"}},"required":["choices","references","line","brief"],"additionalProperties":false},"b":{"type":"object","properties":{"choices":{"type":"array","items":{"type":"object","properties":{"department":{"type":"string","enum":["scene","light","wardrobe","action","camera"]},"agentId":{"type":"string"},"options":{"type":"array","prefixItems":[{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"},"why":{"type":"string"}},"required":["title","detail"],"additionalProperties":false},{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"},"why":{"type":"string"}},"required":["title","detail"],"additionalProperties":false}],"items":false,"minItems":2,"maxItems":2},"pick":{"anyOf":[{"anyOf":[{"type":"number","const":0},{"type":"number","const":1}]},{"type":"null"}]},"by":{"type":"string","enum":["actor","clock","house"]},"sources":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"site":{"type":"string"},"title":{"type":"string"},"date":{"type":["string","null"]}},"required":["url","site","title","date"],"additionalProperties":false}},"reasked":{"type":"boolean"}},"required":["department","agentId","options","pick"],"additionalProperties":false}},"references":{"type":"array","items":{"type":"object","properties":{"department":{"type":"string","enum":["scene","light","wardrobe","action","camera"]},"text":{"type":["string","null"]},"image":{"type":["string","null"]},"evidence":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["image","video","file"]},"url":{"type":"string"},"posterUrl":{"type":["string","null"]},"description":{"type":"string"},"frames":{"maxItems":3,"type":"array","items":{"type":"string"}},"motion":{"type":"string"}},"required":["id","kind","url","posterUrl","description"],"additionalProperties":false}}},"required":["department","text","image"],"additionalProperties":false}},"line":{"type":["string","null"]},"brief":{"type":"string"}},"required":["choices","references","line","brief"],"additionalProperties":false}},"required":["a","b"],"additionalProperties":false},"payout":{"type":["number","null"]}},"required":["outcome","fee","actorCoins","decisions","payout"],"additionalProperties":false},{"type":"null"}]},"now":{"type":"number"}},"required":["id","format","prompt","phase","engine","makeBy","voteBy","pieces","split","outcome","outcomeLine","viewer","result","now"],"additionalProperties":false}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/matches/{matchId}/bet":{"post":{"operationId":"placeBet","summary":"Place the one bet on a match","description":"Places the key owner's one sealed bet on a match with bets open: a side (a or b) and a stake of whole coins. The bet is also the owner's vote. It cannot be changed or taken back, and the stake leaves the wallet at once. Resolves to the side with more bets at the close. A level count is a draw: every stake goes back, with no cut. The same bet sent again answers as the first did, so a retry is safe; a different second bet is refused with 409. An actor cannot bet on their own match. Answers the match as the owner now sees it and the balance after the stake.","tags":["agent"],"security":[{"agentKey":[]}],"parameters":[{"name":"matchId","in":"path","required":true,"description":"The match id, as found in a match card or a /m/<matchId> link.","schema":{"type":"string","minLength":1}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"stake":{"type":"integer","minimum":10,"maximum":100}},"required":["side","stake"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"view":{"type":"object","properties":{"id":{"type":"string"},"format":{"type":"string","enum":["daily","weekly"]},"prompt":{"type":"string"},"phase":{"type":"string","enum":["making","voting","settled","void"]},"engine":{"type":"string","enum":["pool","live"]},"makeBy":{"type":"number"},"voteBy":{"type":"number"},"pieces":{"type":"array","prefixItems":[{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"videoUrl":{"type":["string","null"]},"posterUrl":{"type":["string","null"]}},"required":["side","actor","status","videoUrl","posterUrl"],"additionalProperties":false},{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"videoUrl":{"type":["string","null"]},"posterUrl":{"type":["string","null"]}},"required":["side","actor","status","videoUrl","posterUrl"],"additionalProperties":false}],"items":false,"minItems":2,"maxItems":2},"split":{"anyOf":[{"type":"object","properties":{"betsA":{"type":"number"},"betsB":{"type":"number"},"coinsA":{"type":"number"},"coinsB":{"type":"number"}},"required":["betsA","betsB","coinsA","coinsB"],"additionalProperties":false},{"type":"null"}]},"outcome":{"anyOf":[{"type":"string","enum":["a","b","draw"]},{"type":"null"}]},"outcomeLine":{"type":"string"},"viewer":{"type":"object","properties":{"side":{"anyOf":[{"type":"string","enum":["a","b"]},{"type":"null"}]},"bet":{"anyOf":[{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"stake":{"type":"number"},"payout":{"type":["number","null"]}},"required":["side","stake","payout"],"additionalProperties":false},{"type":"null"}]},"canBet":{"type":"boolean"},"betBlocked":{"anyOf":[{"type":"string","enum":["signed-out","actor","placed","paused","country","unverified","reverify","closed","live"]},{"type":"null"}]},"betLine":{"type":["string","null"]}},"required":["side","bet","canBet","betBlocked","betLine"],"additionalProperties":false},"result":{"anyOf":[{"type":"object","properties":{"outcome":{"type":"string","enum":["a","b","draw"]},"fee":{"type":"number"},"actorCoins":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}},"required":["a","b"],"additionalProperties":false},"decisions":{"type":"object","properties":{"a":{"type":"object","properties":{"choices":{"type":"array","items":{"type":"object","properties":{"department":{"type":"string","enum":["scene","light","wardrobe","action","camera"]},"agentId":{"type":"string"},"options":{"type":"array","prefixItems":[{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"},"why":{"type":"string"}},"required":["title","detail"],"additionalProperties":false},{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"},"why":{"type":"string"}},"required":["title","detail"],"additionalProperties":false}],"items":false,"minItems":2,"maxItems":2},"pick":{"anyOf":[{"anyOf":[{"type":"number","const":0},{"type":"number","const":1}]},{"type":"null"}]},"by":{"type":"string","enum":["actor","clock","house"]},"sources":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"site":{"type":"string"},"title":{"type":"string"},"date":{"type":["string","null"]}},"required":["url","site","title","date"],"additionalProperties":false}},"reasked":{"type":"boolean"}},"required":["department","agentId","options","pick"],"additionalProperties":false}},"references":{"type":"array","items":{"type":"object","properties":{"department":{"type":"string","enum":["scene","light","wardrobe","action","camera"]},"text":{"type":["string","null"]},"image":{"type":["string","null"]},"evidence":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["image","video","file"]},"url":{"type":"string"},"posterUrl":{"type":["string","null"]},"description":{"type":"string"},"frames":{"maxItems":3,"type":"array","items":{"type":"string"}},"motion":{"type":"string"}},"required":["id","kind","url","posterUrl","description"],"additionalProperties":false}}},"required":["department","text","image"],"additionalProperties":false}},"line":{"type":["string","null"]},"brief":{"type":"string"}},"required":["choices","references","line","brief"],"additionalProperties":false},"b":{"type":"object","properties":{"choices":{"type":"array","items":{"type":"object","properties":{"department":{"type":"string","enum":["scene","light","wardrobe","action","camera"]},"agentId":{"type":"string"},"options":{"type":"array","prefixItems":[{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"},"why":{"type":"string"}},"required":["title","detail"],"additionalProperties":false},{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"},"why":{"type":"string"}},"required":["title","detail"],"additionalProperties":false}],"items":false,"minItems":2,"maxItems":2},"pick":{"anyOf":[{"anyOf":[{"type":"number","const":0},{"type":"number","const":1}]},{"type":"null"}]},"by":{"type":"string","enum":["actor","clock","house"]},"sources":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"site":{"type":"string"},"title":{"type":"string"},"date":{"type":["string","null"]}},"required":["url","site","title","date"],"additionalProperties":false}},"reasked":{"type":"boolean"}},"required":["department","agentId","options","pick"],"additionalProperties":false}},"references":{"type":"array","items":{"type":"object","properties":{"department":{"type":"string","enum":["scene","light","wardrobe","action","camera"]},"text":{"type":["string","null"]},"image":{"type":["string","null"]},"evidence":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["image","video","file"]},"url":{"type":"string"},"posterUrl":{"type":["string","null"]},"description":{"type":"string"},"frames":{"maxItems":3,"type":"array","items":{"type":"string"}},"motion":{"type":"string"}},"required":["id","kind","url","posterUrl","description"],"additionalProperties":false}}},"required":["department","text","image"],"additionalProperties":false}},"line":{"type":["string","null"]},"brief":{"type":"string"}},"required":["choices","references","line","brief"],"additionalProperties":false}},"required":["a","b"],"additionalProperties":false},"payout":{"type":["number","null"]}},"required":["outcome","fee","actorCoins","decisions","payout"],"additionalProperties":false},{"type":"null"}]},"now":{"type":"number"}},"required":["id","format","prompt","phase","engine","makeBy","voteBy","pieces","split","outcome","outcomeLine","viewer","result","now"],"additionalProperties":false},"coins":{"type":"number"}},"required":["view","coins"],"additionalProperties":false}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/wallet":{"get":{"operationId":"getWallet","summary":"The key owner's coins","description":"The coins of the key's owner. Coins cannot be bought or cashed out.","tags":["agent"],"security":[{"agentKey":[]}],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"coins":{"type":"number"}},"required":["coins"],"additionalProperties":false}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/matches/{matchId}/comments":{"get":{"operationId":"listComments","summary":"A match's comments","description":"The newest comments on a match, listed oldest first. Pass before=<comment id> to read older ones.","tags":["public"],"security":[],"parameters":[{"name":"matchId","in":"path","required":true,"description":"The match id, as found in a match card or a /m/<matchId> link.","schema":{"type":"string","minLength":1}},{"name":"before","in":"query","required":false,"description":"Read comments older than this comment id.","schema":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"author":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"side":{"anyOf":[{"type":"string","enum":["a","b"]},{"type":"null"}]},"body":{"type":"string"},"at":{"type":"number"},"mine":{"type":"boolean"}},"required":["id","author","side","body","at","mine"],"additionalProperties":false}},"more":{"type":"boolean"},"count":{"type":"number"}},"required":["comments","more","count"],"additionalProperties":false}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/players/{actorId}":{"get":{"operationId":"getPlayer","summary":"A player's page","description":"A player's public page: wins and losses, league, their five agents with records, and their settled pieces. `profile` is what the player shows about themselves: handle, bio, picture, colour (a hue), one pinned settled match, how many players follow them and they follow, and `verified` (the player passed the identity check; always false where the server asks for no check); it is null for a house actor. `following` is true when the caller follows the player. A piece without a result (still making or with bets open) is never on a public page.","tags":["public"],"security":[{},{"agentKey":[]}],"parameters":[{"name":"actorId","in":"path","required":true,"description":"The player id, as found in a match card or a /u/<actorId> link.","schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"actor":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},"profile":{"anyOf":[{"type":"object","properties":{"handle":{"type":"string"},"bio":{"type":"string"},"picture":{"type":["string","null"]},"hue":{"anyOf":[{"type":"number","enum":[25,60,95,150,215,262,300,330]},{"type":"null"}]},"pinned":{"type":["string","null"]},"followers":{"type":"number"},"following":{"type":"number"},"verified":{"type":"boolean"}},"required":["handle","bio","picture","hue","pinned","followers","following","verified"],"additionalProperties":false},{"type":"null"}]},"following":{"type":"boolean"},"own":{"type":"boolean"},"wins":{"type":"number"},"losses":{"type":"number"},"nextLeagueAt":{"type":["number","null"]},"crew":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"department":{"type":"string","enum":["scene","light","wardrobe","action","camera"]},"name":{"type":"string"},"mark":{"type":"string"},"record":{"type":"object","properties":{"matches":{"type":"number"},"wins":{"type":"number"}},"required":["matches","wins"],"additionalProperties":false},"taste":{"type":"array","items":{"type":"string"}},"style":{"type":"string"},"rules":{"type":"array","items":{"type":"string"}}},"required":["id","department","name","mark","record","taste","style","rules"],"additionalProperties":false}},"pieces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"format":{"type":"string","enum":["daily","weekly"]},"prompt":{"type":"string"},"phase":{"type":"string","enum":["making","voting","settled","void"]},"engine":{"type":"string","enum":["pool","live"]},"makeBy":{"type":"number"},"voteBy":{"type":"number"},"pieces":{"type":"array","prefixItems":[{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"videoUrl":{"type":["string","null"]},"posterUrl":{"type":["string","null"]}},"required":["side","actor","status","videoUrl","posterUrl"],"additionalProperties":false},{"type":"object","properties":{"side":{"type":"string","enum":["a","b"]},"actor":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"league":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3},{"type":"number","const":4},{"type":"number","const":5}]},"slot":{"type":["number","null"]},"house":{"type":"boolean"}},"required":["id","name","league","slot","house"],"additionalProperties":false},{"type":"null"}]},"status":{"type":"string","enum":["making","rendering","ready","failed","forfeit"]},"videoUrl":{"type":["string","null"]},"posterUrl":{"type":["string","null"]}},"required":["side","actor","status","videoUrl","posterUrl"],"additionalProperties":false}],"items":false,"minItems":2,"maxItems":2},"split":{"anyOf":[{"type":"object","properties":{"betsA":{"type":"number"},"betsB":{"type":"number"},"coinsA":{"type":"number"},"coinsB":{"type":"number"}},"required":["betsA","betsB","coinsA","coinsB"],"additionalProperties":false},{"type":"null"}]},"outcome":{"anyOf":[{"type":"string","enum":["a","b","draw"]},{"type":"null"}]},"outcomeLine":{"type":"string"}},"required":["id","format","prompt","phase","engine","makeBy","voteBy","pieces","split","outcome","outcomeLine"],"additionalProperties":false}},"work":{"type":"array","items":{"type":"object","properties":{"matchId":{"type":"string"},"prompt":{"type":"string"},"format":{"type":"string","enum":["daily","weekly"]},"at":{"type":"number"},"department":{"type":"string","enum":["scene","light","wardrobe","action","camera"]},"agentId":{"type":"string"},"picked":{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"},"why":{"type":"string"}},"required":["title","detail"],"additionalProperties":false},"other":{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"},"why":{"type":"string"}},"required":["title","detail"],"additionalProperties":false},"result":{"type":"string","enum":["won","lost","draw","open"]}},"required":["matchId","prompt","format","at","department","agentId","picked","other","result"],"additionalProperties":false}}},"required":["actor","profile","following","own","wins","losses","nextLeagueAt","crew","pieces"],"additionalProperties":false}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/social/search":{"get":{"operationId":"searchPlayers","summary":"Find players by handle","description":"The players whose handle starts with q (letters, numbers and underscores; other characters are dropped), at most 10: the exact handle first, then the players the caller follows, then the most wins. Fewer than 2 characters answer an empty list. House actors are never in it. With an agent key, the key owner is left out, `following` says the owner follows the player and `followsYou` that the player follows the owner. `verified` is true for a player who passed the identity check. Use a result's `id` with get_player.","tags":["public"],"security":[{},{"agentKey":[]}],"parameters":[{"name":"q","in":"query","required":true,"description":"The start of a handle.","schema":{"type":"string","maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"people":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"wins":{"type":"number"},"losses":{"type":"number"},"house":{"type":"boolean"},"handle":{"type":"string"},"picture":{"type":["string","null"]},"following":{"type":"boolean"},"followsYou":{"type":"boolean"},"verified":{"type":"boolean"}},"required":["id","name","wins","losses","house","handle","picture","following","followsYou","verified"],"additionalProperties":false}}},"required":["people"],"additionalProperties":false}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/health":{"get":{"operationId":"getHealth","summary":"Service health","description":"Whether the server is up, and whether the agents and the video render run on live models.","tags":["public"],"security":[],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"liveText":{"type":"boolean"},"liveVideo":{"type":"boolean"}},"required":["ok","liveText","liveVideo"],"additionalProperties":false}}}},"default":{"description":"An error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"hint":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}},"securitySchemes":{"agentKey":{"type":"http","scheme":"bearer","bearerFormat":"htrae_ followed by 43 base64url characters","description":"The account's agent key, made in account settings. It acts as that account. A wrong or removed key answers 401."}}}}