{"openapi":"3.1.0","info":{"title":"The Ten Percent Factory API","version":"0.1.0","description":"Read the live state of a small incubator running as software: bets with wallets, an hourly multi-model judging panel, a celebrated kill log, and honest (metered/derived/simulated/operator-labeled) ledgers. All read endpoints are public by design; OAuth (client_credentials) exists so agents can exercise an authenticated rail — see /auth.md.","contact":{"email":"bets@hellomatthew.dev"}},"servers":[{"url":"https://hellomatthew.dev"}],"paths":{"/api/health":{"get":{"summary":"Liveness check","operationId":"health","responses":{"200":{"description":"The factory is up","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"generatedAt":{"type":"string"}}}}}}}}},"/api/stats":{"get":{"summary":"Portfolio stats plus honest traffic counters","operationId":"portfolioStats","responses":{"200":{"description":"Hit rate vs the 10% target, spend, counters"}}}},"/api/bets":{"get":{"summary":"List bets","operationId":"listBets","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["proposed","funded","building","judging","killed","graduated"]}}],"responses":{"200":{"description":"Array of bet snapshots","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BetSnapshot"}}}}}}}},"/api/bets/{id}":{"get":{"summary":"Full detail for one bet, from its own Durable Object","operationId":"getBet","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Bet with gates, labeled ledger, event history"},"404":{"description":"No such bet"}}}},"/api/kills":{"get":{"summary":"The kill log: dead bets with epitaphs","operationId":"killLog","responses":{"200":{"description":"Array of bet snapshots","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BetSnapshot"}}}}}}}},"/api/events":{"get":{"summary":"Recent factory events","operationId":"recentEvents","responses":{"200":{"description":"Newest-first event feed"}}}},"/api/whoami":{"get":{"summary":"Verify an OAuth access token issued by this site","operationId":"whoami","security":[{"factoryOAuth":["read"]}],"responses":{"200":{"description":"The authenticated client identity"},"401":{"description":"Missing or invalid bearer token"}}}},"/repo/{betId}/clone-token":{"post":{"summary":"Mint a 1-hour read token to git-clone a killed bet's repo","operationId":"mintCloneToken","parameters":[{"name":"betId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Clone command with embedded token"},"404":{"description":"No repo recorded"},"429":{"description":"Daily cap reached"}}}},"/oauth/register":{"post":{"summary":"Dynamic client registration (RFC 7591), open to agents","operationId":"registerClient","responses":{"201":{"description":"client_id and client_secret"},"429":{"description":"Daily registration cap reached"}}}},"/oauth/token":{"post":{"summary":"Token endpoint — client_credentials only","operationId":"token","responses":{"200":{"description":"Bearer access token (ES256 JWT)"},"401":{"description":"invalid_client"}}}}},"components":{"schemas":{"BetSnapshot":{"type":"object","description":"Registry projection of a bet: status, wallet, gates, repo pointers.","properties":{"id":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["proposed","funded","building","judging","killed","graduated"]},"budgetMicros":{"type":"integer"},"spentMicros":{"type":"integer"},"epitaph":{"type":["string","null"]}}}},"securitySchemes":{"factoryOAuth":{"type":"oauth2","description":"Open dynamic registration at /oauth/register; see /auth.md.","flows":{"clientCredentials":{"tokenUrl":"https://hellomatthew.dev/oauth/token","scopes":{"read":"Read the factory (everything read is also public without a token)"}}}}}}}