{"openapi":"3.1.0","info":{"title":"Infrence API","description":"Deep Research API + dashboard for Infrence.","license":{"name":"MIT OR Apache-2.0","identifier":"MIT OR Apache-2.0"},"version":"0.1.0"},"paths":{"/api/admin/jobs":{"get":{"tags":["admin"],"operationId":"list_jobs","parameters":[{"name":"user_email","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"status","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}}],"responses":{"200":{"description":"Jobs page","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminJobRow"}}}}},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/jobs/{id}":{"get":{"tags":["admin"],"operationId":"job_detail","parameters":[{"name":"id","in":"path","description":"Job id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Job detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminJobDetail"}}}},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"},"404":{"description":"Not found"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/jobs/{id}/refund":{"post":{"tags":["admin"],"operationId":"refund_job","parameters":[{"name":"id","in":"path","description":"Job id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundBody"}}},"required":true},"responses":{"200":{"description":"Refund applied"},"400":{"description":"Invalid amount"},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"},"404":{"description":"Job not found"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/stats":{"get":{"tags":["admin"],"operationId":"stats","responses":{"200":{"description":"Admin overview stats","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminStatsDto"}}}},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/stripe-events":{"get":{"tags":["admin"],"operationId":"list_events","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}}],"responses":{"200":{"description":"Stripe events page","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminStripeEventRow"}}}}},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/stripe-events/{id}/replay":{"post":{"tags":["admin"],"operationId":"replay_event","parameters":[{"name":"id","in":"path","description":"Stripe event id (evt_…)","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Event replayed"},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"},"404":{"description":"Event not found or has no stored body"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/tickets":{"get":{"tags":["admin"],"operationId":"list_tickets","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"category","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}}],"responses":{"200":{"description":"Tickets page","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminTicketRow"}}}}},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/tickets/{id}":{"get":{"tags":["admin"],"operationId":"ticket_detail","parameters":[{"name":"id","in":"path","description":"Ticket id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Ticket detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminTicketDetail"}}}},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"},"404":{"description":"Not found"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/tickets/{id}/close":{"post":{"tags":["admin"],"operationId":"close_ticket","parameters":[{"name":"id","in":"path","description":"Ticket id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Ticket closed"},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"},"404":{"description":"Not found"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/tickets/{id}/reopen":{"post":{"tags":["admin"],"operationId":"reopen_ticket","parameters":[{"name":"id","in":"path","description":"Ticket id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Ticket reopened"},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"},"404":{"description":"Not found"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/tickets/{id}/reply":{"post":{"tags":["admin"],"operationId":"reply_ticket","parameters":[{"name":"id","in":"path","description":"Ticket id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplyBody"}}},"required":true},"responses":{"200":{"description":"Reply created"},"400":{"description":"Empty body"},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"},"404":{"description":"Ticket not found"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/users":{"get":{"tags":["admin"],"operationId":"list_users","parameters":[{"name":"q","in":"query","description":"Substring match against email or full UUID equality.","required":false,"schema":{"type":["string","null"]}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}}],"responses":{"200":{"description":"Users page","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserRow"}}}}},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/users/{id}":{"get":{"tags":["admin"],"operationId":"user_detail","parameters":[{"name":"id","in":"path","description":"User id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"User detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserDetail"}}}},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"},"404":{"description":"Not found"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/users/{id}/credits":{"post":{"tags":["admin"],"operationId":"adjust_credits","parameters":[{"name":"id","in":"path","description":"User id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditAdjustBody"}}},"required":true},"responses":{"200":{"description":"New balance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditAdjustResponse"}}}},"400":{"description":"Invalid delta"},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"},"404":{"description":"Not found"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/users/{id}/jobs":{"get":{"tags":["admin"],"operationId":"user_jobs","parameters":[{"name":"id","in":"path","description":"User id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}}],"responses":{"200":{"description":"Research jobs","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserJobRow"}}}}},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/users/{id}/ledger":{"get":{"tags":["admin"],"operationId":"user_ledger","parameters":[{"name":"id","in":"path","description":"User id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}}],"responses":{"200":{"description":"Ledger rows","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminLedgerRow"}}}}},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/users/{id}/suspend":{"post":{"tags":["admin"],"operationId":"suspend","parameters":[{"name":"id","in":"path","description":"User id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"User suspended"},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"},"404":{"description":"Not found"}},"security":[{"bearer_jwt":[]}]}},"/api/admin/users/{id}/unsuspend":{"post":{"tags":["admin"],"operationId":"unsuspend","parameters":[{"name":"id","in":"path","description":"User id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"User unsuspended"},"401":{"description":"Not authenticated"},"403":{"description":"Not an admin"},"404":{"description":"Not found"}},"security":[{"bearer_jwt":[]}]}},"/api/auth/forgot-password":{"post":{"tags":["auth"],"operationId":"forgot_password","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgotBody"}}},"required":true},"responses":{"200":{"description":"If the email exists, a reset link has been sent"}}}},"/api/auth/login":{"post":{"tags":["auth"],"operationId":"login","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginBody"}}},"required":true},"responses":{"200":{"description":"Logged in","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"Invalid credentials"}}}},"/api/auth/logout":{"post":{"tags":["auth"],"operationId":"logout","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshBody"}}},"required":true},"responses":{"200":{"description":"Logged out"}}}},"/api/auth/me":{"get":{"tags":["auth"],"operationId":"me","responses":{"200":{"description":"Current user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserDto"}}}},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/api/auth/refresh":{"post":{"tags":["auth"],"operationId":"refresh","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshBody"}}},"required":true},"responses":{"200":{"description":"Refreshed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"401":{"description":"Invalid or expired refresh token"}}}},"/api/auth/reset-password":{"post":{"tags":["auth"],"operationId":"reset_password","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetBody"}}},"required":true},"responses":{"200":{"description":"Password reset"},"400":{"description":"Invalid or expired token"}}}},"/api/auth/signup":{"post":{"tags":["auth"],"operationId":"signup","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupBody"}}},"required":true},"responses":{"200":{"description":"User created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}},"400":{"description":"Invalid email or password"},"409":{"description":"Email already registered"}}}},"/api/auth/verify-email":{"get":{"tags":["auth"],"operationId":"verify_email","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"302":{"description":"Redirect to dashboard on success"},"400":{"description":"Invalid or expired token"}}}},"/api/billing/auto-topup":{"put":{"tags":["billing"],"operationId":"update_auto_topup","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoTopupBody"}}},"required":true},"responses":{"200":{"description":"Auto top-up updated"},"400":{"description":"Unknown pack"},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/api/billing/checkout":{"post":{"tags":["billing"],"operationId":"create_checkout","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutBody"}}},"required":true},"responses":{"200":{"description":"Stripe Checkout URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponse"}}}},"400":{"description":"Unknown pack"},"401":{"description":"Not authenticated"},"500":{"description":"Stripe not configured"}},"security":[{"bearer_jwt":[]}]}},"/api/billing/packs":{"get":{"tags":["billing"],"operationId":"list_packs","responses":{"200":{"description":"List credit packs","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PackDto"}}}}},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/api/billing/payment-history":{"get":{"tags":["billing"],"operationId":"payment_history","responses":{"200":{"description":"Payment history","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRow"}}}}},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/api/billing/plans":{"get":{"tags":["billing"],"operationId":"list_plans","responses":{"200":{"description":"List subscription plans","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlanDto"}}}}}}}},"/api/billing/portal":{"post":{"tags":["billing"],"operationId":"create_portal","responses":{"200":{"description":"Stripe Customer Portal URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponse"}}}},"400":{"description":"No Stripe customer yet"},"401":{"description":"Not authenticated"},"500":{"description":"Stripe not configured"}},"security":[{"bearer_jwt":[]}]}},"/api/credits/balance":{"get":{"tags":["credits"],"operationId":"balance","responses":{"200":{"description":"Credit balance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BalanceDto"}}}},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/api/dashboard/recent":{"get":{"tags":["dashboard"],"operationId":"recent","responses":{"200":{"description":"Recent jobs","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RecentJob"}}}}},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/api/dashboard/usage":{"get":{"tags":["dashboard"],"operationId":"usage","parameters":[{"name":"from","in":"query","required":false,"schema":{"type":["string","null"],"format":"date-time"}},{"name":"to","in":"query","required":false,"schema":{"type":["string","null"],"format":"date-time"}}],"responses":{"200":{"description":"Usage buckets","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UsageBucket"}}}}},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/api/keys":{"get":{"tags":["api-keys"],"operationId":"list","responses":{"200":{"description":"List API keys","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyDto"}}}}},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]},"post":{"tags":["api-keys"],"operationId":"create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBody"}}},"required":true},"responses":{"200":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedKey"}}}},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/api/keys/{id}":{"delete":{"tags":["api-keys"],"operationId":"revoke","parameters":[{"name":"id","in":"path","description":"API key id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Revoked"},"401":{"description":"Not authenticated"},"404":{"description":"Not found"}},"security":[{"bearer_jwt":[]}]}},"/api/keys/{id}/reset":{"post":{"tags":["api-keys"],"operationId":"reset","parameters":[{"name":"id","in":"path","description":"API key id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Reset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedKey"}}}},"401":{"description":"Not authenticated"},"404":{"description":"Not found"}},"security":[{"bearer_jwt":[]}]}},"/api/logs":{"get":{"tags":["logs"],"operationId":"list","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"anonymize","in":"query","required":false,"schema":{"type":["boolean","null"]}}],"responses":{"200":{"description":"Activity log rows","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LogRow"}}}}},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/api/playground/research":{"post":{"tags":["playground"],"operationId":"run","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchRequest"}}},"required":true},"responses":{"200":{"description":"Sync result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchResult"}}}},"202":{"description":"Async accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AsyncAccepted"}}}},"400":{"description":"Bad request"},"401":{"description":"Unauthorized"},"402":{"description":"Insufficient credits"}},"security":[{"bearer_jwt":[]}]}},"/api/playground/research/{id}":{"get":{"tags":["playground"],"operationId":"get_status","parameters":[{"name":"id","in":"path","description":"Research job id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Job status / result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchResult"}}}},"401":{"description":"Unauthorized"},"404":{"description":"Not found"}},"security":[{"bearer_jwt":[]}]}},"/api/settings/marketing":{"put":{"tags":["settings"],"operationId":"set_marketing","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketingBody"}}},"required":true},"responses":{"200":{"description":"Marketing preference updated"},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/api/settings/password":{"put":{"tags":["settings"],"operationId":"change_password","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordBody"}}},"required":true},"responses":{"200":{"description":"Password changed"},"400":{"description":"Password too short or no password set"},"401":{"description":"Current password incorrect"}},"security":[{"bearer_jwt":[]}]}},"/api/settings/profile":{"put":{"tags":["settings"],"operationId":"update_profile","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileBody"}}},"required":true},"responses":{"200":{"description":"Profile updated"},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/api/support":{"post":{"tags":["support"],"operationId":"submit","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketBody"}}},"required":true},"responses":{"200":{"description":"Ticket submitted"},"400":{"description":"Invalid category or empty fields"},"401":{"description":"Not authenticated"}},"security":[{"bearer_jwt":[]}]}},"/v1/credits":{"get":{"tags":["credits"],"summary":"Get public API credit balance","description":"Returns the remaining credit balance for the API key caller.","operationId":"api_balance","responses":{"200":{"description":"Credit balance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BalanceDto"}}}},"401":{"description":"Invalid API key"}},"security":[{"bearer_api_key":[]}]}},"/v1/research":{"get":{"tags":["research"],"summary":"List research jobs","description":"Returns a paginated list of recent research jobs for the API key caller.","operationId":"list_jobs","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64"}}],"responses":{"200":{"description":"List of research jobs","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ResearchLogRow"}}}}},"401":{"description":"Invalid API key"}},"security":[{"bearer_api_key":[]}]},"post":{"tags":["research"],"summary":"Run a deep research job","description":"Starts a cited deep research job. Short jobs can return a synchronous result; longer jobs or requests with async/webhook options return an accepted job for polling or streaming.","operationId":"run_research","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchRequest"}}},"required":true},"responses":{"200":{"description":"Sync result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchResult"}}}},"202":{"description":"Async accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AsyncAccepted"}}}},"400":{"description":"Bad request"},"401":{"description":"Invalid API key"},"402":{"description":"Insufficient credits"}},"security":[{"bearer_api_key":[]}]}},"/v1/research/{id}":{"get":{"tags":["research"],"summary":"Get a research job result","description":"Returns status, brief, typed output, sources, cost, latency, and error details for one research job owned by the API key caller.","operationId":"get_status","parameters":[{"name":"id","in":"path","description":"Research job id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Job status / result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchResult"}}}},"401":{"description":"Invalid API key"},"404":{"description":"Not found"}},"security":[{"bearer_api_key":[]}]},"delete":{"tags":["research"],"summary":"Cancel a research job","description":"Cancels a pending or running research job and refunds the unused reservation when applicable. Terminal jobs are returned unchanged.","operationId":"cancel","parameters":[{"name":"id","in":"path","description":"Research job id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Canceled (or terminal state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchResult"}}}},"401":{"description":"Invalid API key"},"404":{"description":"Not found"}},"security":[{"bearer_api_key":[]}]}}},"components":{"schemas":{"AdminJobBucket":{"type":"object","required":["day","count","credits_charged_sum","cost_usd_micros_sum"],"properties":{"cost_usd_micros_sum":{"type":"integer","format":"int64"},"count":{"type":"integer","format":"int64"},"credits_charged_sum":{"type":"integer","format":"int64"},"day":{"type":"string","format":"date-time"}}},"AdminJobDetail":{"type":"object","required":["id","user_id","user_email","created_at","status","question","credits_reserved","credits_charged","cost_usd_micros","request","response"],"properties":{"completed_at":{"type":["string","null"],"format":"date-time"},"cost_usd_micros":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"credits_charged":{"type":"integer","format":"int64"},"credits_reserved":{"type":"integer","format":"int64"},"error":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"latency_ms":{"type":["integer","null"],"format":"int32"},"question":{"type":"string"},"request":{"type":"object","description":"Raw request body that was POSTed to `/v1/research`."},"response":{"type":"object","description":"Raw final response (typed payload + brief + sources). May be null\nfor pending or failed jobs."},"source_count":{"type":["integer","null"],"format":"int32"},"status":{"type":"string"},"user_email":{"type":"string"},"user_id":{"type":"string","format":"uuid"},"wave_count":{"type":["integer","null"],"format":"int32"}}},"AdminJobRow":{"type":"object","required":["id","user_id","user_email","created_at","status","question","credits_charged","cost_usd_micros"],"properties":{"cost_usd_micros":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"credits_charged":{"type":"integer","format":"int64"},"id":{"type":"string","format":"uuid"},"latency_ms":{"type":["integer","null"],"format":"int32"},"question":{"type":"string"},"status":{"type":"string"},"user_email":{"type":"string"},"user_id":{"type":"string","format":"uuid"}}},"AdminLedgerRow":{"type":"object","required":["id","created_at","kind","delta","balance_after"],"properties":{"balance_after":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"delta":{"type":"integer","format":"int64"},"id":{"type":"string","format":"uuid"},"idempotency_key":{"type":["string","null"]},"kind":{"type":"string"},"note":{"type":["string","null"]},"related_id":{"type":["string","null"]}}},"AdminSignupBucket":{"type":"object","required":["day","count"],"properties":{"count":{"type":"integer","format":"int64"},"day":{"type":"string","format":"date-time"}}},"AdminStatsDto":{"type":"object","required":["signups_last_30d","jobs_last_30d","topup_revenue_last_30d_cents","total_users","suspended_users","open_tickets","in_flight_jobs","ledger_balance_outstanding"],"properties":{"in_flight_jobs":{"type":"integer","format":"int64"},"jobs_last_30d":{"type":"array","items":{"$ref":"#/components/schemas/AdminJobBucket"}},"ledger_balance_outstanding":{"type":"integer","format":"int64"},"open_tickets":{"type":"integer","format":"int64"},"signups_last_30d":{"type":"array","items":{"$ref":"#/components/schemas/AdminSignupBucket"}},"suspended_users":{"type":"integer","format":"int64"},"topup_revenue_last_30d_cents":{"type":"integer","format":"int64"},"total_users":{"type":"integer","format":"int64"}}},"AdminStripeEventRow":{"type":"object","required":["id","event_type","received_at","has_body"],"properties":{"event_type":{"type":"string"},"has_body":{"type":"boolean"},"id":{"type":"string"},"received_at":{"type":"string","format":"date-time"}}},"AdminTicketDetail":{"type":"object","required":["id","email","category","subject","body","status","created_at","replies"],"properties":{"assigned_admin_id":{"type":["string","null"],"format":"uuid"},"body":{"type":"string"},"category":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"email":{"type":"string"},"id":{"type":"string","format":"uuid"},"replies":{"type":"array","items":{"$ref":"#/components/schemas/AdminTicketReply"}},"status":{"type":"string"},"subject":{"type":"string"},"user_id":{"type":["string","null"],"format":"uuid"}}},"AdminTicketReply":{"type":"object","required":["id","body","sent_email","created_at"],"properties":{"admin_id":{"type":["string","null"],"format":"uuid"},"body":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"sent_email":{"type":"boolean"}}},"AdminTicketRow":{"type":"object","required":["id","email","category","subject","status","created_at","reply_count"],"properties":{"category":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"email":{"type":"string"},"id":{"type":"string","format":"uuid"},"reply_count":{"type":"integer","format":"int64"},"status":{"type":"string"},"subject":{"type":"string"},"user_id":{"type":["string","null"],"format":"uuid"}}},"AdminUserDetail":{"type":"object","required":["id","email","first_name","last_name","email_verified","marketing_emails_enabled","is_admin","created_at","credits","jobs_count","open_tickets"],"properties":{"created_at":{"type":"string","format":"date-time"},"credits":{"type":"integer","format":"int64"},"email":{"type":"string"},"email_verified":{"type":"boolean"},"first_name":{"type":"string"},"id":{"type":"string","format":"uuid"},"is_admin":{"type":"boolean"},"jobs_count":{"type":"integer","format":"int64"},"last_name":{"type":"string"},"marketing_emails_enabled":{"type":"boolean"},"open_tickets":{"type":"integer","format":"int64"},"stripe_customer_id":{"type":["string","null"]},"suspended_at":{"type":["string","null"],"format":"date-time"}}},"AdminUserJobRow":{"type":"object","required":["id","created_at","status","question","credits_charged","cost_usd_micros"],"properties":{"cost_usd_micros":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"credits_charged":{"type":"integer","format":"int64"},"id":{"type":"string","format":"uuid"},"latency_ms":{"type":["integer","null"],"format":"int32"},"question":{"type":"string"},"status":{"type":"string"}}},"AdminUserRow":{"type":"object","required":["id","email","first_name","last_name","is_admin","created_at","credits"],"properties":{"created_at":{"type":"string","format":"date-time"},"credits":{"type":"integer","format":"int64"},"email":{"type":"string"},"first_name":{"type":"string"},"id":{"type":"string","format":"uuid"},"is_admin":{"type":"boolean"},"last_name":{"type":"string"},"suspended_at":{"type":["string","null"],"format":"date-time"}}},"ApiKeyDto":{"type":"object","required":["id","name","prefix","created_at"],"properties":{"created_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"last_used_at":{"type":["string","null"],"format":"date-time"},"name":{"type":"string"},"prefix":{"type":"string"}}},"AsyncAccepted":{"type":"object","required":["id","status","status_url","events_url"],"properties":{"events_url":{"type":"string"},"id":{"type":"string","format":"uuid"},"status":{"type":"string"},"status_url":{"type":"string"}}},"AuthResponse":{"type":"object","required":["access_token","refresh_token","user"],"properties":{"access_token":{"type":"string"},"refresh_token":{"type":"string"},"user":{"$ref":"#/components/schemas/UserDto"}}},"AutoTopupBody":{"type":"object","required":["enabled","threshold_credits","pack_id"],"properties":{"enabled":{"type":"boolean"},"pack_id":{"type":"string"},"threshold_credits":{"type":"integer","format":"int64"}}},"BalanceDto":{"type":"object","required":["credits","usd"],"properties":{"credits":{"type":"integer","format":"int64"},"usd":{"type":"string"}}},"CheckoutBody":{"type":"object","required":["pack_id"],"properties":{"pack_id":{"type":"string"}}},"CheckoutResponse":{"type":"object","required":["url"],"properties":{"url":{"type":"string"}}},"CreateBody":{"type":"object","properties":{"name":{"type":["string","null"]}}},"CreatedKey":{"allOf":[{"$ref":"#/components/schemas/ApiKeyDto"},{"type":"object","required":["plaintext"],"properties":{"plaintext":{"type":"string","description":"One-time plaintext shown immediately after create/reset; never\nreturned again."}}}]},"CreditAdjustBody":{"type":"object","required":["delta_credits","note"],"properties":{"delta_credits":{"type":"integer","format":"int64"},"idempotency_key":{"type":["string","null"],"description":"Optional client-supplied idempotency key (e.g. `crypto.randomUUID()`)\nto make resubmits safe."},"note":{"type":"string"}}},"CreditAdjustResponse":{"type":"object","required":["balance_after"],"properties":{"balance_after":{"type":"integer","format":"int64"}}},"ForgotBody":{"type":"object","required":["email"],"properties":{"email":{"type":"string"}}},"LogRow":{"type":"object","required":["id","created_at","status","question","credits_charged","cost_usd_micros"],"properties":{"cost_usd_micros":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"credits_charged":{"type":"integer","format":"int64"},"id":{"type":"string","format":"uuid"},"latency_ms":{"type":["integer","null"],"format":"int32"},"mode":{"type":["string","null"]},"question":{"type":"string"},"source_count":{"type":["integer","null"],"format":"int32"},"status":{"type":"string"},"wave_count":{"type":["integer","null"],"format":"int32"}}},"LoginBody":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string"},"password":{"type":"string"}}},"MarketingBody":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"}}},"OpPrice":{"type":"object","required":["op","credits","note"],"properties":{"credits":{"type":"number","format":"double"},"note":{"type":"string"},"op":{"type":"string"}}},"Pack":{"type":"object","required":["id","name","credits","price_cents","stripe_price_env","blurb"],"properties":{"blurb":{"type":"string"},"credits":{"type":"integer","format":"int64"},"id":{"type":"string"},"name":{"type":"string"},"price_cents":{"type":"integer","format":"int64"},"stripe_price_env":{"type":"string"}}},"PackDto":{"type":"object","required":["id","name","credits","price_cents","blurb"],"properties":{"blurb":{"type":"string"},"credits":{"type":"integer","format":"int64"},"id":{"type":"string"},"name":{"type":"string"},"price_cents":{"type":"integer","format":"int64"}}},"PasswordBody":{"type":"object","required":["current_password","new_password"],"properties":{"current_password":{"type":"string"},"new_password":{"type":"string"}}},"PaymentRow":{"type":"object","required":["id","created_at","status","pack_credits","pack_amount_cents"],"properties":{"completed_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"pack_amount_cents":{"type":"integer","format":"int64"},"pack_credits":{"type":"integer","format":"int64"},"status":{"type":"string"}}},"Plan":{"type":"object","required":["id","name","monthly_price_cents","included_credits","overage_micros","blurb","stripe_price_env","features"],"properties":{"blurb":{"type":"string"},"features":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"included_credits":{"type":"integer","format":"int64"},"monthly_price_cents":{"type":"integer","format":"int64"},"name":{"type":"string"},"overage_micros":{"type":"integer","format":"int64","description":"Per-credit overage rate in micro-USD. Charged via Stripe metered\nusage at month-end."},"stripe_price_env":{"type":"string"}}},"PlanDto":{"type":"object","required":["id","name","monthly_price_cents","included_credits","overage_micros","breakeven_credits","blurb","features"],"properties":{"blurb":{"type":"string"},"breakeven_credits":{"type":"integer","format":"int64","description":"Monthly credit usage above which this plan saves money over PAYG.\nDrives the dashboard \"Save with a plan\" hint."},"features":{"type":"array","items":{"type":"string"}},"id":{"type":"string"},"included_credits":{"type":"integer","format":"int64"},"monthly_price_cents":{"type":"integer","format":"int64"},"name":{"type":"string"},"overage_micros":{"type":"integer","format":"int64"}}},"ProfileBody":{"type":"object","required":["first_name","last_name"],"properties":{"first_name":{"type":"string"},"last_name":{"type":"string"}}},"RecentJob":{"type":"object","required":["id","created_at","status","question","credits_charged"],"properties":{"created_at":{"type":"string","format":"date-time"},"credits_charged":{"type":"integer","format":"int64"},"id":{"type":"string","format":"uuid"},"latency_ms":{"type":["integer","null"],"format":"int32"},"question":{"type":"string"},"status":{"type":"string"}}},"RefreshBody":{"type":"object","required":["refresh_token"],"properties":{"refresh_token":{"type":"string"}}},"RefundBody":{"type":"object","required":["credits","note"],"properties":{"credits":{"type":"integer","format":"int64"},"note":{"type":"string"}}},"ReplyBody":{"type":"object","required":["body","send_email"],"properties":{"body":{"type":"string"},"send_email":{"type":"boolean"}}},"ResearchBudgets":{"type":"object","required":["max_cost_usd","max_wallclock_secs","max_waves","branches","max_searches","max_pages","synthesis_time_reserve_secs","synthesis_cost_reserve_usd"],"properties":{"branches":{"type":"integer","format":"int32","minimum":0},"max_cost_usd":{"type":"number","format":"double"},"max_pages":{"type":"integer","format":"int32","minimum":0},"max_searches":{"type":"integer","format":"int32","minimum":0},"max_wallclock_secs":{"type":"integer","format":"int64","minimum":0},"max_waves":{"type":"integer","format":"int32","minimum":0},"synthesis_cost_reserve_usd":{"type":"number","format":"double","description":"Headroom (USD) the wave fan-out gates leave for the synthesise+\ncritic stage. Must be sized to the worst-case cost of the\nsynthesise stage, otherwise the gate stops fan-out at the right\ntime but synthesis still spikes COGS."},"synthesis_time_reserve_secs":{"type":"integer","format":"int64","description":"Headroom (seconds) the wave fan-out gates leave for the\nsynthesise+critic stage. Must be sized to the worst-case duration\nof the synthesise stage, otherwise the pipeline hits the hard\n`max_wallclock_secs` deadline mid-synth and fails.","minimum":0}}},"ResearchLogRow":{"type":"object","required":["id","created_at","status","question","credits_charged","cost_usd_micros"],"properties":{"completed_at":{"type":["string","null"],"format":"date-time"},"cost_usd_micros":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"credits_charged":{"type":"integer","format":"int64"},"id":{"type":"string","format":"uuid"},"latency_ms":{"type":["integer","null"],"format":"int32"},"question":{"type":"string"},"source_count":{"type":["integer","null"],"format":"int32"},"status":{"type":"string"},"wave_count":{"type":["integer","null"],"format":"int32"}}},"ResearchMode":{"type":"string","enum":["lite","standard","pro","max"]},"ResearchRequest":{"type":"object","required":["question"],"properties":{"async":{"type":"boolean","description":"Force async mode regardless of budget. Default: auto-detected."},"include_sources":{"type":"boolean","description":"Include per-source `summary` fields in the response. Default true."},"max_credits":{"type":["integer","null"],"format":"int64","description":"Hard credit cap. Required for `max` mode. For fixed-price modes\nthis is informational; the call is rejected if your balance is\nbelow the mode's fixed price."},"max_wallclock_secs":{"type":["integer","null"],"format":"int64","description":"Override the wall-clock cap for the chosen mode. Optional.","minimum":0},"mode":{"$ref":"#/components/schemas/ResearchMode","description":"Mode picks the budget envelope and the credit price.\n`lite` (15c) | `standard` (60c) | `pro` (200c) | `max` (metered).\nDefaults to `standard`."},"question":{"type":"string"},"response_schema":{"type":"object","description":"Optional JSON Schema. When supplied, the brief is re-cast into\na typed object that conforms to the schema."},"webhook_url":{"type":["string","null"],"description":"If set, the final response will be POSTed to this URL with an\n`X-Infrence-Signature: sha256=…` HMAC header."}}},"ResearchResult":{"type":"object","required":["id","status","question","typed","sources","credits_charged","cost_usd","created_at"],"properties":{"brief":{"type":["string","null"]},"completed_at":{"type":["string","null"],"format":"date-time"},"cost_usd":{"type":"number","format":"double"},"created_at":{"type":"string","format":"date-time"},"credits_charged":{"type":"integer","format":"int64"},"error":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"latency_ms":{"type":["integer","null"],"format":"int64"},"question":{"type":"string"},"sources":{"type":"array","items":{"$ref":"#/components/schemas/SourceDto"}},"status":{"type":"string"},"typed":{"type":"object"},"wave_count":{"type":["integer","null"],"format":"int32","minimum":0}}},"ResetBody":{"type":"object","required":["token","password"],"properties":{"password":{"type":"string"},"token":{"type":"string"}}},"SignupBody":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string"},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"password":{"type":"string"}}},"SourceDto":{"type":"object","required":["url","title","domain"],"properties":{"domain":{"type":"string"},"summary":{"type":["string","null"],"description":"Per-source summary; populated when `include_sources=true`."},"title":{"type":"string"},"url":{"type":"string"}}},"TicketBody":{"type":"object","required":["category","subject","body"],"properties":{"body":{"type":"string"},"category":{"type":"string"},"subject":{"type":"string"}}},"UsageBucket":{"type":"object","required":["day","credits","jobs","cost_usd_micros"],"properties":{"cost_usd_micros":{"type":"integer","format":"int64"},"credits":{"type":"integer","format":"int64"},"day":{"type":"string","format":"date-time"},"jobs":{"type":"integer","format":"int64"}}},"UserDto":{"type":"object","required":["id","email","first_name","last_name","email_verified","marketing_emails_enabled","is_admin"],"properties":{"email":{"type":"string"},"email_verified":{"type":"boolean"},"first_name":{"type":"string"},"id":{"type":"string","format":"uuid"},"is_admin":{"type":"boolean"},"last_name":{"type":"string"},"marketing_emails_enabled":{"type":"boolean"}}}},"securitySchemes":{"bearer_api_key":{"type":"http","scheme":"bearer","bearerFormat":"API Key"},"bearer_jwt":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"tags":[{"name":"auth","description":"Email + password authentication and session management."},{"name":"api-keys","description":"Create, list, revoke, and reset Infrence API keys."},{"name":"credits","description":"Read-only credit balance for dashboard and public API."},{"name":"dashboard","description":"Usage charts and recent-jobs sidebar for the SPA."},{"name":"logs","description":"Activity log rows for the dashboard /logs page."},{"name":"settings","description":"Profile, password, and marketing preferences."},{"name":"support","description":"Support and billing-issue ticket submission."},{"name":"billing","description":"Stripe Checkout, Customer Portal, packs, and payment history."},{"name":"research","description":"Public deep-research API (`/v1/research`)."},{"name":"playground","description":"Dashboard playground — JWT-authenticated proxy for research runs."},{"name":"admin","description":"Admin operator surface — gated by `users.is_admin`."}]}