Service
The safe-to-trade health check and the key-resolution endpoint.
Two small endpoints: one tells you whether it is safe to trade right now, the other confirms your key.
Health check
/healthNo authA safe-to-trade check, not a bare liveness ping. It answers whether the database is reachable, the price feed is live and fresh, and the server-side risk loop is running. It is the one endpoint that needs no key: the machine-readable spec is public too, but that is a document, not a call you make.
curl https://api.perpsfund.com/v1/health{ "ok": true, "status": "healthy", "feed": "live", "service": "perpsfund-bot-api", "version": "v1", "asOf": 1789000000000, "cacheSeconds": "…" }| HTTP | status | Meaning |
|---|---|---|
200 | healthy | ok: true. Safe to trade. |
503 | degraded | ok: false. Reachable, but the price feed or the risk loop is stale. Hold off, especially on latency-sensitive orders. |
503 | unavailable | ok: false. A required dependency is down, or its state cannot be determined. Do not trade. |
feed is live, stale or unknown (unknown means freshness could not be determined; never read it as live).
asOf is when the assessment was made, in milliseconds since the epoch, and cacheSeconds is how long that
assessment is reused (5 seconds).
A 503 here does not mean the API is down
Every not-safe state answers 503, so a client that treats /health as an up/down probe will read a stale price
feed as an outage. Read status. The assessment is cached for about 5 seconds
(cacheSeconds), so polling faster than that returns the same answer. A healthy result is platform-wide: a
single market can still have no price, which shows up as no_price on that market's reads and orders.
Check your key
/meAPI keyResolve the presented key to its owner and environment. Works with a sandbox or a live key.
curl https://api.perpsfund.com/v1/me \ -H "X-API-Key: pk_test_your_key_here"
{ "userId": "clx0abc123", "environment": "sandbox", "keyId": "clx0def456" }