API documentation
AI-acquired data over a simple REST API. Base URL: https://api.happy237.com
Authentication
Every /v1 request needs your API key, in either header:
Authorization: Bearer sk_YOUR_API_KEY X-API-Key: sk_YOUR_API_KEY
Keys are sk_ + 64 hex chars. Manage yours on the dashboard (reveal, copy, regenerate).
/v1/fp/profile
A profile's full stats. Cache-first and asynchronous: a cache hit returns 200 instantly; a cold miss returns 202, queues a fresh fetch, and you
retry in ~30s.
curl "https://api.happy237.com/v1/fp/profile?url=<source profile URL>" \ -H "Authorization: Bearer sk_YOUR_API_KEY"
Query params
| url | required | the target profile's public URL |
| fresh | optional | true → bypass cache, always scrape (202) |
| cache_only | optional | true → never scrape; 404 if not cached |
Responses
200 { "data": { …stats… }, "cached": true, "age_seconds": 137 }
202 { "status": "queued", "retry_after_seconds": 30 } ← retry shortly/v1/fp/chart
A single chart for a profile. Charts are free — they're cached as
byproducts of the profile fetch that already billed them. A miss queues a fresh
fetch (charged normally) and returns 202.
curl "https://api.happy237.com/v1/fp/chart?type=1&url=<source profile URL>" \ -H "Authorization: Bearer sk_YOUR_API_KEY"
Chart types (type)
| Group | type | Chart |
|---|---|---|
| main | 1 | Growth |
| main | 2 | Balance |
| main | 13 | Profit |
| main | 15 | Drawdown (%) |
| main | 17 | Margin |
| advanced | 11 | Hourly |
| advanced | 12 | Daily |
| advanced | 14 | Trade duration |
| advanced | 16 | MAE / MFE |
| yearly | 3 | Per-year — also needs year + month_type (0 change, 1 profit) |
Yearly example
curl "https://api.happy237.com/v1/fp/chart?type=3&year=2024&month_type=1&url=…" \ -H "Authorization: Bearer sk_YOUR_API_KEY"
Also supports fresh / cache_only. A chart the account doesn't publish
returns { "data": null, "reason": "not_published" }.
Billing & usage
/v1/billing— balance, plan, prices, recent payments/v1/billing/topup— body { "amount_usd": 25 } → NOWPayments invoice URL/v1/usage— month-to-date consumptionManage balance and top up on the dashboard.
Caching & pricing
| Action | Charge |
|---|---|
Fresh scrape (cold miss / fresh=true) | full scrape price |
| Strategy served from cache | reduced cache-hit price (½ scrape) |
| Chart served from cache | free |
A scrape fetches the strategy and all its charts in one shot and bills it once, so reading those charts back costs nothing. Charges deduct from your prepaid balance; if it hits $0 the account is suspended until you top up.
Error codes
Errors share one shape: { "message": "...", "code": "STABLE_CODE" }.
| 401 UNAUTHORIZED | Missing or invalid API key |
| 402 PAYMENT_REQUIRED | Account suspended — top up to resume |
| 403 FORBIDDEN | Key lacks the required scope |
| 404 NOT_FOUND | cache_only and not cached |
| 429 RATE_LIMITED / BUDGET_EXCEEDED | Slow down / over the monthly cap |
| 503 UNAVAILABLE | Scraping temporarily disabled |