# Getting Started

Place your first prediction market order in 5 minutes. All curl — no SDK required.

**All curl below runs against the real, live API.** You'll mint an anonymous sandbox key in Step 1 (30 seconds, no email). Sandbox tier caps orders at $10 each / $100 daily, so nothing you type can move real money. Orders run through the same validation and tier caps as production and then fill in a simulation: the key starts with 1,000 virtual USDT, and responses carry `is_simulated: true`.

## Step 1 — Mint a sandbox key

Public endpoint, no authentication. Rate-limited to 1 mint per IP + 1 per browser fingerprint per day.

```
curl -X POST https://api.predictasiax.com/v1/sandbox-keys \
  -H "Content-Type: application/json" \
  -d '{"org_name":"my-test"}'
```

Response — copy `sk` immediately, shown once:

```
{
  "data": {
    "sk":            "sk_live_7d40ce10_12b638913cadfbbd...",   // your bearer, shown ONCE
    "api_key_id":    "api_sbx_...",
    "builder_id":    "bld_sbx_...",
    "app_id":        "app_sbx_...",
    "tier":          "sandbox",
    "caps":          { "max_order_usdt": "10", "daily_notional_usdt": "100" },
    "expires_at_ms": 1789741484472,                            // 30 days out
    "sandbox_url":   "https://api.predictasiax.com",
    "docs_url":      "https://docs.predictasiax.com/getting-started",
    "upgrade_url":   "https://docs.predictasiax.com/request-access"
  },
  "meta": { "ts_ms": 1787149484561, "trace_id": "trc_..." }
}

# Save it:
export SK=sk_live_7d40ce10_12b638913cadfbbd...
```

If a sandbox key leaks, revoke it with the key itself: `curl -X DELETE https://api.predictasiax.com/v1/keys/self -H "Authorization: Bearer $SK"`.

The key belongs to a newly-minted anonymous builder tagged `tier=sandbox`, and expires 30 days from mint. It's an `sk_live_` prefix accepted on production — the tier flag hard-caps orders at $10 each and $100/day notional.

## Step 2 — List markets

Markets are the live markets on predictasiax.com. Pick one and keep its `id` for the next step (`MARKET_ID=...`):

```
curl "https://api.predictasiax.com/v1/markets?q=btc" \
  -H "Authorization: Bearer $SK"
```

Response (trimmed):

```
{
  "data": {
    "markets": [
      {
        "id":        "m_btc_150k_2026",
        "title":     "BTC > $150k by end of 2026",
        "category":  "crypto",
        "prices":    { "yes": "0.4200", "no": "0.5800" },
        "volume_usd":"12345.67",
        "status":    "open",
        "closes_at_ms": 1798700400000
      }
    ]
  }
}
```

## Step 3 — Place a $1 order

Buy 2 `yes` shares at $0.55 = $1.10 notional — well within sandbox $10 cap. `Idempotency-Key` is required on writes and must match `[A-Za-z0-9_-]{8,128}`; safe to retry with the same value.

```
IDEM=$(uuidgen | tr -d '-' | cut -c1-24)
curl -X POST https://api.predictasiax.com/v1/orders \
  -H "Authorization: Bearer $SK" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${IDEM}" \
  -d '{
    "market_id":       "'"$MARKET_ID"'",
    "side":            "yes",
    "price":           "0.55",
    "size":            "2",
    "client_order_id": "cli-001"
  }'
```

**Order rules.** `size` is a plain decimal with at most 6 decimal places; `price` is 0.0001–0.9999 with at most 4 decimal places (numbers in exponent form such as `1e-7` are rejected). On normal markets, `limit` and `post_only` prices must sit on the tick grid: 0.01 steps from 0.04 to 0.96, and 0.001 steps below 0.04 and above 0.96; off-grid orders are rejected with `rejectReason: invalid_tick` and the `tick` that applies. The order value, `size × price`, must be between 1 and 100,000 USDT. Orders outside these rules return `400 INVALID_FIELD`, `BELOW_MIN_NOTIONAL` or `ABOVE_MAX_NOTIONAL`.

With a sandbox key the order is simulated. At or above the market's current price it fills at that price; below it, it rests (`status: "open"`, the amount held in `reserved_usdt`) and fills once the price reaches your limit, which is checked whenever you read orders, positions, balance or portfolio:

```
{
  "data": {
    "order_id":           "sbx_ord_...",
    "client_order_id":    "cli-001",
    "market_id":          "...",
    "side":               "yes",
    "limit_price":        "0.55",
    "size":               2,
    "filled_size":        2,
    "status":             "filled",
    "fill_price":         "0.42",
    "fill_notional_usdt": "0.84",
    "reserved_usdt":      "0",
    "is_simulated":       true
  },
  "meta": { "trace_id": "...", "is_simulated": true }
}
```

If the virtual balance cannot cover the order it is not created: `{"data": {"ok": false, "status": "REJECTED", "reject_reason": "insufficient_balance", ...}}`. Cancel with `DELETE /v1/orders/{order_id}` (the reserve is returned). Sandbox positions are marked to the current price and are not settled when a market resolves.

On a production key with a balance, a fill returns the order and its fee split (illustrative — the exact `splits` block is derived server-side by the PAX Adaptive Fee curve at fill time):

