Trader API

Trade your funded account by API.

A small, predictable REST API for quantitative traders and AI agents: request-for-quote pricing, idempotent orders, and equity and drawdown reads across Kalshi and Polymarket markets. Every API order runs the exact same rule chain as the app; nothing more is possible by API than in the app, and nothing less.

Get access in three steps

  1. Get a funded account

    API keys attach to funded accounts. Pick a tier on the funded page; it activates instantly.

  2. Create a key

    The rf_live_... key is shown exactly once; it binds to your funded account and never follows account switches.

    Create your API key
  3. Make your first call

    curl https://refractfunding.com/v1/risk -H "Authorization: Bearer rf_live_..."

The contract in five lines

  • Base URL. https://refractfunding.com/v1; the canonical machine-readable spec lives at /v1/openapi.json.
  • Auth. Authorization: Bearer rf_live_... on every request. Scopes: read (all GETs and quotes), trade (orders).
  • Accounts. A key covers all of your funded accounts. Every call takes an optional accountId (query on GET, body on POST); omit it to act on your default account, the lowest-numbered active seat.
  • Units. Money is integer micro-USD (*Micros, 1 USD = 1,000,000); prices are probabilities in [0,1]; timestamps are ISO 8601 UTC.
  • Rejects are data, not errors. A rejected order is HTTP 200 with status: "REJECTED" and a stable reason code. HTTP 4xx means the request itself was wrong: auth, validation, rate limit (429 with Retry-After).
  • No streaming. There is deliberately no order-book feed. POST /v1/quote is a dry run of the real execution path, so a quote already reflects live depth, fees, and slippage.

Rate limits per key, on 60 second windows: 300 reads/min, 300 quotes/min, 60 orders/min. Full field-level detail for every endpoint lives in the API reference.

Quickstart

Export your key as REFRACT_KEY and the whole loop is five requests:

# 1. Find a market (free-text search, relevance-ranked)
curl -s "https://refractfunding.com/v1/markets?q=bitcoin&venue=KALSHI&limit=5" \
  -H "Authorization: Bearer $REFRACT_KEY"

# 2. Check top-of-book and per-side buyability
curl -s "https://refractfunding.com/v1/markets/kalshi:KXBTCD-25AUG09-B116999.99" \
  -H "Authorization: Bearer $REFRACT_KEY"

# 3. Quote: a dry run of the exact execution path (fees, slippage, depth)
curl -s -X POST "https://refractfunding.com/v1/quote" \
  -H "Authorization: Bearer $REFRACT_KEY" -H "Content-Type: application/json" \
  -d '{"market":"kalshi:KXBTCD-25AUG09-B116999.99","outcome":"YES","side":"BUY","notionalMicros":100000000}'

# 4. Trade it. clientOrderId is required and idempotent; retry the SAME id on timeout.
curl -s -X POST "https://refractfunding.com/v1/orders" \
  -H "Authorization: Bearer $REFRACT_KEY" -H "Content-Type: application/json" \
  -d '{"market":"kalshi:KXBTCD-25AUG09-B116999.99","outcome":"YES","side":"BUY","notionalMicros":100000000,"clientOrderId":"bot-2026-08-09-0001"}'

# 5. Watch your drawdown headroom
curl -s "https://refractfunding.com/v1/risk" -H "Authorization: Bearer $REFRACT_KEY"

The same loop in Python:

import os, uuid, requests

BASE = "https://refractfunding.com/v1"
S = requests.Session()
S.headers["Authorization"] = f"Bearer {os.environ['REFRACT_KEY']}"

# Risk first: how much headroom is left above the drawdown floor?
risk = S.get(f"{BASE}/risk").json()
assert risk["status"] == "active", risk
print("headroom $", risk["headroomMicros"] / 1_000_000)

# Quote, then trade only if the quote fills cleanly
order = {
    "market": "polymarket:1234567890",  # YES token id, or an id from /v1/markets
    "outcome": "YES",
    "side": "BUY",
    "sizeShares": 100,
}
quote = S.post(f"{BASE}/quote", json=order).json()
if quote["status"] == "FILLED" and quote["slippageBps"] < 50:
    fill = S.post(f"{BASE}/orders", json={**order, "clientOrderId": str(uuid.uuid4())}).json()
    print(fill["status"], fill["filledShares"], "@", fill["vwap"])
else:
    print("passed:", quote["status"], quote.get("reason"))

Endpoints

For AI agents

Point an agent at /llms.txt for a one-fetch summary or /llms-full.txt for the full endpoint reference including a recommended trading loop. The OpenAPI document at /v1/openapi.json has stable operationIds for codegen.