Partner API Specification
September 2026 B2B specification, integration fundamentals, product reference, and clarifications for the current online API contract.
Explore endpoints
2 of 2/trade
Place trade
Full endpoint documentationcreateTradePlaces a BUY or SELL order on your own partner account (not a sub-account — use /users/{userId}/trade for those). Sandbox master trading is unsupported and returns HTTP 422; use POST /users/{userId}/trade with a funded sandbox sub-account instead. BUY — escrows USD from your master wallet. Settlement is T+3 for most African exchanges. SELL — requires you to hold the shares. Proceeds are credited on settlement. Pass Idempotency-Key to make retries safe. The same key returns the cached order within 24 h.
Parameters
This endpoint has no path or query parameters.
Headers
AuthorizationstringRequiredBearer sk_sandbox_<your_key> for sandbox requests.
Idempotency-KeystringheaderRequiredUnique string that makes write calls safe to retry on network failure. Required for money movement, trading, KYC, subscriptions, and webhook creation. Deduplicated for 24 hours -- duplicate keys return the cached response. HTTP 409 if a concurrent request with the same key is still in progress.
Example: dep_user42_1743152580
Request body
fundingWalletCurrencystringConvert explicitly to USD before submitting an order
symbolstringRequiredStock symbol. Accepts exchange-qualified (SCOM.KE, DANGCEM.NG) or bare ticker (SCOM) -- auto-resolved when unambiguous. Returns 422 with match list if ambiguous.
Example: "SCOM.KE"
typeBUY | SELLRequiredOrder direction.
Example: "BUY"
quantitynumberNumber of shares. Whole-share markets require integer quantities; fractional-enabled markets allow up to 6 decimal places. Mutually exclusive with cashValue.
Example: 500
cashValuenumberUSD notional amount for cash-mode fractional investing. Mutually exclusive with quantity and must match the cashValue used to obtain quoteId for MARKET orders.
Example: 50
quoteIdstringFresh pre-trade quote ID from GET /quote/{symbol}. Quotes expire after 60 seconds and can be used once. Required for MARKET orders, including the default when orderType is omitted; ignored for LIMIT/STOP/STOP_LIMIT.
Example: "qt_2f4d5a7b8c9e4f01a2b3c4d5e6f78901"
orderTypeMARKET | LIMIT | STOP | STOP_LIMITMARKET (default): quote-gated and routed to automatic MyStocks internal-book execution. LIMIT/STOP/STOP_LIMIT are resting orders — they are placed WITHOUT a quote, escrow at the trigger price, rest in status WORKING, and route to automatic internal-book execution when the latest delayed price observation crosses the trigger (during market hours). BUY LIMIT fills at/below limitPrice; SELL LIMIT at/above; BUY STOP triggers at/above stopPrice; SELL STOP at/below. Prices are in the stock's LOCAL trading currency. Fires order.triggered on activation.
limitPricenumberLocal-currency limit price. Required for LIMIT and STOP_LIMIT.
stopPricenumberLocal-currency stop/trigger price. Required for STOP and STOP_LIMIT.
clientOrderIdstringOptional partner-supplied order reference. Must be unique per partner when supplied.
Example: "partner-ord-10001"
timeInForceDAY | GTC | GTDOrder validity instruction, enforced by the OMS lifecycle daemon. GTC (default) keeps the order live until executed or cancelled. DAY orders auto-cancel if not executed within 24 hours; GTD orders auto-cancel at expiresAt. On expiry, BUY escrow is refunded, SELL reservations are released, and an order.cancelled webhook fires. IOC is not supported by the current MyStocks internal-book order contract.
expiresAtstringRequired for GTD orders. Stored for OMS expiry governance.
orderInstructionstringOptional free-text execution instruction for the MyStocks internal-book engine.
stopLossnumberOptional. Order auto-cancels if the stock falls below this USD price before settlement.
Example: 0.11
takeProfitnumberOptional. Order auto-settles if the stock rises above this USD price before settlement.
Example: 0.16
Response fields
orderIdstringUnique order ID. Use to poll status or cancel.
Example: "ord_abc123xyz"
symbolstringExample: "SCOM.KE"
namestringExample: "Safaricom PLC"
exchangestringExample: "NSE"
orderTypeMARKET | LIMIT | STOP | STOP_LIMITOrder type. MARKET orders are quote-gated; LIMIT/STOP/STOP_LIMIT rest as WORKING until triggered.
Example: "LIMIT"
limitPricenumber | nullLimit price in the stock's local currency (LIMIT / STOP_LIMIT only).
stopPricenumber | nullStop price in the stock's local currency (STOP / STOP_LIMIT only).
cancelablebooleanWhether the order can be cancelled now (DELETE). True while PENDING or WORKING.
replaceablebooleanWhether the order can be modified now (PATCH). True only for a WORKING resting order.
typeBUY | SELLstatusPENDING | WORKING | PARTIALLY_FILLED | PROCESSING | COMPLETED | FILLED | REJECTED | CANCELLED | EXPIREDPENDING after submission. WORKING = resting LIMIT/STOP/STOP_LIMIT order waiting for its trigger price (becomes PENDING on trigger). PARTIALLY_FILLED and FILLED are the canonical execution states. REJECTED, CANCELLED, and EXPIRED are terminal outcomes. PROCESSING is a legacy transition alias and COMPLETED is a v1 compatibility alias of FILLED; neither represents custody settlement. Settlement is tracked separately as PENDING, SETTLED, or FAILED.
quoteIdstring | nullPre-trade quote ID consumed by this order.
quoteExpiresAtstring | nullquoteUsdPricenumber | nullclientOrderIdstring | nullPartner-supplied order reference.
omsStatusstring | nullCanonical OMS lifecycle status.
timeInForcestring | nullfilledQuantitynumberremainingQuantitynumberaverageFillPricenumber | nullexecutionVenuestring | nulllastExecutionReportIdstring | nullexecutionSlaunionLive execution SLA clock for orders that have entered the PENDING dealing-desk queue. Null while a resting order is still WORKING.
quantityintegerpriceAtOrdernumberStock price in local currency at submission.
usdPriceAtOrdernumberUSD equivalent of priceAtOrder.
fxRateAtOrdernumber | nullManaged FX rate used for local-to-USD conversion at order submission.
fxSourcestring | nullfxRateAsOfstring | nullfxConversionunionfeenumberTotal fee in USD (base + partner markup).
baseFeenumberMyStocks base broker fee (0.75% of gross).
partnerMarkupFeenumberYour markup fee component. Zero if markupBps = 0.
totalAmountnumberBUY: gross + fee. SELL: gross - fee.
currencystringExample: "USD"
localCurrencystringExample: "KES"
rejectionCodestring | nullStructured rejection code. Populated when status = REJECTED.
rejectionReasonstring | nullFree-text rejection detail provided by the MyStocks internal-book execution service. Populated when status = REJECTED.
cancelledAtstring | nullsettledAtstring | nullSet when custody settlement completes; independent of the canonical FILLED execution state. Legacy completed records that pre-date this field return their immutable completion/creation timestamp as compatibility evidence.
createdAtstringcanonicalStatusPENDING | WORKING | PARTIALLY_FILLED | FILLED | REJECTED | CANCELLED | EXPIREDsettlementStatusPENDING | SETTLED | FAILEDorderLifecyclestring | nullEXPIRED for expiry; expiry is not a rejection.
cancelReasonstring | nullResponse codes
201Order placed.400Insufficient wallet balance.409Idempotency conflict — duplicate in-flight.422Business rule violation in production; master-account trading is not available in sandbox.The September 2026 MyStocks Partner API & Developer Platform Specification brings together eight commercial API products, their endpoint inventory, error vocabulary, webhook events, and integration requirements.
Download PartnerAPI.pdf (339 pages) · Browse all eight products · Open API Reference
Environments and authentication
| Environment | Base URL | Standard API key prefix |
|---|---|---|
| Production | https://mystocks.africa/api/v1/partner | pk_live_ |
| Sandbox | https://mystocks.africa/api/sandbox/v1/partner | sk_sandbox_ |
Send API credentials using Authorization: Bearer or x-api-key. Read-only data keys, OAuth client credentials, and Firebase-authenticated console operations have distinct scopes and requirements. Follow the authentication guide and each operation's security definition in the API Reference.
Use sandbox and paper trading for integration testing. Check the product catalog's sandbox column before calling an operation: production-only endpoints and unsupported stubs are not fully simulated.
Request safety and operational contracts
| Topic | Online guidance |
|---|---|
| Idempotency | Authentication and contract guarantees: mutation requirements, bootstrap exceptions, 24-hour replay retention, and payload mismatch handling. |
| Rate limits | Tier quotas and response headers: Starter 100, Growth 500, and Enterprise 2,000 requests per minute, with contracted custom limits where applicable. |
| HTTP errors and dealing-desk rejections | Errors: distinguish synchronous request failures from asynchronous order rejection reasons. |
| Webhook signatures and retries | Webhooks: event directory, raw-body HMAC-SHA256 verification, delivery logs, and retry behavior. |
| Event streams | Server-Sent Events: connection limits, heartbeats, replay, and reconnection. |
| Production readiness | Going live, controlled production pilot, and general availability. |
Product and endpoint reference
The product catalog covers all 203 operations across 156 route paths. Every product page includes method, path, operation ID, purpose, sandbox availability, and links to its implementation guides. The interactive reference contains request and response schemas, parameters, examples, and status codes.
The PDF's additional discovery and infrastructure section is separate from this inventory. Use OpenAPI JSON or OpenAPI YAML for public schema discovery. Partner brand discovery supports the hosted tenant experience; scheduler workers are operated by MyStocks and require internal credentials.
Clarifications for the PDF edition
The downloadable PDF is preserved as supplied. Use the following current online guidance when integrating:
| PDF wording or example | Online contract clarification |
|---|---|
| OpenAPI 3.0.3 / API version 1.0.0 | The published machine-readable specification declares OpenAPI 3.1.0, API version 1. Use the version declared in the downloaded schema. |
partners.mystock.africa and tenant examples with mystock.africa | The partner domain is partners.mystocks.africa; tenant domains use mystocks.africa. The documentation is also available at https://partners.mystocks.africa/partners/docs. |
OAuth JWT and sec_live_ secret examples | Follow the OAuth client credentials guide: the client secret is the API key; returned access tokens use ms_oauth_ and expire after 15 minutes. Do not infer a JWT format. |
| Every operation has strict sandbox parity | Per-operation OpenAPI metadata and the product catalogs identify sandbox availability and unsupported stubs. Master POST /trade and POST /payout return 422 in sandbox; trade through a sub-account instead. |
| Every mutation requires idempotency with no exceptions | Credential bootstrap and recovery operations have documented exceptions. See authentication. |
x-ratelimit-reset is in milliseconds | X-RateLimit-Reset is a Unix timestamp in seconds; Retry-After is also in seconds. |
| Per-second burst allowances | Use the published minute quotas and concurrent stream limits; the PDF's burst figures are not a separate documented entitlement. |
| Real-time market intelligence or order book analytics | African equity quotes are 15-minute delayed. Webhooks and SSE carry account and market-status events, not streaming price ticks or Level-2 depth. See market data. |
| Six webhook retries across two hours | The retry schedule contains six attempts including the initial attempt, with scheduled retry delays. See webhook delivery semantics; do not treat two hours as a guaranteed total delivery window. |
| Generated sample values | Treat examples as illustrative; required fields, enums, eligibility, authentication, and response status codes come from the operation contract. |
For signature verification, use the webhook guide's examples, including malformed-signature handling, rather than calling timingSafeEqual on unchecked buffers of potentially unequal length.
Appendices and implementation resources
- Exchanges, hours, and settlement: use market data and exchange calendars, market-status responses, and the trade lifecycle. The PDF's typical-hours table does not account for holidays or instrument-specific settlement.
- KYC: follow sub-account onboarding and KYC, AML, and sanctions. Confirm applicable limits and evidence requirements during onboarding; do not interpret the PDF's tier table as automatic approval or an unlimited trading entitlement.
- SDKs and tooling: use SDKs and developer tools for supported package names and installation instructions, and the API Tester for requests.
- Support: contact
support@mystocks.africaor use the partner support workflow.
Was this page useful?
Your signal helps us tighten partner onboarding docs.
Last updated on