# Build on PredictAsiaX

A canonical API for Asia's prediction markets — trade, resolve, embed, provide liquidity. Application flow via `POST /v1/apply`: all 20 tracks auto-provision a live `sk_live_*` key on submit — `genesis` and `institutional` included. Every key starts on `self_serve`; capability is gated by the automatic 30-day-volume tier ladder, never by application review.

## 1. How to become a builder

Submit an application via `POST /v1/apply`. Every track returns a live `sk_live_*` API key in the response body immediately — `genesis` and `institutional` included. There is no `pending_review` state and no admin operator in the loop.

#### 1. Pick a track

All 20 tracks auto-provision: `app`, `agent`, `data`, `distribution`, `market`, `liquidity`, `oracle`, `reviewer`, `operator`, `self_serve`, `genesis`, `institutional`, and 8× `rfb-*`. The track is an attribution label and starting context — it does not change the instant-key behaviour. See the [application form](https://docs.predictasiax.com/request-access) for the full track catalog.

#### 2. Submit application

Fill the [web form](https://docs.predictasiax.com/request-access) or POST directly to `/v1/apply`. Rate-limited to 5/hour/IP. Every field is optional; `track` defaults to `self_serve`.

#### 3. Every track — instant key

Response returns `status: "approved"` + a live `sk_live_*` API key (`self_serve` tier — $100/order, $1,000/day caps) in the body. Same for every track, `genesis` and `institutional` included — there is no `pending_review` state and no admin operator in the loop. Save the key from the response body — it's shown once. The response also carries `portal_signin_url`, a single-use link (72 hours) to set your Builder Portal password. Poll the application record any time via `GET /v1/apply/{ba_id}` (the URL parameter uses the `application_code` value). Go straight to [Getting Started](https://docs.predictasiax.com/getting-started).

#### 4. Tier upgrade later

Every key starts on `self_serve`. The auto-graduation cron promotes on 30-day volume (attributed volume plus your own accounts' fills; see [How tiers work](https://docs.predictasiax.com/how-tiers-work)) — `read_live` at $100, `trade_capped` at $1,000, `trade_full` at $50,000, `partner` at $1,000,000 — with no admin approval at any step. `genesis` is granted automatically to the top-20 builders by 30-day attributed volume, and auto-revoked when you leave the top 20.

**What the API actually does on submit.** The `POST /v1/apply` endpoint inserts a row in `builder_applications`, and — for every track — synchronously provisions a builder registry entry and mints a live `sk_live_*` API key via the same key store that powers all production keys. The API key returned in the response body is the same shape and same key store that a Portal-minted key would use.

## 2. What you get

#### Tier-flagged API keys

Prefixed `sk_live_*`, differentiated by the `tier` flag on the key — `sandbox` for sandbox keys ($10/$100 daily caps, 1,000 virtual USDT, simulated fills), `read_live` / `trade_capped` / `trade_full` for production. Wrong-tier operations return actionable `TIER_LIMIT_EXCEEDED` — impossible to accidentally over-scope a bot.

- Base URL: `api.predictasiax.com/v1`
- Sandbox: same host, sandbox tier (see [Sandbox](https://docs.predictasiax.com/sandbox/))

#### Builder Portal

Dashboard at `builder.predictasiax.com` — first-party email + password login, 12h sessions, revoke everywhere on logout.

- Apps · API keys · Webhooks
- Attribution ledger · Revenue · Payouts
- Trading balance (deposit · withdraw) · Subaccounts · Trading agents

#### OAuth 2.1 identity provider

Your app becomes an OAuth client: the signed-in PredictAsiaX builder account consents to scopes and your app gets scoped access tokens for that account. PKCE S256 required. Account actions (withdrawals, 2FA, payout wallets, approving trading agents) are never reachable with an app token.

- `GET /oauth/authorize`
- `POST /oauth/token` (code + refresh grants)
- Refresh rotation with family reuse detection

#### Attribution & Revenue Ledger

Every fill your app executes is public, with the ledger entries its fee produced and their audit events: hash-chained, Merkle-batched and anchored. Anyone can check a builder's fills without a key and without asking PAX.

- `GET /v1/builders/{builder_id}/trades` — public, no key: a listed builder's attributed fills, newest first. `since_ms` / `until_ms` (default the last 30 days, at most 366), `limit` up to 200, page with `next_cursor`. `summary` gives the window's attributed volume, fills, unique traders and the own-account fills left out.
- Each fill: `trade_id` (the same id as in `GET /v1/fills` and the order reply), `market_id`, `outcome_index`, `side`, `price`, `size`, `notional_usdt`, `filled_at_ms`, `builder_fee_usdt` (the builder's fee on it) and `audit`: one entry per ledger entry of its fee with `leg`, `seq`, `event_hash`, `batch_num` and `anchored`. Check one with `GET /v1/audit/events/{seq}` and `GET /v1/audit/proof/{seq}`. Trader identities are never returned.
- `GET /v1/builders/me/trades` — the same list for your own builder account, whatever its status (scope `builder:read`).
- Which fills count: a fill counts for the builder whose app placed the taker order. Fills where the taker is your own account (your builder account, its subaccounts, or an account with the same email or wallet as your builder account or its payout address) do not count and are not listed. The same rule gives tier graduation, the Builder Directory, the leaderboard and your 30-day stats, so the numbers agree everywhere.
- `GET /v1/attribution/fills` — every fill that earned you a fee share (execution, acquisition, market creator), with your share of the fee
- `GET /v1/builders/me/revenue` — accrual + settled totals
- `GET /v1/builders/me/payouts` — payout history
- `GET /v1/audit/proof/{seq}` — Merkle proof + verifier JS ([/verify](https://docs.predictasiax.com/verify))
- `GET /v1/builders/me/tier-progress` — 30d volume vs. next threshold, plus `acquisition_gate`: your own trading volume toward the acquisition-share threshold
- Acquisition is recorded when a visitor signs up from your widget or `?ref_app=bld_...` link (see Acquisition attribution below)

#### API request log

Every request made with your API keys (Bearer or HMAC) or with an OAuth token of one of your apps, kept for 7 days: method, route, status, error code, latency, key, app and trace id. Metadata only: no request or response bodies, no query strings, no headers other than User-Agent; requests made with an OAuth app token carry no IP or User-Agent. Builder Portal requests are not logged. In the Builder Portal: **Ops > API errors** and **Ops > API request logs**.

- `GET /v1/builders/me/request-logs` — newest first; filter by `status` (`2xx`, `4xx`, `5xx`, `errors` or one code), `method`, `route`, `error_code`, `app_id`, `api_key_id`, `since_ms` / `until_ms` (default the last 24 hours); `limit` up to 200, page with `next_cursor`
- `GET /v1/builders/me/request-logs/summary?window=1h|24h|7d` — error rate, p50/p95/p99 latency, a time series, the most frequent errors and the busiest routes
- `GET /v1/builders/me/request-logs/{trace_id}` — one request by the `X-Trace-Id` header of its response
- Portal session or scope `builder:read`; a test key sees the test log. Records are written after the response is sent, usually within seconds, and logging never delays or fails an API call. A record can be missing if its delivery fails, so do not use the log as an audit trail of orders.

#### Trading agents

Let another builder account trade on yours (a market maker, a strategy provider). You approve the agent in the Builder Portal with your 2FA code; the agent then sends its own orders with `on_behalf_of` set to your account id. Orders execute on your account (or the subaccount slot named) at your VIP tier. Agents can never withdraw, transfer between subaccounts or approve other agents. API keys cannot approve agents.

- `POST /v1/delegations` — approve (Builder Portal session + `totp_code`)
- `GET /v1/delegations` · `GET /v1/delegations/received` — live approvals given / held
- `DELETE /v1/delegations/{id}` — revoke, effective on the next request
- Scopes: `trade` (place + cancel) · `close_only` (SELL of shares held + cancel) · `read_positions`
- Limits, all optional, checked on every order: `max_notional_usdt` per order, `daily_notional_cap` over a rolling 24h, `markets_allowlist`, `account_slots` (0 = main account), `expires_at` (within 365 days)
- `on_behalf_of` works on `POST /v1/orders`, `DELETE /v1/orders/{id}`, `POST /v1/orders/cancel-all`, `GET /v1/orders`, `/v1/positions`, `/v1/portfolio`, `/v1/balance`
- Up to 10 live agents per account; approving the same agent again replaces its approval

#### App connections — trade for your users on their own accounts

Your users can connect your app to their own PredictAsiaX account, so your bot, app or agent trades with their balance instead of yours. You never hold their funds. Send the user to the consent page; they sign in on predictasiax.com, see what your app can do, set their own limits and approve. You get back an opaque account reference (`pxu_...`) and trade with your normal API key plus `on_behalf_of` set to that reference.

- Register your redirect URIs first: `PATCH /v1/apps/{app_id}` with `{"redirect_uris": ["https://yourapp.com/pax/callback"]}`. Up to 10; each must be https, http on `localhost` / `127.0.0.1` / `[::1]`, or your app's own scheme (`myapp://callback`), with no fragment. The same call sets `homepage_url` (https) and `name` (2-60 characters), which the consent page shows. It needs a portal session or a key with `builder:apps:write`, and changes only your own apps.
- Consent page: `https://predictasiax.com/connect?client_id=<your app client_id>&redirect_uri=<a registered redirect URI>&scope=trade%20read_positions&state=<yours>`. Optional prefills the user can change: `max_notional_usdt`, `daily_notional_cap`, `expires_in_days`.
- On approval the user returns to your `redirect_uri` with `pax_account=pxu_...`, `connection_id`, `scope` and your `state`. On decline: `error=access_denied`.
- Scopes: `trade` (place + cancel), `close_only` (SELL of shares held + cancel), `read_positions`, `deposit_address` (the user's own USDT deposit address). Your app must hold `orders:create` for the first two and `portfolio:read` for the other two.
- Funding inside your app: with `deposit_address`, `GET /v1/deposit/addresses?on_behalf_of=pxu_...` returns the user's own deposit addresses (the account is named by its `pxu_` reference). USDT sent there credits the user's own trading balance, exactly as a deposit on predictasiax.com. Your app only shows the address; it never holds or moves the funds. Without the scope the request answers `403 DELEGATION_SCOPE_MISMATCH`.
- The user's limits are checked on every order: per-order maximum, rolling 24h total, markets, and expiry (default 90 days, at most 365). A connection can never withdraw, transfer, change settings or keys, or see the user's email or account id.
- Orders run on the user's account at the user's VIP tier, on the platform balance unless you send `fundingMode`. Your builder is the execution builder for the fill. You can cancel only the orders your app placed.
- `on_behalf_of=pxu_...` works on the same endpoints as trading agents. `GET /v1/delegations/received` lists your live connections (`delegator_type: "user"`); a user who disconnects in Settings, Connected apps is gone on the next request (`403 DELEGATION_MISSING`).
- `GET /v1/connect/apps/{client_id}` (public) shows what the consent page shows about your app.
- A user can connect up to 25 apps; connecting your app again keeps the same `pxu_` reference.
- Your key's tier caps ([per-order and daily notional](https://docs.predictasiax.com/auth#env-separation)) do not apply to these orders: each user's own limits bound them, so a new app is not held to one shared daily total across all its users. A `read_live` key still cannot place them.
- `PATCH /v1/apps/{app_id}` also takes `description` (up to 200 characters, shown on the consent page and in the [app directory](https://docs.predictasiax.com/builders#app-directory)) and `directory_listed` (`true` by default).

#### Widget trading — visitors trade inside your embedded widget

With `mode="trade"` the market widget becomes an order panel. A visitor connects your app once (the same App connections consent on predictasiax.com, with their own limits) and then buys Yes or No inside your page without leaving it. Orders run on the visitor's own account exactly like your `on_behalf_of` orders: your builder is the execution builder, the visitor's limits are checked on every order, and your builder fee applies only if the visitor approved it.

- `<predictasiax-market market="<market id>" app="<your app id or client_id>" mode="trade">` with `widget.js` loaded, or frame `https://widget.predictasiax.com/trade?market=…&app=…`. Optional `theme="dark"`, `size="compact"`, `lang` (one of the 13 site languages; otherwise the visitor's browser language).
- Nothing to register: the widget's callback page is accepted for every approved app. Your app needs a trading tier and `orders:create`, like any App connection with the `trade` scope.
- Connecting: in a desktop browser the consent page opens in a pop-up and the widget connects as soon as the visitor approves. In-app browsers (Telegram, LINE, Facebook, Instagram, WeChat, KakaoTalk and other app views) give the pop-up no way back, so the consent page opens in a browser outside the app (where the visitor may need to sign in) and, after they approve, shows a 6-digit code that they enter in the widget. The code works once, for 15 minutes, and only in the browser where the widget started; five wrong codes end the request. A declined request shows as declined in the widget.
- Inside a Telegram Mini App or a LINE LIFF app, load `widget.js` on the page (or use the [ready-made page](https://docs.predictasiax.com/builders#telegram-line)) rather than framing `/trade` yourself: the widget then opens the consent page through Telegram's or LINE's own link handling.
- The frame grows to fit what it shows (code entry, order confirmation) and never shrinks below the size you chose. `size="full"` fills the element instead; give the element a height.
- Every order shows a confirmation with side, amount, price and your app's name; its button works only after the confirmation has been on screen for half a second. Orders are limit buys at the displayed price, binary markets only; multi-outcome markets show a link to predictasiax.com instead.
- The visitor stays connected in that widget until they sign out of it, disconnect your app in Settings, Connected apps, or the connection expires. The widget never sees their email, account id or API keys, and you never receive a credential from it.

#### Telegram Mini Apps and LINE — the trade widget as a ready-made page

`https://widget.predictasiax.com/miniapp?market=<market id>&app=<your app id or client_id>` is a full-screen page with the [trade widget](https://docs.predictasiax.com/builders#widget-trading), made to open as a Telegram Mini App or a LINE LIFF app. There is nothing to host.

- Telegram: set the URL as your bot's Mini App or menu button in @BotFather, or open it from a `web_app` keyboard button. The page follows the user's Telegram theme and language.
- LINE: create a LIFF app in the LINE Developers console with the URL as its endpoint URL and add `&liff=<your LIFF ID>` to it. The page follows the LINE app's language.
- Optional: `theme` (`auto`, the default, follows the host app; or `dark`, `light`) and `lang` (one of the 13 site languages; by default the host app's language, then the device's).
- Connecting works as in [Widget trading](https://docs.predictasiax.com/builders#widget-trading): the consent page opens outside the Mini App or LIFF view and the visitor enters the 6-digit code it shows. A visitor already connected in that widget stays connected.
- The page can be shown in a frame only by Telegram Web (`web.telegram.org`).

#### Trading competitions — prizes you fund, paid out automatically

Run a trading competition for the users who trade through your app. You fund the prizes; PredictAsiaX holds them in escrow from the moment you create the competition and pays them by rank after it ends. The platform takes no part of the prize pool.

- Create: `POST /v1/competitions` (Builder Portal session + `totp_code`; no API key can create one) with `{"title": "December volume race", "ends_at": "2026-12-31T00:00:00Z", "prizes": ["500", "250", "100"]}`. Optional: `starts_at` (default now, at most 30 days ahead), `description` (up to 500 characters), `min_volume_usdt`. Times are ISO 8601 or epoch milliseconds. A competition runs from 1 hour to 90 days. `prizes` lists 1 to 100 USDT amounts, rank 1 first, each from 1 to 10,000,000 with up to 6 decimals, and no prize larger than the one before it. Returns `201` with the competition.
- Funding: the prize pool is the sum of `prizes`, taken from your builder account's platform USDT balance when you create the competition. If the balance does not cover it, nothing is charged (`400 INSUFFICIENT_BALANCE`). Like withdrawals, creating one needs 2FA active for 24 hours, and it pauses while payouts are suspended. Up to 10 competitions per builder can be open at a time (`409 LIMIT_REACHED`).
- Who takes part: every user who connected your app, for the orders your app placed for them (`on_behalf_of`), counted when the order takes liquidity: the same fills as your attributed volume for [tiers](https://docs.predictasiax.com/builders#tiers). Your own accounts (yours, your subaccounts, and accounts with your email or payout wallet) and accounts frozen for collusion are left out. A participant needs at least `min_volume_usdt`.
- Ranking: trading volume (`size × price` of those fills) between `starts_at` and `ends_at`. Users with the same volume share the prizes of the places they occupy equally. Places past the end of `prizes` win nothing.
- Payout: about 15 minutes after the end, each prize is credited to the winner's platform balance and the competition becomes `settled`. Whatever is not won (fewer qualifying users than prizes, rounding, or a winner whose account was deleted) goes back to your platform balance. Settlement waits until every trade record can be read; it never pays on partial data.
- Cancel: `POST /v1/competitions/{id}/cancel` (`builder:apps:write`) before `starts_at` returns the whole pool to your balance. After the start it cannot be cancelled (`409 COMPETITION_STARTED`).
- Public, no key: `GET /v1/competitions/{id}` and `GET /v1/competitions/{id}/leaderboard?limit=1-500` (default 100), so your site can show them directly. The leaderboard has `status`, `final` (`true` once settled), `participants`, `computed_at_ms` and `rows` of `rank`, `participant`, `volume_usdt`, `prize_usdt`. A participant appears only as `p_` + 12 hex, stable within one competition and different in every other. Live standings refresh every 60 seconds.
- Yours: `GET /v1/competitions` lists your competitions, and `GET /v1/competitions/{id}/results` adds each user's `owner_ref` (the `pxu_` id of their connection to your app, or `null`), the `payout` state (`pending`, `paid` or `void`, with `paid_at_ms`) and your `refunds` (both `builder:apps:read`).
- A competition has `id` (`cmp_` + 24 hex), `title`, `description`, `status` (`upcoming`, `live`, `ended`, `settling`, `settled` or `cancelled`), `starts_at_ms`, `ends_at_ms`, `prize_pool_usdt`, `prizes_usdt`, `min_volume_usdt`, `ranking` (`volume_usdt`), `created_at_ms`, `settled_at_ms` and `cancelled_at_ms`. Amounts are decimal strings.

#### Copy trading API — let your users copy leaders

Leaders are PredictAsiaX traders who opted in to be copied and qualified. Your app can list them and start or stop copying them, for your own account or for a user who connected your app. Every time a leader's order fills, the follower's account places its own order on the order book; the follower owns the shares and can sell them at any time.

- Leaders: `GET /v1/copy/leaders?sort=active_followers|copy_volume|win_rate_30d|roi_30d&limit=1-100&offset=` and `GET /v1/copy/leaders/{leader_id}`, with any API key. A leader is named by a stable `leader_id` (`ldr_` + 20 hex), never by account id. Fields: `display_name`, `bio`, `tier`, `followers`, `active_followers`, `copy_volume` (USDT, decimal string), `stats_updated_at_ms`, and the 30-day record below. Only leaders who can be copied right now are listed.
- 30-day record: computed daily from the leader's own order-book trades in normal markets, fees included. A position is one market, side and outcome, and closes when the leader sells it or the market settles; voided markets do not count. `win_rate_30d` (share of closed positions in profit), `roi_30d` (profit minus loss over the cost of the closed shares), `closed_positions_30d`, `markets_30d`, `active_days_30d`, `sharpe_ratio_30d`, `sortino_ratio_30d`, `drawdown_30d` (largest fall of cumulative daily profit from its peak, over the cost of the closed shares) and `record_updated_at_ms`. Rates are `null` until 5 positions have closed; the ratios and drawdown also need 3 days.
- Who can be copied: a trader who opted in qualifies automatically on that record (at least 20 closed positions across 5 markets, a win rate of 55% or more, positive ROI, at least 100 USDT of closed shares and a drawdown under 40%) or as an established market creator, if the account is at least 30 days old and in good standing. It is checked again every day.
- Start: `POST /v1/copy/subscriptions` `{"leader_id": "ldr_...", "ratio": 0.1, "max_stake": 100}` (scope `orders:create`), plus `"on_behalf_of": "pxu_..."` for a connected user. Each copy is `ratio` (above 0, at most 1; default 0.1) times the leader's fill notional, capped at `max_stake` USDT (1 to 1,000,000; default 100). Copies under 1 USDT are skipped. Returns `201` with the subscription.
- How copies trade: when a leader's buy fills, the follower buys with an immediate-or-cancel order at up to 5% above the leader's price; whatever does not fill at once is dropped. When the leader sells, the follower sells the same fraction of the copied shares it still holds, at down to 5% below. Markets whose creator turned off copy trading are skipped. A copied order pays the trading fee like any other order on the follower's account, at the follower's own VIP tier; the performance fee below is separate.
- Connected users: the connection needs the `trade` scope. Every copied buy is checked against the user's own limits (per-order maximum, rolling 24h total, markets, expiry) and counted in them, exactly like your `on_behalf_of` orders; a `max_stake` above the user's per-order maximum returns `422 DELEGATION_SCOPE_MISMATCH`. If the user disconnects your app, the subscription pauses at the next copy. Your builder is the execution builder for copied orders, and your builder fee applies only if the user approved it.
- Your app sees and stops only the subscriptions it created. It cannot take over a leader the user already copies in another way (`409 ALREADY_COPYING`).
- Your own account: `max_stake` must be within your key's per-order cap (`429 TIER_LIMIT_EXCEEDED`). Builder accounts copy on the platform balance.
- The same rules as on predictasiax.com apply, the same for every account and VIP tier: an account copies up to 20 leaders at a time (one more returns `422 SUBSCRIPTION_LIMIT`), there is no daily or weekly copy cap (each copy is bounded by `ratio` and `max_stake`), a leader can be at follower capacity, and a performance fee of 10% of the profit is charged when a copied position closes in profit, the same for every account and VIP tier. `performance_fee_pct` on each subscription is the rate that applies now; nothing is charged on a loss.
- List: `GET /v1/copy/subscriptions` (scope `portfolio:read`) returns active and paused subscriptions: `leader_id`, `status`, `ratio`, `max_stake`, `funding_mode`, `performance_fee_pct`, `copy_trade_count` (copied buys), `copy_volume` (USDT spent on copied buys), `created_by_app`, `created_at_ms`, `updated_at_ms`.
- Stop: `DELETE /v1/copy/subscriptions/{leader_id}` returns `{"leader_id": "ldr_...", "status": "stopped"}`. Shares already bought stay in the account.
- `read_live` and sandbox keys can read leaders but cannot start or stop copying (`403 TIER_UPGRADE_REQUIRED`).

#### Sign in with PredictAsiaX — let any user sign in to your app

Standard OpenID Connect (Authorization Code + PKCE) so PredictAsiaX users can sign in to your app with their PredictAsiaX account. Identity only: you get a stable per-developer user id (`sub`) and, if the user agrees, their name and email. No access to their account, balance or trading. Uses your app's `client_id` and registered redirect URIs. Details: [Authentication, Sign in with PredictAsiaX](https://docs.predictasiax.com/auth#signin-with).

#### App directory — get found by users

[predictasiax.com/apps](https://predictasiax.com/apps) lists approved apps that users have connected, with each app's builder fee. Apps are ranked by the connected accounts that traded through your builder in the last 30 days, by those accounts' traded volume, or by newest. Only real fills count, with the leaderboard's rule: fills by your own accounts (your builder account, its subaccounts, accounts sharing its email or payout wallet) never count, so connections that never trade rank nothing. Apps of builders whose payouts are suspended for wash trading are not listed. Listing is automatic; hide yours with `PATCH /v1/apps/{app_id}` `{"directory_listed": false}`. The same data is public at `GET https://predictasiax.com/api/connect/directory?sort=accounts|volume|newest` (refreshed every 5 minutes): `app_id`, `client_id`, `name`, `description`, `homepage_url`, `builder_id`, `builder_name`, `connected_accounts`, `orders_30d`, `order_notional_30d_usdt`, `builder_fee` (`taker_bps`, `maker_bps`), `first_connected_at`.

#### Builder fee — your own rate on the orders you place for others

On top of the platform fee, you can charge your own builder fee on the orders you place for another account: a user who connected your app (`on_behalf_of=pxu_...`) or an account that made you its trading agent. It is a rate on notional, paid by that account straight to your builder account in the same step that fills the order. The platform takes no part of it, and it does not change the platform fee or its split. Orders on your own account and your own subaccount slots never pay it.

- Rates: taker 0-100 bps, maker 0-50 bps, on each fill's notional (`size × price` at that side's fill price). Each fill's fee is rounded down to 0.000001 USDT and never exceeds the paying account's available balance at that fill.
- Set it with `PUT /v1/builders/me/fee` `{"taker_bps": 25, "maker_bps": 0}` (scope `orders:create`). A new rate takes effect 3 days after you set it, the rate can change at most once every 7 days, and only one change can be pending. `DELETE /v1/builders/me/fee/pending` cancels the pending change; the current rate stays. Only live (non-sandbox) builders can set a rate.
- Your rate is public: `GET /v1/builders/{builder_id}/fee` returns the current rate and any pending change with its `effective_at_ms`, so an account always sees a change 3 days before it applies.
- An account pays only after it approved a maximum rate for your builder: `POST /v1/builder-fee-approvals` `{"builder_id": "bld_...", "max_taker_bps": 25, "max_maker_bps": 0}`, made by the paying account itself (a trading agent's owner uses its own key). `GET /v1/builder-fee-approvals` lists them, `DELETE /v1/builder-fee-approvals/{builder_id}` revokes one at any time. An account can hold at most 10 live approvals. A user who connected your app can also approve, change or remove it on predictasiax.com in Settings, Connected apps, which shows your current rate and any pending change next to your app.
- While your rate is above 0, an order you place for an account that has not approved it is refused with `403 BUILDER_FEE_NOT_APPROVED`, and one above its approved maximum with `403 BUILDER_FEE_EXCEEDS_APPROVAL`. The order is refused, never repriced. Raising your rate therefore needs the accounts to raise their approvals before the new rate takes effect.
- Income: `GET /v1/builders/me/fee-earnings?days=30` (scope `builder:revenue:read`, 1-90 days) returns the total and a per-UTC-day breakdown with the number of fills. `GET /v1/builders/me` carries a summary in `builder_fee` (current and pending rate, total, last 30 days). The fee is credited to your builder account's balance with each fill; there is nothing to claim.
- Ledger: each charge writes `CLOB_BUILDER_FEE` (`user:<payer>` → `builder_fee:<builder_id>`) and `CLOB_BUILDER_FEE_CREDIT` (`builder_fee:<builder_id>` → `user:<builder_id>`), so the clearing account always nets to zero.
- Preview: `POST /v1/fees/estimate` with `builder_id` (and `role: "maker"` for a maker fill) prices your live rate into `additive_fee` and `total_fee`.

#### Trading balance & subaccounts

Your builder account holds its own USDT trading balance, which your API orders use. Split it across up to 63 subaccount slots: each slot is a separate account with its own balance and positions, trading at your VIP tier (slot volume counts toward your tier).

- `GET /v1/deposit/addresses` — your USDT deposit addresses; deposits credit slot 0
- `GET /v1/balance` — available and in-open-orders balance (`?subaccount_slot=N` for a slot)
- `POST /v1/subaccounts` `{slot, name}` · `GET /v1/subaccounts` · `GET /v1/subaccounts/balances` · `DELETE /v1/subaccounts/{slot}`
- `POST /v1/subaccounts/transfer` `{from_slot, to_slot, asset, amount}`
- `subaccount_slot` on `POST /v1/orders` picks the account an order trades from
- Withdrawals: from slot 0, in the Builder Portal only (session + 2FA + a verified payout wallet), after deposits have been traded at least once. No API key can withdraw.

#### Points ledger (airdrop-track accrual)

Every attributed fill mints points to your builder ledger — deterministic per-fill accrual, append-only, verifiable. No points are minted for a fill taken by your own account (or an account sharing your builder account's email or wallet), or while your builder is terminated, a sandbox builder or suspended for wash trading. Acquisition points start only once your own accounts have traded $10,000 in total; points not minted before then are not minted later. About a day after a fill, its points are checked with the same wash-trading checks used on payouts (an account trading with itself, two accounts trading back and forth, an account buying and selling back the same market with almost no change in what it holds). The points of a flagged fill are reversed by a negative ledger entry with source `wash_reversal:exec` or `wash_reversal:acq`; nothing is deleted. Idempotency by `(source_type, source_ref)`: same fill never credits twice. Runs automatically every 5 minutes.

- `GET /v1/builders/me/points` — total, breakdown by epoch + source, my rank
- `GET /v1/builders/:userId/points` — public read (rank + total only)
- Formula: `points = attributed_volume_usdt × epoch_multiplier`
- Roles: execution builder full multiplier · acquisition builder 0.5×
- Epoch is *derived* from your builder tier: `genesis` / `partner` → 1.5× · everything else → 1.0×. Multiplier follows your tier automatically — when auto-graduation promotes you, points scale up on the next fill.
- `mint_status` field: `weekly_pax`, points turn into PAX every UTC week (see [PAX for builders](https://docs.predictasiax.com/builders#grants))

#### Attribution leaderboard + daily bonus

Public ranking of builders by attributed trading volume for a rolling window. Distinct from the MM liquidity leaderboard (which ranks makers by rebate).

- `GET /v1/builders/leaderboard?window=1d|7d|30d[&limit=N]` — public top-N of verified builders: public name and handle, tier, fills, attributed volume and unique traders. Default window 30d.
- `GET /v1/builders/me/leaderboard-rank?window=1d|7d|30d` — your volume, fills, unique traders and rank among verified builders (`rank` is null while you are not listed or have no attributed volume in the window)
- Daily bonus: when a UTC day closes, the verified builders with the most attributed volume that day (top 10, at least 100 USDT each) share that day's bonus pool in proportion to their volume. Volume is counted with the leaderboard's rule: fills by your own accounts do not count, and builders whose payouts are suspended for wash trading are left out.
- The pool is funded automatically from the platform's net fee revenue of the same day, so it grows with platform activity and is zero on a day without any. There is nothing to apply for.
- The pool total is internal and not published.
- Awards are booked to your builder balance shortly after 00:00 UTC, once that day's fill data has been read in full. Like your builder fees, an award can be claimed with `POST /v1/builders/me/settle` 72 hours after it is booked (the reserve window), or is paid by the [automatic daily payout](https://docs.predictasiax.com/builders#payouts). Awards count in `GET /v1/builders/me/pending-balance`, and `leaderboard_bonus_usdt` of `GET /v1/revenue` gives the lifetime total.
- `GET /v1/builders/me/leaderboard-rank` returns `bonus_prior_day` for the last completed day: `day`, `rank`, `bonus_usdt`, `attributed_volume_usdt` and `claimed`, or null when you had no award. `bonus_status` is `unavailable` when the award could not be read; the rank is still returned.

#### Acquisition attribution

A user's acquisition builder is set once, when they create their predictasiax.com account after following your widget's trade link or a link carrying `?ref_app=bld_...` (the first such link within 30 days counts). It never changes afterwards. From then on every trade that user places, on predictasiax.com or through the API, is attributed to your builder: it earns you acquisition points and appears in your affiliate reports. Since 2026-11-28 the platform fee carries no builder share; builders earn the [builder fee](https://docs.predictasiax.com/builders#builder-fee) they set.

- Only a live, non-sandbox builder is recorded.
- Acquisition points start once your own accounts have traded **$10,000** in total. Your own accounts are your builder account and any account with the same email or wallet as your builder account or its payout address. Real-money buys count, less any that were voided, plus order-book fills where only one side is one of your own accounts; demo trades do not count. Points not minted before then are not minted later. The link is still recorded when the user signs up. Your progress is in `acquisition_gate` of `GET /v1/builders/me/tier-progress`.
- Tag a link by channel with `&c=<tag>`, for example `https://predictasiax.com/zh-CN/markets?ref_app=bld_...&c=tg-group`. Any page and any language path works.
- See what your links produced in `GET /v1/builders/me/affiliate/overview?month=YYYY-MM` (visits, sign-ups, first deposits, active traders, referred volume and earnings, by day, campaign, country and device) and `GET /v1/builders/me/affiliate/users` (referred accounts by anonymous reference). The Builder Portal's Promote section shows the same report and builds links, QR codes and banner code for you.
- Monthly totals for the last 12 months: `GET /v1/builders/me/affiliate/statement`. `commission` in the overview gives the acquisition share of the trading fee: 0 since 2026-11-28.
- Name your tags as campaigns (landing page, language, channel) with `/v1/builders/me/affiliate/campaigns`.
- Add `&sid=<click id>` to a link to pass your own click id (1-100 letters, digits, `_ . : ~ -`). It is kept with the first link a visitor follows and recorded on their sign-up.
- Postbacks: register an HTTPS URL with `POST /v1/builders/me/affiliate/postbacks` and PAX calls it with a `GET` when an account you referred signs up, makes its first deposit or makes its first trade. Use macros in the URL: `{event}` (`signup`, `first_deposit`, `first_trade`), `{account}` (the anonymous `u_...` reference), `{campaign}`, `{sub_id}`, `{country}`, `{amount}` and `{currency}` (first deposit), `{timestamp}`, `{builder_id}`. Events are sent for accounts that sign up after the postback was created. A call that does not return 2xx within 5 seconds is retried after 1 min, 5 min, 30 min, 2 h and 6 h. Send a test with `POST .../postbacks/{id}/test` and see every call in `GET .../postbacks/log`.
- The `X-Builder-Ref` header no longer records acquisition; an order sent with it is placed normally and the header is ignored. The TypeScript SDK's `attachRef()` helper, which sent it, is deprecated in `@predictasiax/api` 3.3.0: it no longer sends the header and will be removed in 4.0.

#### Platform fee share and payouts

Since 2026-11-28 the platform fee carries no execution or acquisition share (see [Fee Architecture](https://docs.predictasiax.com/fee-architecture#trading-fee)). Your income is the [builder fee](https://docs.predictasiax.com/builders#builder-fee) you set, which your own accounts never pay.

- Payout mode: `PUT /v1/builders/me/payout-config` with `payout_mode` `daily` (the default) or `on_demand`. The earlier values `monthly_10`, `weekly_100` and `threshold_500` never paid anything and now read as `daily`.
- Automatic daily payout: in `daily` mode, set `payout_default_wallet_id` to one of your verified USDT payout wallets, with `totp_code` from your 2FA (the same step-up as a withdrawal, because later payouts go there without another code). Once a day after 01:00 UTC your claimable earnings are settled to that wallet when they reach 1 USDT. The wallet must be past its 24-hour cool-down and is screened against sanctions lists on every run. `GET /v1/builders/me/payout-config` returns `auto_payout_active`.
- `on_demand`, or no wallet set: you are paid when you call `POST /v1/builders/me/settle` (at least 10 USDT).
- An automatic payout follows the same rules as one you start: only earnings booked at least 72 hours ago are claimed, it counts toward your tier's daily settle limit, and it is held as below.

A payout is held before it is sent: 7 days for your first payout, while your builder is under 30 days old, or when fills of yours were flagged for wash trading in the last 30 days; 24 hours otherwise. Large amounts add to the hold (up to 10 days in all). During the hold the fills behind it are checked automatically for an account trading with itself, two accounts trading back and forth, and an account buying and selling back the same market with almost no change in what it holds. The amount from flagged fills is removed from the payout before it is sent.

#### Webhooks

HMAC-signed event streams — `trade.filled`, `market.resolved`, `payout.available`, `payout.paid`, `auth.token.revoked`. Exponential backoff 8-retry policy.

- CRUD via `POST /v1/webhooks`
- Signing secret shown once, rotatable
- Live delivery log per endpoint

#### MCP endpoint for AI agents

Your builder identity works via `mcp.predictasiax.com/mcp` — Claude Desktop / Cursor users add one line and get 46 tools (market_search / place_order / portfolio_read / cancel_order / docs_search etc — call `tools/list` for the full runtime enumeration).

- OpenAPI + AsyncAPI + `llms.txt` for AI discoverability
- Bearer forwarding to backend

## 3. What you can build

Each category maps to a set of scopes + endpoints. Request only the scopes you need — least-privilege is enforced.

AI & MCP

#### Autonomous trading agent

Claude / Cursor / a custom agent uses your builder's MCP endpoint to discover markets, read portfolio, place idempotent orders.

mcp.predictasiax.com/mcp  
 POST /v1/orders (Idempotency-Key required)  
 scopes: markets:read, orders:create, portfolio:read

Trading UI

#### Web / mobile trading app

Full-featured trading UI on top of the REST + WS API. Your users connect your app to their own PredictAsiaX account ([App connections](https://docs.predictasiax.com/builders#app-connections)) and you trade with `on_behalf_of`.

GET /v1/markets, /v1/markets/movers, /v1/markets/{id}  
 POST /v1/orders · DELETE /v1/orders/{id}  
 WS: wss://predictasiax.com/ws (94 server messages)

Widget

#### Embeddable market widget

Load `widget.predictasiax.com/widget.js` and drop `<predictasiax-market market="…" builder="bld_…">` into any page (or frame `widget.predictasiax.com/iframe?market=…&builder=…`). Shows the live price; its Trade link opens the market on predictasiax.com, where the visitor signs in and trades. Optional `theme="dark"`. Framework-agnostic web component. Add `mode="trade" app="…"` to let visitors trade inside the widget ([Widget trading](https://docs.predictasiax.com/builders#widget-trading)).

widget.predictasiax.com/widget.js · /iframe · /trade · /miniapp  
 Attribution: the Trade link carries `ref_app=bld_…`; a visitor who signs up from it is recorded as your acquisition

Data

#### Data terminal / research tool

Price history, order book snapshots, movers and resolution details. Query historical data for backtesting.

GET /v1/data/history · /v1/data/movers · /v1/markets/{id}/book  
 scope: markets:read

Liquidity

#### Market maker bot

Publish resting quotes, respond to RFQs. MM scoring feeds into incentive payouts — top MMs get rebates.

POST /v1/mm/quotes · POST /v1/rfq/{id}/quotes  
 scopes: builder:apps:write (writes are app-signed)

Market creator

#### Market composer

Create markets directly — YES/NO binaries, over/unders, multi-outcome. Each submission self-serve-creates a real market (settlement status `open`) immediately — no approval step; you earn creator fees on every fill.

POST /v1/composer/markets (legacy alias: /v1/composer/proposals)  
 GET /v1/composer/templates (6 kinds seeded)

Oracle

#### Resolver

Propose outcomes for markets the oracle cannot decide, or challenge a proposed outcome, by locking a PAX bond from your platform balance, at [predictasiax.com/dispute](https://predictasiax.com/dispute) or through the [oracle API](https://docs.predictasiax.com/oracle). Challenges are decided automatically by an independent replay.

POST /v1/oracle/attestations · POST /v1/oracle/attestations/{id}/challenge  
 Bonded — PAX from your platform balance

Copy trading

#### Copy-trading / strategy provider

Run each strategy in its own subaccount slot with its own balance and positions, or let a strategy provider trade your account as an approved trading agent with per-order, 24h, market and slot limits.

POST /v1/subaccounts · POST /v1/subaccounts/transfer · subaccount_slot on POST /v1/orders  
 POST /v1/delegations (portal + 2FA) · on_behalf_of on POST /v1/orders

Operator

#### White-label operator

Wrap the API under your own brand for your end-users, keep your treasury separate, route to PAX for liquidity. The `operator` track auto-provisions a live key instantly, same as every other track.

Full endpoint set + operator_id tagging  
 operator track — instant key, no signed agreement

## 4. Builder tier & benefits

One automatic ladder governs a builder account — the `tier` field on the the builder registry record:

`self_serve` → `read_live` → `trade_capped` → `trade_full` → `genesis` → `partner`

Every step is granted automatically — 30-day volume thresholds for most tiers (see §3 above), and `genesis` is the live top-20 by 30-day attributed volume, auto-granted and auto-revoked. There is no separate status to negotiate and no human sign-off at any step. In the table below, **Verified** means any active builder (tiers `self_serve`…`trade_full`), **Genesis** the current top-20, and **Partner** the `$1,000,000` 30-day-volume tier.

|  | Verified (default) | Genesis (top 20 by volume) | Partner ($1M 30d volume) |
|---|---|---|---|
| Portal + API keys | ✓ | ✓ | ✓ |
| Full endpoint access | ✓ | ✓ | ✓ |
| MCP endpoint | ✓ | ✓ | ✓ |
| [App connections](https://docs.predictasiax.com/builders#app-connections) (trade for your users) | ✓ | ✓ | ✓ |
| API rate limits | Identical published fair-use limits at every tier — see [Rate Limits](https://docs.predictasiax.com/rate-limits) |  |  |
| Featured on /builders | — | ✓ | ✓ |
| [Weekly PAX rewards](https://docs.predictasiax.com/builders#grants) | ✓ | ✓ | ✓ |
| Uncapped notional | At `trade_full` ($50k 30d) | ✓ | ✓ |

## 5. PAX for builders: weekly rewards

- Every UTC week (Monday 00:00 to Monday 00:00) the builder points of the week turn into PAX automatically. There is nothing to apply for.
- The week's PAX is shared in proportion to points. It is capped by the platform taker fees the week's attributed fills paid, so trading volume only to farm the reward costs more than it can earn. One account together with its subaccounts gets at most 15% of a week; the part above that is not given to anyone else.
- A week is computed only after every fill in it has been through the wash review (points of flagged fills are reversed first), about a day after the week ends. Rewards stay locked until 7 days after the week ends: an account that is closed or found colluding in that time loses them, and an account under a rewards hold stays locked until the hold ends.
- Unlocked rewards are credited to your PredictAsiaX PAX balance. `GET /v1/builders/me/points` returns `mint_status: "weekly_pax"` and `pax_rewards`: `locked_pax`, `paid_pax`, `clawed_pax` and `recent_weeks` (`week_start`, `points`, `amount_pax`, `status`, `unlock_at`).

### Grants

Builder grants are retired. Every `/v1/grants` path answers `410 GRANTS_RETIRED` to an authenticated call. Builder PAX is paid by the weekly rewards above, with nothing to apply for.

## 6. Security bug bounty

Found a vulnerability while building? Report it at [`predictasiax.com/security/report`](https://predictasiax.com/security/report). You get a report code and a private tracking link that shows each step from review to payment. Approved rewards — up to 27,000 PAX for critical issues — are sent on-chain to the Polygon wallet you give in the report. Scope, reward ranges and safe harbor: [Security & Bug Bounty](https://docs.predictasiax.com/security).

## FAQ

**Q: How long does application-to-key take?**  
 A: Seconds — for every track. The `POST /v1/apply` response body contains the live `sk_live_*` key, `genesis` and `institutional` included. There is no review queue and no admin operator in the loop. Poll the application record via `GET /v1/apply/{ba_id}`.

**Q: Can I go straight to production without an application?**  
 A: `POST /v1/sandbox-keys` gives you an anonymous `sandbox`-tier key in 30 seconds (no application, no email, no signup — see [/sandbox](https://docs.predictasiax.com/sandbox/)). The `sandbox` tier is capped at $10/order + $100/day, and the key expires 30 days from mint. Higher tiers (`read_live`, `trade_capped`, `trade_full`, `partner`) are reached automatically as your 30-day volume grows — no application step gates them. An application just gives you a persistent, org-tagged key with attribution wired in.

**Q: What tier do auto-provisioning tracks start on?**  
 A: `self_serve` — one rung above an anonymous sandbox key. The application flow gives you a persistent, org-tagged key with attribution wired in, and lifts the caps from sandbox's $10/order + $100/day to **$100/order + $1,000/day**. Higher tiers are reached automatically as your 30-day volume grows (see below).

**Q: How does tier auto-graduation work?**  
 A: A background cron scans the builder registry every 15 minutes and auto-graduates builders on their 30-day volume: fills routed through your builder (`execution_builder_id` attribution) plus the fills of your own builder account and subaccounts. A fill between two of your own accounts, or with an account sharing your builder account's email or wallet, is not counted. Volume thresholds:   `self_serve` → `read_live` — **$100** 30d volume `read_live` → **`trade_capped`** — **$1,000** 30d volume `trade_capped` → **`trade_full`** — **$50,000** 30d volume (uncapped notional) `trade_full` → **`partner`** — **$1,000,000** 30d volume   Every step is automatic — **no admin sign-off anywhere**. `genesis` is handled separately: it is granted automatically to the top **20** builders by 30-day attributed volume and auto-revoked when you drop out of the top 20 — it carries uncapped API keys and 1.5× builder points (request rate limits are identical at every tier), so it is a live ranking, not a volume milestone. Every graduation writes to the `builder_attribution_log` audit trail; you can watch your own progress via `GET /v1/builders/me/tier-progress`. If you provided an email during application, you receive a notification. A 24-hour dedup window prevents the same builder from being graduated multiple times in a day.

**Q: How do I independently verify an attributed fill?**  
 A: Every fill routed through your app becomes a hash-chained `financial_event` row that is periodically Merkle-batched and anchored. To verify: (1) get the `audit_seq` field from the `POST /v1/orders` response body (added at the time of the fill), (2) call `GET /v1/audit/proof/{seq}` which returns `{ leaf, root, proof: [siblings], anchor }` plus a minimal verifier JS snippet, (3) run the snippet locally or in your build to prove `leaf → root`. No PAX cooperation required — the `anchor` field points to the batch's off-platform anchor. See [/verify](https://docs.predictasiax.com/verify) for a 4-language interactive verifier + [Fee Architecture / financial_event taxonomy](https://docs.predictasiax.com/fee-architecture#events) for the ledger schema.

**Q: Do `genesis` / `institutional` tracks get special treatment at application time?**  
 A: No. Every track returns the same instant `self_serve` key — the track is an attribution label and starting context, not a capability grant. There is no review, no admin operator, and no signed document anywhere in the flow. `genesis` is earned afterwards as a live top-20 ranking (uncapped API keys and 1.5× builder points); `institutional` is just a track label — its key still climbs the same volume ladder as everyone else.

**Q: I'm building for an operator (white-label). What's different?**  
 A: Use the `operator` or `institutional` track — both auto-provision a live key instantly, same as every other track. The track is an attribution label; capability still climbs via the volume ladder (§3). There is no separate agreement to sign.

**Q: Do I need to provide a contact channel?**  
 A: It's optional — the key issues without one. An email on the application gets you auto-graduation notification emails and a status-poll record; a Telegram / Signal / Discord / Matrix handle in the `description` helps us feature you in the [builder directory](https://docs.predictasiax.com/directory). Nothing is required to receive the key itself.

**Q: How do builders earn PAX?**  
 A: Through the weekly rewards: your builder points turn into PAX every UTC week, automatically. Grants are retired. See [PAX for builders](https://docs.predictasiax.com/builders#grants).

[→ Request access](https://docs.predictasiax.com/request-access) [Try sandbox first](https://docs.predictasiax.com/sandbox/)

Source: https://docs.predictasiax.com/builders
