API documentation

AI-acquired data over a simple REST API. Base URL: https://api.happy237.com

Log in to see examples with your own API key, or sign up to get one.

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).

GET

/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

urlrequiredthe target profile's public URL
freshoptionaltrue → bypass cache, always scrape (202)
cache_onlyoptionaltrue → never scrape; 404 if not cached

Responses

200  { "data": { …stats… }, "cached": true, "age_seconds": 137 }
202  { "status": "queued", "retry_after_seconds": 30 }   ← retry shortly
GET

/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)
GrouptypeChart
main1Growth
main2Balance
main13Profit
main15Drawdown (%)
main17Margin
advanced11Hourly
advanced12Daily
advanced14Trade duration
advanced16MAE / MFE
yearly3Per-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

GET/v1/billing— balance, plan, prices, recent payments
POST/v1/billing/topup— body { "amount_usd": 25 } → NOWPayments invoice URL
GET/v1/usage— month-to-date consumption

Manage balance and top up on the dashboard.

Caching & pricing

ActionCharge
Fresh scrape (cold miss / fresh=true)full scrape price
Strategy served from cachereduced cache-hit price (½ scrape)
Chart served from cachefree

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 UNAUTHORIZEDMissing or invalid API key
402 PAYMENT_REQUIREDAccount suspended — top up to resume
403 FORBIDDENKey lacks the required scope
404 NOT_FOUNDcache_only and not cached
429 RATE_LIMITED / BUDGET_EXCEEDEDSlow down / over the monthly cap
503 UNAVAILABLEScraping temporarily disabled