```
{
  "data": {
    "order": {
      "order_id":     "ord_...",
      "status":       "filled",
      "filled_size":  "2",
      "fill_price":   "0.4200",
      "created_at_ms":1787149484561
    },
    "fee": {
      "taker_fee_bps":   20,                // PAF centre at 50/50, floor 8, ceiling 25
      "fee_total":       "0.001680",        // 20 bps of $0.84 notional
      "splits": {
        "acquisition_builder": "0.000000",  // unfilled → absorbed by platform_net
        "execution_builder":   "0.000000",  // 0 bps — builders earn their builder fee instead
        "operator":            "0.000000",  // 0 bps — PAX is the only operator; carried in platform_net
        "market_creator":      "0.000000",  // unfilled → absorbed by platform_net
        "mm_stipend_pool":     "0.000420",  // 5 bps — funds LQF-scored MM stipends
        "lp":                  "0.000168",  // 2 bps — pooled LP holder distribution
        "platform_net":        "0.001092"   // 10 bps residual + 3 (mc absorbed)
      },
      "attribution": {
        "execution_builder_id":   "sb_d5b09d2a...",   // your builder
        "acquisition_builder_id": null,
        "operator_id":            "op_pax_v3",
        "market_creator_id":      null,
        "builder_tier":           "trade_capped",
        "unfilled_roles":         ["acquisition_builder","market_creator"]
      }
    }
  }
}
```

The `splits` block writes idempotent `financial_event` rows on the platform ledger via the 7-actor PAF split (acquisition_builder / execution_builder / operator / market_creator / mm_stipend_pool / lp / platform_net). Unfilled attribution roles are absorbed by `platform_net` so revenue is protected. **Adaptive taker fee**: `feeBps = clamp(PAF_BASE_BPS · 4 · p · (1−p), PAF_FLOOR_BPS, PAF_CEILING_BPS)` with base 20, floor 8, ceiling 25 — peaks near 50/50, drops at extremes. Full model + bucket ratios in [Fee Architecture](https://docs.predictasiax.com/fee-architecture).

## Step 4 — Over-cap request (see tier caps in action)

Try an order over $10:

```
IDEM=$(uuidgen | tr -d '-' | cut -c1-24)
curl -X POST https://api.predictasiax.com/v1/orders \
  -H "Authorization: Bearer $SK" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${IDEM}" \
  -d '{
    "market_id":"'"$MARKET_ID"'",
    "side":"yes","price":"0.50","size":"100",
    "client_order_id":"too-big"
  }'
```

Response — 429 `TIER_LIMIT_EXCEEDED`:

```
{
  "error": {
    "code":    "TIER_LIMIT_EXCEEDED",
    "message": "order notional 50.00 exceeds tier max_order_usdt 10",
    "details": { "tier": "sandbox", "cap": "10" }
  }
}
```

To lift the cap and trade for real, get a production key ([Request access](https://docs.predictasiax.com/request-access), no review) and route volume — it auto-graduates on its own. `trade_capped` ($100/order, $1k/day) unlocks at $1,000 30-day volume; `trade_full` (uncapped) at $50,000. No upgrade request, no human step — see [Rate Limits → Moving up a tier](https://docs.predictasiax.com/rate-limits#upgrade).

## Step 5 — Read your portfolio

```
curl "https://api.predictasiax.com/v1/portfolio" \
  -H "Authorization: Bearer $SK"
```

Returns your open positions with mark-price recompute (unrealized P&L on the fly).

## Step 6 — Cancel an order

Two equivalent forms — pick whichever is cleaner in your client:

```
# Canonical
curl -X DELETE https://api.predictasiax.com/v1/orders/ord_... \
  -H "Authorization: Bearer $SK"

# Alias (useful when your HTTP client can't send DELETE)
curl -X POST https://api.predictasiax.com/v1/orders/ord_.../cancel \
  -H "Authorization: Bearer $SK"
```

Filled orders return `STATE_CONFLICT` (cannot cancel a filled order); open orders transition to `cancelled`.

## Next steps

- [Authentication guide](https://docs.predictasiax.com/auth) — Bearer sk_live_* + OAuth 2.1
- [REST API reference](https://docs.predictasiax.com/openapi) — full schemas + verifier endpoints
- [WebSocket API reference](https://docs.predictasiax.com/asyncapi) — event catalog
- [Error codes](https://docs.predictasiax.com/errors) — Handle failures gracefully
- [Rate limits](https://docs.predictasiax.com/rate-limits) — Per-scope budgets, the same at every tier
- [Fee Architecture](https://docs.predictasiax.com/fee-architecture) — PAF + LQF + 7-actor split
- [FAQ](https://docs.predictasiax.com/faq)
- [Downloads](https://docs.predictasiax.com/downloads) — OpenAPI / AsyncAPI specs + Postman collection

**Going to production?** Same host, same base URL — `https://api.predictasiax.com/v1`. Submit a [Request access](https://docs.predictasiax.com/request-access) to move your builder from `sandbox` to `trade_capped` or `trade_full` tier. No environment swap or key rotation required.

Source: https://docs.predictasiax.com/getting-started
