MUTEX
Docs
Home
Developers · Affiliate API

Affiliate API

Pull your referral stats over REST: who signed up, what they deposited and traded, and exactly what you earned. Everything the affiliate dashboard shows, in JSON.

An affiliate key (mtx_aff_…) is read-only. It cannot trade, cannot move money, and sees only your own referrals. Base URL https://trade.mutex.exchange.

Open interactive reference live OpenAPI spec · always in sync with the deployed API
Step 1

Claim an affiliate code

You need an active affiliate code before a key can be issued - without one, key generation is 403. Claim yours on the affiliate dashboard.

Step 2

Generate an affiliate key

In the app, open Settings, then the API tab, and generate the affiliate key. It is shown once - the plaintext secret exists only in that response, so copy it then (mtx_aff_…).

There is one active key per user. Regenerating revokes the old one and replaces it; revoking is immediate. Keys never expire on their own.

Check it's wired up:

curl https://trade.mutex.exchange/v1/key \
  -H "Authorization: Bearer mtx_aff_…"
# {"kind":"affiliate","display_prefix":"mtx_aff_a1b2","bot":null,"created_at":1721480400000}

bot is null on affiliate keys - they are not bound to a sub-account. Presenting one on a trading route (or a mtx_bot_ key here) is 403 wrong_key_kind.

Step 3

Pull your totals

curl "https://trade.mutex.exchange/v1/affiliate/summary?from=2026-07-01&to=2026-07-31" \
  -H "Authorization: Bearer mtx_aff_…"
# {"from":"2026-07-01","to":"2026-07-31",
#  "signups":42,"depositors":18,"deposits_total":"91500",
#  "traders":11,"volume_total":"2450000","commission_total":"1830.51",
#  "by_avenue":{"spot":"0.04","perps":"0.011","bots":"0","farm":"0",
#               "prop_purchase":"30","prop_profit":"0"}}

commission_total is ledger-exact - it is summed from the commission ledger, not recomputed. volume_total and deposits_total are window-intersected through your attributions, so they answer “activity by users attributed to me, inside this window”.

Step 4

List your referrals

curl "https://trade.mutex.exchange/v1/affiliate/referrals?limit=50" \
  -H "Authorization: Bearer mtx_aff_…"
# {"referrals":[{"user":"3f2a…-uuid","code":"WERNER",
#                "signup_at":1721480400000,"attributed_at":1721480400000,
#                "first_deposit_at":1721566800000,"deposits_total":"5000",
#                "first_trade_at":1721570400000,"volume":"128000",
#                "commission":"96.40"}],"next_before":"…"}

One row per referred user, newest first. user is the full Mutex user id - feed it back as ?user= on any of the three endpoints to drill into that one referral. *_at fields are Unix ms or null; amounts are decimal strings.

Page with the cursor: pass the response's next_before back as ?before= until it comes back null. Default window is epoch → today, uncapped.

Step 5

Break it down by day

curl "https://trade.mutex.exchange/v1/affiliate/daily?from=2026-07-01&to=2026-07-31&limit=100" \
  -H "Authorization: Bearer mtx_aff_…"
# {"daily":[{"day":"2026-07-31","user":"3f2a…-uuid",
#            "volume":"12800","commission":"9.64",
#            "by_avenue":{"spot":"9.64","perps":"0","bots":"0","farm":"0",
#                         "prop_purchase":"0","prop_profit":"0"}}],
#  "next_before":"…"}

UTC-day buckets, newest first, one row per (day, user). The window is capped at 90 days here - a wider range is 400 invalid_request. The cursor is the opaque (day, user) pair; page it the same way.

Contract

The three endpoints

EndpointReturnsQuery
GET /v1/affiliate/referralsOne row per referred user, newest first.from · to · user · limit · before
GET /v1/affiliate/summaryWindow totals: signups, depositors, volume, commission.from · to · user
GET /v1/affiliate/dailyPer-day-per-user volume and commission (UTC day buckets).from · to · user · limit · before

from and to are inclusive UTC days, YYYY-MM-DD. limit is 1–100 (default 25). user narrows any endpoint to a single referred user id.

Contract

Commission by avenue

by_avenue splits commission by where it was earned. All six keys are always present - "0" when nothing was earned there - so you never need the list to render an empty row. The values sum exactly to the commission_total / commission beside them.

AvenueEarned from
spotSpot trading fees.
perpsPerp trading fees.
botsBot trading fees.
farmFarm fees.
prop_purchaseProp-account purchases.
prop_profitProp-desk profit splits.

A seventh key, unknown, appears only if a share was booked before avenue stamping existed (there is no backfill). Volume has no avenue and is never split.

Contract

What counts as volume

From 2026-07-29, volume is routed-order volume, not venue-fill volume - a deliberate redefinition. If you are reconciling against numbers you pulled before that date, expect them to differ.

Contract

Rate limits and errors

Affiliate routes sit in the reads bucket: 300 / min per key, fixed 1-minute window. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; over the limit is 429 rate_limited plus Retry-After. Sustained flooding auto-suspends the key.

Errors are an honest HTTP status plus { "error": { "code", "message" } }. Match on code, not prose.

CodeHTTPMeaning
service_disabled403The affiliate API is not enabled.
missing_key401No Authorization: Bearer.
invalid_key401Unknown or malformed key.
wrong_key_kind403You presented a trading (mtx_bot_) key.
key_suspended403Auto-suspended for abuse; retry after the window.
account_suspended403The owning user is disabled.
invalid_request400Bad window or params - e.g. daily beyond 90 days.
rate_limited429Reads bucket exhausted; see Retry-After.
internal_error500Unexpected; safe to retry.
Scope

Not on this API

Payouts, claiming codes, changing your split, and anything that moves money - those stay in the web app. This key reads. Full request/response schemas live in the interactive reference under the Affiliate tag.

Read-only key