API
Read your book from anywhere
A versioned REST API on personal tokens, with the same account rules as the web app.
Authentication
Create a token in Settings, Tokens and data, and pick its scopes. Tokens start with sg_live_, are shown once, are stored only as a SHA-256 hash, expire after 30, 90 or 365 days, and can be revoked at any time. You can hold up to 10 tokens.
curl -H "Authorization: Bearer $TOKEN" \ https://stockgaines.com/api/v1/portfolio
Endpoints
| Method | Path | Scope | Returns |
|---|---|---|---|
| GET | /api/v1/me | read:profile | You: tenant, plan and connected sources |
| GET | /api/v1/portfolio | read:portfolio | Accounts, positions and the book's KPIs |
| GET | /api/v1/risk | read:portfolio | The risk cockpit, book protection and the risk regime |
| GET | /api/v1/market/today | read:market | Market overview, gauge, regime quad and macro |
| GET | /api/v1/ideas/top10 | read:market | This week's top 10 with factor scores |
| GET | /api/v1/briefs/{date} | read:portfolio | Your daily brief for a date |
| POST | /api/v1/ask | ask | Ask the Terminal one question, billed to your own AI key |
Every figure carries its source and as-of date, as on the page. Research only, not personal investment advice.
Limits
60 read requests and 10 Ask requests a minute per token. Over the limit you get HTTP 429. An unknown, revoked or expired token gets 401, and a token without the endpoint's scope gets 403.
Machine-readable spec
OpenAPI 3.1.0 at https://stockgaines.com/api/v1/openapi.json.