SSE Events
Subscribe to MyStocks Server-Sent Events for order, wallet, KYC, dividend, market, and incident updates.
Explore endpoints
43 of 43/account
Get partner account
Full endpoint documentationlistAccountReturns your partner profile — tier, wallet balance, API key metadata, and feature flags.
Parameters
walletContract1 | 2queryOpt in to actual currency wallets. Legacy indicative views remain unchanged.
Example: 1
Headers
AuthorizationstringRequiredBearer sk_sandbox_<your_key> for sandbox requests.
Response fields
accountIdstringbusinessNamestringemailstringwalletobjectwallet.currencystringExample: "USD"
wallet.balancenumberwallet.reservednumberwallet.availablenumberwalletContractVersion1 | 2walletModelUSD_LEDGER_WITH_INDICATIVE_EQUIVALENTS | NATIVE_CURRENCY_WALLETSsupportedConversionCurrenciesstring[]currencyWalletsobject[]currencyWallets[].currencystringcurrencyWallets[].balanceKindstringcurrencyWallets[].cashBalancenumbercurrencyWallets[].reservednumbercurrencyWallets[].externallyReservednumbercurrencyWallets[].totalCashnumbercurrencyWallets[].availablenumbercurrencyWallets[].withdrawablenumbercurrencyWallets[].availableForConversionnumbercurrencyWallets[].policyEligiblebooleancurrencyWallets[].internalTransferAvailablenumberTraceable available funds for internal transfers
currencyWallets[].nativeFundingEnabledbooleancurrencyWallets[].nativePayoutEnabledbooleancurrencyWallets[].conversionEnabledbooleanwalletsobject[]wallets[].balanceKindstringwallets[].indicativebooleanwallets[].spendablebooleanwallets[].currencystringExample: "KES"
wallets[].balancenumberExample: 65000
wallets[].availablenumberExample: 65000
wallets[].ledgerCurrencystringExample: "USD"
wallets[].ledgerBalancenumberExample: 500
wallets[].fxRatenumberExample: 130
wallets[].fxSourcestringExample: "MYSTOCKS_MANAGED_FX"
wallets[].fxRateAsOfstring | nullmanagedFxobjectmanagedFx.ledgerCurrencystringExample: "USD"
managedFx.sourcestringExample: "MYSTOCKS_MANAGED_FX"
managedFx.rateConventionstringExample: "local currency units per USD"
managedFx.supportedCurrenciesstring[]managedFx.asOfstring | nullportfolioValuenumberinvestedCapitalnumberrealizedGainUsdnumberenvironmentproduction | sandboxpilotobjectControlled-production policy. When enabled, production mutations fail closed unless admission, ownership, feature, limit, and reconciliation controls pass.
pilot.enabledbooleanRequiredpilot.statusNOT_APPROVED | APPROVED | PAUSED | COMPLETEDRequiredpilot.operationalOwnerunionpilot.incidentContactunionpilot.manualTreasuryReviewbooleanRequiredAlways true for a controlled pilot; master-wallet top-ups and payouts remain pending until MyStocks treasury review.
pilot.featuresobjectRequiredpilot.limitsobjectRequiredpilot.reconciliationobjectRequiredpilot.readinessobjectRequiredEvidence and approvals required before mutations may resume and before the controlled pilot may complete.
Response codes
200Partner account details.401Invalid API key.GET /stream is a Server-Sent Events feed for partner-facing state changes. Use it for live application updates; use signed webhooks for durable server-to-server processing and reconciliation.
Connect
The stream uses the same partner base URL and authentication model as REST:
const source = new EventSource(
'https://mystocks.africa/api/v1/partner/stream?access_token=ms_oauth_<short-lived-token>'
);
const receive = (message) => {
const event = JSON.parse(message.data);
// Persist the business identity when processing; the cursor only tracks replay position.
console.log(event.eventId ?? event.id, event.event, event.data, message.lastEventId);
};
const businessEvents = ["order.pending", "order.triggered", "order.filled", "order.rejected", "order.cancelled", "order.replaced", "trade.settled", "trade.rejected", "deposit.confirmed", "withdraw.confirmed", "wallet.credited", "wallet.converted", "wallet.transferred", "wallet.policy.updated", "topup.confirmed", "payout.processed", "credit_limit.approved", "float.low", "kyc.updated", "account.frozen", "account.closed", "dividend.paid", "corporateaction.declared", "corporateaction.split", "corporateaction.suspension", "corporateaction.delisting", "corporateaction.rights_issue", "corporateaction.symbol_changed", "quote.expired", "price.alert", "market.status", "incident.declared", "incident.resolved"];
for (const name of businessEvents) source.addEventListener(name, receive);
source.addEventListener('stream_gap', (message) => {
source.close();
console.warn('Reconcile REST state before reconnecting:', JSON.parse(message.data));
});
source.addEventListener('stream_timeout', () => console.log('Expected reconnect; preserve the last cursor.'));Use a backend proxy for customer browsers; never expose an organization-wide trading credential as a customer session. A short-lived token is still a partner credential and must be scoped appropriately to its consumer. Refresh expired credentials on your backend and recreate the stream with the persisted cursor. For server clients, send the normal Authorization: Bearer header.
Resume and reconnect
Each frame carries an opaque timestamp:documentId stream cursor so events sharing a timestamp remain replayable. Legacy millisecond cursors are accepted. Persist the last id: value and reconnect with Last-Event-ID or ?since= after a network interruption. The connection may close after approximately 110 seconds; reconnect is expected. Heartbeat comments are sent periodically and should reset your idle timer.
id: 1842:document_42
event: order.filled
data: {"id":"document_42","eventId":"evt_42","ts":1842,"event":"order.filled","data":{...}}Replay is limited to the last hour. An older, invalid or future cursor produces a named stream_gap control frame with replayComplete: false. Reconcile current orders, transactions and holdings plus webhook delivery records before reconnecting. The stream is not an unlimited event archive.
Delivery semantics
- Events are at-least-once and can be duplicated.
- Events can arrive out of order; derive state from the event payload and current REST state.
- New frames include the same business
eventIdused by signed webhook delivery. Keep legacyidas a compatibility storage identifier. Older records without a business ID fall back toid; cross-channel deduplication cannot be assumed for those legacy records. Deduplicate business events durably, not by cursor alone. - SSE is not a tick-by-tick market-price stream.
- A stream reconnect does not replace daily reconciliation.
The same business events can be delivered through signed webhooks. See Trading lifecycles for order transitions and Daily Reconciliation for the durable operating record.
Was this page useful?
Your signal helps us tighten partner onboarding docs.
Last updated on
Webhooks
Register HTTPS endpoints for real-time event notifications, HMAC-SHA256-signed over the raw body. Full event catalogue, per-event payloads, signature-verification code (Node & Python), at-least-once delivery semantics, and the delivery log.
Reports
Read-only reporting across all sub-accounts — AUM, positions, fees, revenue, dividends, monthly invoices, dividend calendar, audit log, usage analytics, the daily reconciliation pack, per-order executions, and the unified client-activity feed. Most support ?format=csv.