Skip to main content
GET
Get the caller's referral code
The response body shown here is a static example, not live data. After you click Send, your live result appears in a separate panel headed 200 OK. The panel under the status-code tabs is a fixed sample from the spec — its field values (fees, prices, sizes, IDs, timestamps) are placeholders. Use Send, or call the endpoint, for current values.
Lightweight code-only read: returns { address, code, isAffiliate } from a single database point read — none of the volume, commission, or fee-tier enrichment that GET /v1/affiliate/info performs. Intended for UI surfaces that only need the code (e.g. an “Invite Friends” / copy-referral-link control) and may poll on every session. Unlike /info, “not an affiliate” is a valid empty state served as 200 with code: "" and isAffiliate: false — never a 404 — so callers don’t have to overload the 404 status. Signed, and scoped to the caller. address must be the API key’s master Ethereum address; looking up another wallet’s code is 403. This endpoint was public, and being both a direct address → code oracle and the cheapest route in the rate-limit table it made a referral-code → wallet reverse index cheap to build in bulk. Referral codes are meant to be shareable without disclosing the wallet behind them, so the mapping is one-way by design. The Ed25519 request signature is required because X-API-Key alone proves nothing (API keys are Ed25519 public keys, listable by anyone via GET /v1/apiKeys). With no request body the signing message is timestamp + action (action code — the path segment verbatim, casing included). Rollout: enforcement is being switched on per-environment behind AFFILIATE_READ_AUTH_SHADOW_MODE. While an environment is still in shadow this endpoint answers exactly as it did when it was public — unsigned reads succeed and 401/403 are not returned. Send the signature regardless (it is required everywhere eventually); just do not rely on a rejection to tell you it is wrong. The affiliate.read_auth{result} metric shows what an environment is actually doing.

Authorizations

X-API-Key
string
header
required

Hex-encoded Ed25519 public key (64 chars). The public key IS the API key — register it via POST /createApiKey. Required on every authenticated request, both read-only and signed.

X-Timestamp
string
header
required

Unix time in nanoseconds as a decimal string (e.g. "1713825891591000000"). Millisecond or second epochs are rejected with 401 Unauthorized. Must be within ±30,000 ms (MaxTimestampDriftMs, the drift window stays configured in milliseconds) of server wall-clock, or the request is rejected with 401 Unauthorized. Required on all mutating / credential-creating endpoints. This same value must appear as the ct field in the ordersign typed canonical payload (single-order endpoints) or in each element's ct field (batch endpoints).

X-Signature
string
header
required

Lowercase hex-encoded Ed25519 signature (128 chars).

Single-order endpoints (placeOrder, cancelOrder, modifyOrder, and other non-batch mutating routes) sign over the ordersign typed canonical payload — a compact, key-sorted JSON object built from parsed request fields using engine-native integer values:

ct must equal the X-Timestamp header value. Keys in brackets are conditional (omitted when empty). op values: 1=place, 2=cancel, 3=modify. See the ordersign package for field definitions and reference signing code.

Other signed routes (e.g. createApiKey, tokens, userPreferences) still use the legacy scheme: signing_message = X-Timestamp + ACTION + canonicalJSON(body), where ACTION is the camelCase final path segment.

Batch endpoints (batchPlaceOrders, batchCancelOrders, batchModifyOrders) do NOT use this header. They authenticate with per-element typed ordersign signatures embedded in the request body (see the global auth description and the per-field signature descriptions on OrderRequest / CancelOrderRequest / ModifyOrderRequest).

Read endpoints are authenticated by ?address= (and optionally X-API-Key) only — no signature is required. The one exception is GET /v1/affiliate/inviteCodes, which returns bearer secrets and therefore requires the full header triple; with no body its signing message is X-Timestamp + ACTION. canonicalJSON(body) is the JSON body with object keys sorted lexicographically at every level and no whitespace; the server canonicalizes the received body before verifying, so only the bytes signed over must be canonical. Required on all mutating / credential-creating endpoints.

Query Parameters

address
string
required

Ethereum address to look up. Must match the API key's master address.

20-byte EVM address as hex: optional 0x or 0X prefix and exactly 40 hexadecimal digits. API responses normalize to lowercase af after 0x.

Pattern: ^(0x|0X)?[0-9a-fA-F]{40}$

Response

Referral code lookup result (including the non-affiliate empty state).

address
string
required

20-byte EVM address as hex: optional 0x or 0X prefix and exactly 40 hexadecimal digits. API responses normalize to lowercase af after 0x.

Pattern: ^(0x|0X)?[0-9a-fA-F]{40}$
code
string
required

The address's referral code. Empty string when the address is not a registered affiliate, or is an affiliate whose code was revoked / never created.

isAffiliate
boolean
required

True when the address has an affiliate state row (registered affiliate), regardless of whether it currently owns a code. False for addresses that never registered — served as 200, not 404, so clients can poll cheaply without treating the common "not an affiliate" case as an error.