Who this is for
Your backend calls the PredictStreet integrator API. Examples:- Market-maker bot quoting a pre-approved wallet
- Copy-trading service mirroring strategy signals
- Data pipeline pulling your positions / fills into a warehouse
- Mobile backend that never ships secrets to the device
core.api.dev.predictstreet.sde.adifoundation.ai) is designed for
server-to-server traffic. Retail users sign in on the web app
(app.dev.predictstreet.sde.adifoundation.ai on testnet); that login
is outside the scope of this documentation. A signed-in user can also
create a key for their own account and trade from a bot: see
Self-service keys.
Format
Only a SHA-256 hash of
secret (peppered with a server-side salt) is
stored. If our database leaks, your secret does not.
Partner kinds
Every partner is one of two kinds. The kind is set at partner creation and decides where the request’s acting wallet comes from.
Kind belongs to the partner, not to individual keys, so every key
under a partner behaves the same way. Operations can change a
partner’s kind, its
requirePerWalletKyc setting or its associated
wallet only after all of its active orders:write / vault:write
keys are revoked.
A multi_wallet key with orders:write is issued only to a partner
registered as a market maker with at least one active registered
trading wallet.
Compliance toggle on multi_wallet
Multi_wallet partners come in two compliance flavours, set by therequirePerWalletKyc boolean on the partner record:
Single_wallet partners always enforce KYC at API key creation time
(the partner’s
associatedWallet must be APPROVED tier ≥ 1 before
any write-scope key issues), so the toggle is inert there.
single_wallet flow
Send the API key, nothing else. TheassociatedWallet on the partner
record is the request’s effective wallet for KYC, compliance, and
rate-limit buckets. Any X-User-Wallet header is ignored.
If a single_wallet partner has no associatedWallet attached yet,
every authenticated endpoint rejects with 401
api_key_no_associated_wallet — admin must attach one before writes
or /me reads work.
multi_wallet flow
Send the API key plusX-User-Wallet: 0x… on every request:
- Header missing → 401
api_key_user_wallet_required. - Header malformed (not
0x+ 40 hex) → 401api_key_user_wallet_invalid. - Wallet binding & account status: In enforce mode (default), the
X-User-Walletaddress must be bound to the partner organization inadmin.partner_wallets. An unbound wallet, or a wallet whose account is closed, blocked, deleted, or banned, returns a neutral 403account_unavailable({ "code": "account_unavailable", "message": "This account is not available." }). This ensures third parties cannot probe or enumerate valid user accounts. A WebSocket handshake refused because the wallet is not bound closes with4401 api_key_user_wallet_unavailable, and one with a closed, blocked or banned account with4401 account_unavailable. An open socket whose wallet stops being bound closes with4403 api_key_user_wallet_unavailable. - KYC enforcement on the header wallet is controlled by the partner’s
requirePerWalletKycflag (see Partner kinds table above). Two options:-
requirePerWalletKyc: true(default) — every X-User-Wallet sub-account must clear retail KYC (statusAPPROVED, tier ≥ 1) via the same SumSub flow a retail user goes through. Used for sub-account models where each underlying wallet is a distinct person. -
requirePerWalletKyc: false— the partner is KYB-onboarded as a legal entity and takes compliance responsibility for its sub-accounts. Per-wallet KYC is not checked. Used for trading firms / market makers / submitters whose addresses are operational, not retail identities. The first request through the key for a previously unseen X-User-Wallet auto-enqueues:- vault deploy (
VaultFactoryon-chain, ~10 sec to confirm); - on-chain limits opening —
DepositLimitRegistry.setTier(VIP)andsetCustomCaps(0, 0, 0), plussetDepositsRestricted(false)/setTradingRestricted(false)/setWithdrawalsRestricted(false).setCustomCaps(0, 0, 0)clears any per-wallet override, so the VIP tier applies: no on-chain deposit ceiling on singleDeposit / 30d / 12m. PredictStreet broadcasts all five ops; the sub-account is fully usable end-to-end (deposit + trade + withdraw) within ~30 sec of the first request. Without this auto-step the wallet would stay at tierNONE: everyvault.depositERC20would revert withKycRequired, and trading and withdrawals would be blocked on-chain.
vault_not_deployed. While the on-chain limits are still confirming, orders may also be rejected withkyc_blocked. Retry after a few seconds. Need a per-sub-account deposit cap? Contact your integration manager. - vault deploy (
-
- Each acting wallet still needs its own private key to sign the EIP-712
payload on writes. The on-chain
CTFExchangeandVaultcontracts verify the signer ↔ vault binding, so theX-User-Walletheader alone cannot authorise a trade for a wallet you don’t control. - Each
X-User-Walletis the order’s signer. Sign the EIP-712 order with that wallet’s private key and put its address in the struct’ssignerfield. The struct’smakermust be that wallet’s vault of the market’s generation (GET /api/me/vaultvaults[]), withsignatureType: 1(VAULT). It is never the EOA itself, andsignatureType: 0is not accepted. - The REST body
makermay be either theX-User-Walletaddress or its vault. Any other value is rejected at the gateway withmaker_mismatch(HTTP 401 on/api/orders/place, a per-entryREJECTEDon/api/orders/place-batch). - If the signature is not in canonical 65-byte
(r, s, v)form (v = 27or28and lows;RND-2432) or does not recover to theX-User-Walletaddress (for example, because it was signed withmakerset to the EOA or withsignatureType: 0), placement returnsstatus: "REJECTED"withcode: "bad_signature". Non-canonical byte encodings carrydetails: { expected_signer, signature_form }; canonical 65-byte signatures carrydetails.platform_canonical_structwith the exact struct the platform verified so you can compare it field by field with the struct you signed.
Getting a key
There are two kinds of key. Partner keys (this section) are issued by PredictStreet ops via the admin panel. Self-service keys are created by a signed-in user for their own wallet on the web app’s API-keys page: see Self-service keys below. For a partner key, contact your integration manager with:- Partner name — internal label.
- Contact email — for rotation notices, incident pages, and SLA comms. It is also subscribed automatically to maintenance emails when your account is created, so give an address your on-call watches.
- Partner kind —
single_wallet(default) ormulti_wallet. Pickmulti_walletif one key needs to act across many wallets (trading desk with N sub-accounts). See Partner kinds above, including the market-maker requirement fororders:write. - Associated wallet — required for
single_walletpartners that need write scopes; the wallet must have signed in to the web app at least once and cleared KYC tier 1. Formulti_walletpartners the REST API ignores it. On/ws/userit is used only when the upgrade names no wallet: anX-User-Walletheader (orwallet=/user_wallet=query parameter) takes precedence (RND-4958). - IP allowlist — not offered at the moment. Do not request one:
the platform cannot yet match your egress IP reliably behind its
edge, so an allowlisted key would be refused on every call
(
api_key_ip_denied). Protect the key by keeping the secret server-side and requesting only the scopes you need. - Requested scopes — what endpoints you plan to hit (see table below).
Self-service keys (your own account)
A signed-in user can create keys for their own wallet on the web app’s API-keys page (GET / POST /api/me/api-keys, plus regenerate and
revoke). These routes take the web-app session only: a key cannot
create, regenerate or revoke keys.
- Bound to your wallet. The key acts on your own wallet only (like a
single_walletpartner key); noX-User-Walletheader is needed. - Permissions.
read(portfolio:read,orders:read),trade(orders:write),withdraw(withdraw:write),vault(vault:migrate,positions:write) andpositions(positions:writealone: split / merge / convert / redeem on your vaults, without vault create / upgrade or the USDC move). A key holding both lists asvault. A key withwithdrawcan be created only for a registered, unblocked wallet with full ID verification (403 kyc_required/wallet_blocked/wallet_not_registered), and withdraws only if it was created after that verification. Using any key still runs the KYC gates of the route it calls. Partner-only routes (for exampleGET /api/platform/status) answer403 partner_key_required. - Expiry and limits. 30, 90 or 365 days, or no expiry; at most 10 keys that are not revoked per account (an expired key counts until you revoke it). The secret is shown once, on creation or regeneration.
- Accounts managed by a partner (signed in through a partner’s app)
cannot create keys:
403 api_keys_unavailable_for_partner_accounts. - Platform freeze and staff wallets. Creating and regenerating a key
are write actions (
RND-3925): while a platform-wide freeze is on they answer503 platform_frozenwithretryAfterSec60 (Retry-After), and a staff wallet gets403 employee_trading_prohibited. Listing and revoking keys are not affected. - Location checks apply. Unlike partner keys, a self-service key gets the geo check on order placement and money-moving routes: see Geo handling.
- A staff block revokes your keys for good (
RND-2752). When PredictStreet staff block your account or suspend its sign-in, every self-service key of the account is revoked: the key then answers401 api_key_revoked, its open WebSockets are closed, and your app sessions are signed out. Lifting the block does not bring them back: sign in again and create new keys. While such a block is active, a key cannot be created (account_blocked). A block the platform applies on its own, and an account closure, revoke no keys.
Trading by API with an email or Google wallet
If you signed up with email or Google, your account uses an embedded wallet. A self-service key lets a bot read your data and send requests, but it does not sign anything:- Every order needs your wallet’s own EIP-712 signature. The key
authenticates the request; the order itself must be signed by your
wallet (see EIP-712 signing).
PredictStreet does not sign orders for you and offers no server-side or
delegated signer, so a bot can place orders only if it can produce that
signature for your wallet. Reads and cancels need only the key (with the
read/tradepermission). - Moving money out (withdrawals, vault transfers) also needs your wallet’s signature, as for every key.
- The bot’s network matters. Order placement and money-moving
requests from a blocked country, a VPN, Tor or a data-center / hosting
IP (a typical cloud server) are refused with
403 geo_blocked; see Geo handling. - Accounts created through a partner’s app cannot create keys (see above).
Scopes
Each key carries a set of scopes. Requests are rejected with 403api_key_scope_missing if the endpoint requires a scope the key
doesn’t carry.
Where the table below says “or”, any one of the listed scopes is enough.
positions:write and vault:migrate work only on single-wallet keys; a
multi_wallet key needs vault:write on those routes (and portfolio:read
or vault:write on GET /api/me/vault). For most partners, orders:write + orders:read +
portfolio:read covers the day-one scope.
Vault generation 2 adds the
vault:migrate and positions:write scopes (vault permission on self-service keys; positions grants positions:write alone). See API keys and WebSocket.Endpoint coverage
Authenticated endpoints
RequireX-Api-Key with the listed scope.
Public endpoints
No authentication required. Any rate limit on these endpoints is per source IP. AnX-Api-Key header is ignored here and does not raise it:
GET /api/markets,/api/markets/{slug},/api/markets/{symbol}/orderbook,/api/markets/{symbol}/trades,/api/markets/{symbol}/ohlcGET /api/events,/api/events/{slug},/api/events/featured,/api/events/statsGET /api/tagsGET /api/platform/contracts,/api/platform/fee-configGET /api/compliance/geoGET /health,/ready
GET /api/platform/status and GET /api/platform/notices were on this list
until 2026-10-13. They now require a partner API key — they report what is
down and why, which is not something we publish to the open internet. See
Maintenance notifications.WebSocket
Both WebSocket gateways authenticate with the sameX-Api-Key as
HTTP — send either the X-Api-Key header on the upgrade or a
?key=<token> query parameter (for browser clients that can’t set
headers on the WebSocket upgrade). For multi_wallet keys on /ws/user,
send the acting wallet in the X-User-Wallet header, or via the
?wallet=<address> or ?user_wallet=<address> query parameter.
WebSocket close codes
The gateway closes failed connections with structured close codes and reason strings:Not available via API key
A small number of surfaces are intentionally not exposed to integrators — they require a signed-in web-app user session and live on the web app (app.dev.predictstreet.sde.adifoundation.ai on testnet).
These include the
self-service profile / consent / KYC submission flows: partners
shouldn’t drive end-user identity capture from server-side because
SUMSUB and the geo-fingerprinting layer expect the live retail
session.
Withdrawals are fully partner-driven via API key (request,
list, detail, cancel) — the vault-owner EIP-712 signature still gates
funds movement, so an API key alone cannot move money out of a vault.
See Withdrawals overview for the
dual-signature flow.
If you have a use case that needs something currently outside the
API-key scope, reach out — some can be unlocked with a stricter scope
set, others are architecturally out of scope.
Making a request
single_wallet partner:X-User-Wallet:
What happens on every request
-
Parse the
X-Api-Keyheader into(env, keyId, secret). Bad shape → 401api_key_bad_format. -
Lookup the key by
keyId. Unknown → 401api_key_unknown_key. -
Verify the hash in constant time. Mismatch → 401
api_key_bad_secret. -
Lifecycle checks: revoked → 401
api_key_revoked; expired → 401api_key_expired; partner suspended → 401api_key_suspended; source IP not in allowlist (if set) → 401api_key_ip_denied. -
Resolve effective wallet — depending on partner kind:
single_wallet→partner.associatedWallet. Not attached → 401api_key_no_associated_wallet.multi_wallet→ theX-User-Walletheader (lower-cased). Header missing → 401api_key_user_wallet_required; not a 0x-prefixed 40-hex address → 401api_key_user_wallet_invalid.
GET /api/platform/status,/notices,/maintenance) skip this step: they need noX-User-Wallet. -
Account status & wallet binding checks:
- For
single_wallet: Associated wallet must not be banned, blocked, closed, or deleted (returns 401wallet_banned,account_blocked,account_closed). - For
multi_wallet: TheX-User-Walletaddress must be bound to the key’s partner in enforce mode, and the account must not be banned, blocked, closed, or deleted. Any failure returns a neutral 403account_unavailable({ "code": "account_unavailable", "message": "This account is not available." }).
- For
-
Scope check. Missing → 403
api_key_scope_missingwith the required scope in the response body. - Set identity — the resolved wallet becomes the request’s effective wallet for all downstream checks (KYC, compliance, rate-limit buckets, audit trails).
Rate limits
API-key requests are counted in two kinds of independent bucket:- IP bucket — shared edge defence (same as anonymous traffic).
- Wallet bucket — per effective wallet (the
associatedWalletfor single_wallet, or theX-User-Walletheader value for multi_wallet). Same ceiling regardless of call volume distribution across your keys.
Retry-After set to that bucket’s
wait. The X-RateLimit-Limit / -Remaining / -Reset headers
describe the endpoint’s own bucket (the wallet bucket where one
applies), not necessarily the tightest one.
Your partner record’s rate tier (rateLimitPerMin, default 600)
scales every wallet bucket your keys hit (except that the 2FA limits
under /api/me/withdrawal-security/totp/*, and the shared portfolio
bucket on the /api/me/* portfolio routes, are never raised above the
listed values; the vault-transfer routes that share that bucket are
still raised: see the shared-bucket row in
Rate limits), and the per-partner buckets
of the partner trade endpoints
and of GET /api/platform/status, /notices and /maintenance:
effective limit =
floor(listed limit × rateLimitPerMin / 600), minimum 1. 600
applies the published limits as-is and 1200 doubles them, apart from
those exceptions. IP
buckets are never scaled. To change your tier, contact your
integration manager. See Rate limits for the
per-endpoint table.
Geo handling
Geographic blocking (FATF blacklist / greylist) does not apply to partner-key requests — integrator egress IPs are data-centre / VPN class and blocking them isn’t a meaningful control (you could proxy trivially). Self-service keys are different. A key a user created for their own account is held by that user, not an integrator. On the routes that run the geo check (order placement:POST /api/orders/place, /place-batch;
and money-moving routes: withdrawals, deposits, vault operations, redeem),
its requests get the country check and the VPN / Tor / hosting check:
requests from a blocked country, a VPN, Tor or a data-center / hosting IP
are refused with 403 geo_blocked, even from an allowed country. Reads
and cancels have no geo check. Run such a bot from a
non-hosting IP in an allowed country. For a bot that must run on a
server, ask support: compliance can exempt one key from the hosting rule
(the VPN, Tor and country checks still apply; the exemption stays with
the key when its secret is regenerated). Cancelling orders
(/api/orders/cancel, /cancel-batch, /cancel-all) has no geo check
for any caller.
When the check cannot be completed for a self-service key’s request, the
request is refused rather than let through:
503 geo_check_unavailable: the country of the IP cannot be looked up and no earlier country is known for it.503 vpn_check_unavailable: the VPN / hosting lookup is unavailable and no earlier result is known for the IP; or the IP is a hosting IP and whether the key is exempt from the hosting rule could not be read; or the limit on lookups of new IP addresses has been reached.
retryAfterSec: 60 (also sent as the Retry-After header) and
the message “Location checks are temporarily unavailable. Please retry
shortly.” The limit on new IP addresses counts distinct addresses not
seen recently, per wallet per UTC hour, per wallet per UTC day, and
platform-wide per UTC day. Addresses already in use keep working, but
once a limit is reached, requests from further new addresses are refused
until the next UTC hour (the per-wallet hourly limit) or the next UTC day
(the daily limits), whatever retryAfterSec says. The response does not
say which of these causes applies, so run the bot from a stable address. A
403 geo_blocked takes precedence over both 503s when the country, or
the VPN / Tor / hosting check, already refuses the request; when both
lookups fail, the answer is geo_check_unavailable.
For partner keys, compliance stays in force at the wallet level via
KYC / AML / RG gates on the effective wallet: the partner’s
associatedWallet for single_wallet, or the X-User-Wallet
sub-account for multi_wallet. Per-wallet KYC is waived only for
multi_wallet partners with requirePerWalletKyc: false, where the
KYB-onboarded partner takes that responsibility.
Rotation
Rotate keys pre-emptively on any of:- Employee who had access leaves.
- Secrets-manager misconfiguration suspected.
- Source-code leak.
- Routine 6-month rotation hygiene.
- Issue the replacement key via admin. Both keys now work.
- Roll your services to the new key. No downtime.
- Revoke the old key via admin. Propagation is near-instant; worst-case lag 60s.
api_key_revoked. Re-enabling is not supported — issue a new key.
Security invariants
- X-Api-Key is the only scheme for partner integrations. No
cookies, no basic-auth fallback on
core.api.dev.predictstreet.sde.adifoundation.ai. The API also acceptsAuthorization: Bearertokens, but those are web-app user session tokens, not a partner credential. If both are sent,X-Api-Keywins. A request with neither on an authenticated endpoint gets 401auth_required; a malformed key gets 401api_key_bad_format. - Scopes are enforced server-side. Adding a scope to your key’s stored list is the only way to access a gated endpoint — client-side claims are ignored.
- Writing still requires EIP-712. The API key proves you’re a
pre-approved partner; the EIP-712 order signature proves you
authorised the specific trade.
CTFExchangeverifies this cryptographically on-chain — no compromise of our infrastructure lets anyone move your funds without your private key.