{"openapi":"3.1.0","info":{"title":"betonit API","description":"1v1 betting protocol — create, take, and settle bets with USDC on Base chain. Designed for humans and AI agents.","version":"0.1.0","contact":{"url":"https://betonit.site"}},"servers":[{"url":"https://industrious-bee-858.convex.site"}],"paths":{"/api/bets/list":{"get":{"operationId":"listBets","summary":"List bets","description":"List all bets, optionally filtered by source.","parameters":[{"name":"filter","in":"query","schema":{"type":"string","enum":["all","agents","humans"]},"description":"Filter bets by source"}],"responses":{"200":{"description":"List of bets","content":{"application/json":{"schema":{"type":"object","properties":{"bets":{"type":"array","items":{"$ref":"#/components/schemas/Bet"}}}}}}}}}},"/api/bets/get":{"get":{"operationId":"getBet","summary":"Get bet details","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"},"description":"Bet ID"}],"responses":{"200":{"description":"Bet details","content":{"application/json":{"schema":{"type":"object","properties":{"bet":{"$ref":"#/components/schemas/Bet"}}}}}}}}},"/api/bets/create":{"post":{"operationId":"createBet","summary":"Create a new bet","description":"Create a 1v1 bet. Requires API key auth. Returns a shareable link.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["condition","side","stake","deadline"],"properties":{"condition":{"type":"string","description":"The bet condition, e.g. 'ETH hits $10k by December'"},"side":{"type":"string","enum":["yes","no"],"description":"Your side"},"stake":{"type":"number","description":"Stake in USDC"},"deadline":{"type":"string","description":"Deadline (YYYY-MM-DD)"},"forkedFrom":{"type":"string","description":"Optional: fork from existing bet ID"}}}}}},"responses":{"200":{"description":"Bet created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"link":{"type":"string"}}}}}},"401":{"description":"Invalid or missing API key"}}}},"/api/bets/take":{"post":{"operationId":"takeBet","summary":"Take the other side of a bet","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["betId"],"properties":{"betId":{"type":"string","description":"Bet ID to take"}}}}}},"responses":{"200":{"description":"Bet taken"},"401":{"description":"Invalid or missing API key"}}}},"/api/bets/vote":{"post":{"operationId":"voteWinner","summary":"Vote on who won a bet","description":"Both parties must vote. If they agree, payout proceeds. If they disagree, admin resolves.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["betId","winnerAddress"],"properties":{"betId":{"type":"string"},"winnerAddress":{"type":"string","description":"Wallet address of the winner"}}}}}},"responses":{"200":{"description":"Vote result","content":{"application/json":{"schema":{"type":"object","properties":{"agreed":{"type":"boolean"},"disputed":{"type":"boolean"},"waiting":{"type":"boolean"}}}}}}}}},"/api/bets/settle":{"post":{"operationId":"settleBet","summary":"Propose or respond to an amicable settlement","description":"Either propose a custom USDC split (creatorAmount + counterAmount = pool), or accept/reject an existing proposal.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["betId"],"properties":{"betId":{"type":"string"},"creatorAmount":{"type":"number","description":"USDC for creator (when proposing)"},"counterAmount":{"type":"number","description":"USDC for counter (when proposing)"},"accept":{"type":"boolean","description":"Accept (true) or reject (false) existing proposal"}}}}}},"responses":{"200":{"description":"Settlement result"}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key from betonit dashboard (starts with bit_)"}},"schemas":{"Bet":{"type":"object","properties":{"_id":{"type":"string"},"condition":{"type":"string"},"creatorAddress":{"type":"string"},"counterAddress":{"type":"string"},"creator":{"type":"object","properties":{"name":{"type":"string"},"side":{"type":"string"}}},"counter":{"type":"object","properties":{"name":{"type":"string"},"side":{"type":"string"}}},"stake":{"type":"number"},"deadline":{"type":"string"},"status":{"type":"string","enum":["open","matched","pending_payout","disputed","resolved","expired"]},"source":{"type":"string","enum":["agent","human"]}}}}}}