← Back to app
PTS Wizard · Developer reference

Analysis API

Programmatic access to the same Smart-Money / PTS chart-analysis engine that powers the PTS Wizard app. Send a chart image, receive a structured trade setup (direction, entry, stop, targets, conviction) as clean JSON.

Every signal is also recorded to our verified ledger and graded against live market data — so you can look up the real outcome of any setup we returned.

1. Base URL

https://xmajcsacxnqnkcjxnljp.supabase.co/functions/v1

2. Authentication

Every request must carry your API key (prefix juice_live_). Use either header:

Authorization: Bearer juice_live_xxxxxxxxxxxxxxxxxxxx
x-api-key: juice_live_xxxxxxxxxxxxxxxxxxxx

Keys are issued by us per account. Treat a key like a password — it grants billable access. If a key leaks, tell us and we revoke it immediately. A revoked key returns 401 on the next call.

3. Analyze a chart

POST /v1-analyze — two ways to call it:

Mode A — send your own chart: include a base64 image.
Mode B — symbol only (we fetch the chart): omit image and send symbol + style; our servers capture a dark-theme TradingView chart (scalp → 15m, swing → 4h) and analyze it. Nothing for you to render or maintain.

Request body (JSON)

FieldTypeRequiredNotes
imagestringmode ABase64 of the chart. Bare base64 or a full data:image/png;base64,… URL both work. Omit to use mode B.
symbolstringmode BTradingView format passes through verbatim (BINANCE:BTCUSDT); bare symbols (BTCUSDT, BTCUSD) default to Binance. Optional in mode A (enables live-price context + tracking).
stylestringmode Bscalp (15m chart) or swing (4h chart).
timeframestringnoe.g. 15m, 1h, 4h, 1D. In mode B this overrides style's default chart timeframe.
mediaTypestringnoMode A only: e.g. image/png, image/jpeg. Inferred from a data-URL if omitted.
referencestringnoYour own id/label (≤64 chars), echoed back on the ledger row.

Mode B example

curl -X POST https://xmajcsacxnqnkcjxnljp.supabase.co/functions/v1/v1-analyze \
  -H "x-api-key: juice_live_xxxxxxxxxxxxxxxxxxxx" \
  -H "content-type: application/json" \
  -d '{"symbol":"BINANCE:BTCUSDT","style":"scalp","reference":"user-123"}'

Mode-B specific errors: 422 unknown_symbol (no chart exists for that symbol), 502 chart_fetch_failed (transient capture failure — retry shortly; the call is not billed against your quota), 502 analysis_truncated (rare engine hiccup — retry; not billed).

About 422 no_setup: this is a real, honest answer — the methodology found no edge on the current chart (e.g. mid-range chop) and refuses to invent a trade. Treat it as a "no trade right now" verdict in your product, not as a failure.

Success — 200

{
  "id": "8b1c…",
  "signal": {
    "instrument": "BTCUSD",
    "timeframe": "4h",
    "bias": "bullish",
    "entry": 61250,
    "sl": 60100,
    "tp": 63400,
    "targets": [63400, 64900, 66200],
    "strength": 72,
    "patterns": ["bullish OB", "liquidity sweep"],
    "reasoning": "Swept Asian lows then reclaimed the 4h order block…"
  },
  "tracking": { "status": "waiting_entry", "symbol": "XBTUSD" },
  "usage": { "used": 143, "limit": 1000, "remaining": 857 }
}

signal is the structured setup. bias is bullish / bearish / neutral; strength is 0–100 conviction; targets is ordered nearest-first. Treat unknown fields as additive — ignore any you don't use.

id is the ledger id — pass it to the lookup endpoint (§4) to fetch the graded outcome later. tracking is null when a setup can't be auto-tracked (e.g. neutral bias, or a symbol we can't price); the analysis is still returned.

usage reflects your account's monthly quota after this call.

4. Look up a signal's outcome

GET /v1-analyze/{id} — where {id} is the id from an analyze response. Returns only signals belonging to your account.

Success — 200

{
  "signal": {
    "id": "8b1c…",
    "instrument": "BTCUSD", "symbol": "XBTUSD", "timeframe": "4h",
    "direction": "long", "entry": 61250, "sl": 60100,
    "targets": [63400, 64900, 66200], "strength": 72,
    "status": "open", "outcome": null, "result_r": null,
    "created_at": "2026-06-28T09:12:00Z", "closed_at": null
  }
}

status: waiting_entryopentp1_hittp4_hit → terminal (stopped / target_hit / expired), or untrackable.
outcome: win / loss / expired / null (still live).
result_r: realized reward-to-risk (R multiple) once closed.

5. Errors

All errors are JSON: { "error": "<code>", "detail"?: "…" }.

HTTPerrorMeaning
400missing_image / invalid_json_body / missing_signal_idBad request.
401unauthorizedMissing, malformed, invalid, or revoked key.
402quota_exceededMonthly quota used up (used/limit included).
403account_suspendedAccount disabled — contact us.
422no_setupThe chart yielded no structured setup. Not billed.
429rate_limitedToo many requests/min (limit, reset_at included). Not billed.
502upstream_errorModel error. Auto-refunded — not billed.
500internal_errorUnexpected — retry; alert us if it persists.

Only successful 200 analyses with a setup count against your monthly quota.