# MyStocks Africa Partner API — Full Reference > MyStocks Africa provides African investment infrastructure via REST API. This is a readable integration reference. The current OpenAPI contract and documentation catalog are authoritative for the complete operation and guide inventory; curated examples here are not an exhaustive endpoint list. **Production base URL**: `https://mystocks.africa/api/v1/partner` **Sandbox base URL**: `https://mystocks.africa/api/sandbox/v1/partner` (exception: POST /register and POST /reset live at `/api/sandbox/v1` without the `/partner` segment) **Authentication**: `Authorization: Bearer pk_live_` (production) / `Authorization: Bearer sk_sandbox_` (sandbox) **Content-Type**: `application/json` for all POST/PATCH bodies **Docs**: https://partners.mystocks.africa/partners/docs **Current contract**: https://mystocks.africa/openapi.json **Guide catalog**: https://partners.mystocks.africa/partners/docs/catalog.json **Apply**: https://partners.mystocks.africa/partners --- ## Public GEO, Dataset, and Citation Assets Use these public pages when an AI assistant, search crawler, analyst, or partner needs citation-ready context outside the API reference: - Data Catalog: https://mystocks.africa/data - Answers Hub: https://mystocks.africa/answers - Methodology: https://mystocks.africa/methodology - Data Sources: https://mystocks.africa/data-sources - African Exchange Statistics Dataset: https://mystocks.africa/african-stock-exchanges/statistics - African Exchange Statistics CSV/JSON: https://mystocks.africa/african-stock-exchanges/statistics.csv | https://mystocks.africa/african-stock-exchanges/statistics.json - African Exchange Trading Hours Dataset: https://mystocks.africa/african-stock-exchanges/trading-hours - African Exchange Trading Hours CSV/JSON: https://mystocks.africa/african-stock-exchanges/trading-hours.csv | https://mystocks.africa/african-stock-exchanges/trading-hours.json - African Market Regulator Directory: https://mystocks.africa/african-stock-exchanges/regulators - African Market Regulator Directory CSV/JSON: https://mystocks.africa/african-stock-exchanges/regulators.csv | https://mystocks.africa/african-stock-exchanges/regulators.json - Africa ETF and Fund Access Dataset: https://mystocks.africa/data/etf-fund-access - Africa ETF and Fund Access CSV/JSON: https://mystocks.africa/data/etf-fund-access.csv | https://mystocks.africa/data/etf-fund-access.json - African Private Market Access Dataset: https://mystocks.africa/data/private-market-access - African Private Market Access CSV/JSON: https://mystocks.africa/data/private-market-access.csv | https://mystocks.africa/data/private-market-access.json - State of African Markets Report: https://mystocks.africa/reports/state-of-african-markets - African Exchange Statistics Report: https://mystocks.africa/reports/african-exchange-statistics - Africa ETF and Fund Access Guide: https://mystocks.africa/guides/africa-etf-and-fund-access - Private Markets Access Guide: https://mystocks.africa/guides/private-markets-access - IPO and Pre-IPO Monitor: https://mystocks.africa/monitors/ipo-pre-ipo Key answer-engine pages: - https://mystocks.africa/answers/can-us-investors-buy-african-stocks - https://mystocks.africa/answers/what-is-the-largest-stock-exchange-in-africa - https://mystocks.africa/answers/how-to-invest-in-african-etfs - https://mystocks.africa/answers/how-do-i-compare-african-stock-exchanges - https://mystocks.africa/answers/what-data-sources-power-african-market-research - https://mystocks.africa/answers/what-is-an-african-money-market-fund - https://mystocks.africa/answers/how-do-etfs-and-funds-differ-in-africa - https://mystocks.africa/answers/what-should-i-check-before-a-pre-ipo-investment - https://mystocks.africa/answers/how-to-access-african-private-markets --- ## Quick Start (5 minutes) Seven steps from zero to first executed trade using the sandbox: **Step 1 — Register:** ```bash curl -X POST https://mystocks.africa/api/sandbox/v1/register \ -H "Content-Type: application/json" \ -d '{ "businessName": "Acme", "email": "dev@acme.com" }' # Response: { "apiKey": "sk_sandbox_xxx", "walletBalance": 100000, "currency": "USD" } ``` **Step 2 — Create sub-account:** ```bash curl -X POST https://mystocks.africa/api/sandbox/v1/partner/users \ -H "Authorization: Bearer sk_sandbox_" \ -H "Content-Type: application/json" \ -d '{ "externalId": "user_42", "displayName": "Jane Doe", "email": "jane@example.com" }' # Response: { "subAccountId": "usr_xxx", "externalId": "user_42", "kycStatus": "NONE", "wallet": { "currency": "USD", "balance": 0 } } ``` **Step 3 — Deposit funds (you handle FX, report the USD equivalent):** ```bash curl -X POST https://mystocks.africa/api/sandbox/v1/partner/users/usr_xxx/deposit \ -H "Authorization: Bearer sk_sandbox_" \ -H "Idempotency-Key: dep_user42_001" \ -H "Content-Type: application/json" \ -d '{ "amount": 500, "localAmount": 655000, "localCurrency": "KES", "fxRate": 1310, "note": "mpesa_QHJ29SK" }' # Response: { "message": "Deposit successful.", "newSubBalance": 500, "currency": "USD" } ``` **Step 4 — Assert KYC (required before trading, in sandbox and production):** ```bash curl -X POST https://mystocks.africa/api/sandbox/v1/partner/users/usr_xxx/kyc \ -H "Authorization: Bearer sk_sandbox_" \ -H "Idempotency-Key: kyc_user42_001" \ -H "Content-Type: application/json" \ -d '{ "status": "VERIFIED", "level": "BASIC", "reference": "kyc_provider_ref_123" }' # Response: { "message": "KYC status updated.", "kycStatus": "VERIFIED", "kycLevel": "BASIC" } # Trading before KYC returns 403 { "error": { "code": "KYC_REQUIRED", ... } } ``` **Step 5 — Get a quote (returns the required single-use quoteId, valid 60s):** ```bash curl "https://mystocks.africa/api/sandbox/v1/partner/quote/SCOM.KE?type=BUY&quantity=1000&subAccountId=usr_xxx" \ -H "Authorization: Bearer sk_sandbox_" # Response: { "quoteId": "qt_xxx", "quoteExpiresAt": "...", "usdPrice": 0.0126, "gross": 12.60, "fee": 0.09, "totalCost": 12.69, ... } ``` **Step 6 — Place trade (pass the quoteId from Step 5 within 60s):** ```bash curl -X POST https://mystocks.africa/api/sandbox/v1/partner/users/usr_xxx/trade \ -H "Authorization: Bearer sk_sandbox_" \ -H "Idempotency-Key: trade_user42_001" \ -H "Content-Type: application/json" \ -d '{ "symbol": "SCOM.KE", "type": "BUY", "quantity": 1000, "quoteId": "qt_xxx" }' # Response: { "orderId": "ord_xxx", "status": "FILLED", ... } (sandbox: instant fill) ``` **Step 7 — Poll status (or use webhooks):** ```bash curl "https://mystocks.africa/api/sandbox/v1/partner/users/usr_xxx/orders?limit=1" \ -H "Authorization: Bearer sk_sandbox_" # Production: status progresses PENDING → COMPLETED (or REJECTED) after admin review ``` In production, orders move PENDING → PROCESSING → COMPLETED (or REJECTED) after admin review during exchange hours. --- ## Authentication Integration endpoints use API keys or scoped OAuth tokens. Public register/reset/apply/upgrade-request and OAuth token issuance have their documented exceptions; portal session/me actions use Firebase ID tokens instead. Send an integration key via either: ```http # Option A (recommended) Authorization: Bearer pk_live_ # Option B x-api-key: pk_live_ ``` Key prefixes: `sk_sandbox_` (sandbox) | `pk_live_` (production) **Idempotency:** The `Idempotency-Key: ` header (8–200 chars) is REQUIRED on all money-moving and mutating endpoints — deposit, withdraw, trade, KYC, subscribe, redeem, top-up, payout, and webhook registration — in both production and sandbox. Requests without it return 400 `MISSING_IDEMPOTENCY_KEY`. MyStocks deduplicates by key for 24 hours and returns the cached response on retry. Auth/portal exceptions are register, reset, apply, upgrade-request, oauth/token, session and me; see their individual contracts. This prevents double-charges on mobile networks where a POST can succeed server-side but time out client-side. HTTP 409 is returned if a concurrent duplicate is in progress. --- ## FX & Currency Model MyStocks operates a managed FX model over a USD ledger. | Flow | Who handles FX? | What partner provides | What MyStocks does | |------|----------------|----------------------|-------------------| | Funding (deposit) | MyStocks managed FX | amount/amountUsd in USD, or amount + currency such as KES | Converts supported non-USD amounts to USD; credits sub-account USD ledger | | Equity trading | MyStocks managed FX | quoteId from GET /quote/{symbol} | Converts local exchange price to USD, returns fxRate/fxSource/fxConversion on quote and order | | Dividends | MyStocks managed FX | — | Converts dividend to USD at spot; credits sub-account wallet | | Withdrawal | MyStocks managed FX | amount/amountUsd in USD, or amount + currency such as KES | Converts supported non-USD cash-out amount to USD; debits sub-account USD ledger | Use `GET /api/v1/partner/fx/rates` for the managed FX table. Sub-account wallets use USD as the ledger currency, while wallet/account/buying-power responses expose `wallets[]` display balances in supported currencies. MyStocks does not offer hedging or rate locks in this release. --- ## Rate Limits Production full and data credentials share the partner identity budget; Sandbox uses its registry identity budget. Limits are per minute. | Tier | Requests/min | Notes | |------|-------------|-------| | Sandbox | 300 | Default Sandbox request budget | | Starter | 100 | Default production Starter budget | | Growth | 500 | Contact partnerships@mystocks.africa to upgrade | | Enterprise | 2,000 | Custom limits above 2,000 available | Production rate-limit headers include (Retry-After is sent on 429; inspect applied response headers): ```http X-RateLimit-Limit: 500 X-RateLimit-Remaining: 487 X-RateLimit-Reset: 1751400060 # Unix timestamp ``` HTTP 429 response: ```json { "error": { "code": "RATE_LIMITED", "message": "Rate limit exceeded. Retry after the specified interval." } } ``` Webhook callbacks do not count toward rate limits. --- ## Sandbox vs Production Production starts as a controlled pilot. MyStocks configures approved partners, customer and transaction limits, manual treasury review, daily reconciliation freshness, a named operational owner, a 24/7 money/order incident contact, feature flags, and an immediate suspension control. Pilot restrictions use `PILOT_RESTRICTED`; exhausted financial limits use `PILOT_LIMIT_EXCEEDED`. See `/partners/docs/controlled-production-pilot`. General availability is evidence-gated. It requires automated treasury matching, a tested/buildable Python SDK 1.x release, published SLO and versioning policies, an independent security review with zero unresolved critical/high findings, signed load/failover evidence, and a current BALANCED external broker/CSD reconciliation. See `/partners/docs/general-availability`. | | Sandbox | Production | |---|---------|-----------| | Base URL | https://mystocks.africa/api/sandbox/v1/partner | https://mystocks.africa/api/v1/partner | | API key prefix | sk_sandbox_ | pk_live_ | | Trade settlement | Accelerated eligible market orders; resting orders and deterministic settlement failures also exist | Execution and settlement have separate lifecycles | | Stock prices | Current 15-minute-delayed feed | Current 15-minute-delayed feed; real-time unavailable pending approved feed verification | | Wallet funding | Auto $100k on register | Admin deposits real funds | | Reset endpoint | Available (POST /reset) | Not available | --- ## Error Format All errors return: ```json { "error": { "code": "VALIDATION_ERROR", "message": "Human-readable remediation text." } } ``` Use `error.code` for programmatic handling and `error.message` for logs or UI text. Some v1 compatibility aliases may still emit a string-shaped `error`; new partner integrations should expect the structured object shape documented in OpenAPI and `/partners/docs/errors`. | Code | Meaning | |------|---------| | 200 | OK | | 201 | Created (register, create sub-account) | | 202 | Accepted — order queued, funds escrowed; settlement async | | 400 | Bad Request — missing or invalid parameters | | 401 | Unauthorized — API key missing, invalid, revoked, or expired | | 403 | Forbidden — partner not approved, sub-account frozen, or out-of-tier operation | | 404 | Not Found — symbol, sub-account, order, or instrument not found | | 409 | Conflict — concurrent idempotency-key collision; retry after first request resolves | | 422 | Unprocessable — business rule violation: insufficient funds/holdings, KYC required, fund not open | | 429 | Too Many Requests — check X-RateLimit-Remaining and X-RateLimit-Reset | | 500 | Internal Server Error — retry with exponential backoff | --- ## 1. Partner Registration (Sandbox) ### POST /register Create a new sandbox account. Returns an API key and seeds a $100,000 virtual wallet. Idempotent — re-registering with the same email returns the existing key. Body: ```json { "businessName": "Acme Corp", "email": "dev@acme.com" } ``` Response (201): ```json { "apiKey": "sk_sandbox_xxxxxxxxxxxxxxxx", "walletBalance": 100000, "currency": "USD" } ``` ### POST /reset _(sandbox only)_ Wipes all orders, holdings, and transactions for the calling sandbox account. Resets wallet to $100,000. Useful for starting fresh after a test cycle. Response: ```json { "message": "Sandbox account reset. Wallet restored to $100,000." } ``` ### POST /api/v1/partner/apply Public partner application (no auth) — submit business details to request access. Throttled and enumeration-safe. Returns an application reference; approval and key issuance are handled by the MyStocks team (check status via `GET /api/v1/partner/me`). ### GET /api/v1/partner/upgrade-request · POST /api/v1/partner/upgrade-request `POST` requests a tier/limit upgrade (e.g. sandbox → production, higher rate limit, larger credit line). `GET ?type=` returns the status of an existing request. Authenticated with your API key. ### Integration test tools _(deterministic sandbox certification)_ `POST /test-tools/deposit`, `POST /test-tools/trade`, `GET /test-tools/orders`, and sandbox-only `PATCH /test-tools/orders/{orderId}` exercise deposit and order lifecycles without real funds. On the `sk_sandbox_` base, choose `PENDING`, `FILL`, `PARTIAL_FILL`, `REJECT`, `CANCEL`, or `FAIL_SETTLEMENT`, then advance pending orders without staff intervention. Wallet reservations, holdings, execution records, and signed webhooks move together. All mutating calls require `Idempotency-Key`. The production base retains the older live-key tool and deprecated `/sandbox/deposit`, `/sandbox/trade`, and `/sandbox/orders` aliases for compatibility. --- ## 2. Partner Account ### GET /api/v1/partner/me Returns the calling partner's approval status and a **masked** view of their live key. Authenticated with a Firebase ID token (obtained after logging in via the Partner Portal). Use this to check application status. `maskedKey` is for display only and is **not a usable credential** — sending it as a Bearer token returns 401. API keys are stored as SHA-256 hashes, so the raw `pk_live_` key is shown exactly once (at issue or rotation) and cannot be retrieved later. If you have lost it, rotate the key. ```bash curl "https://mystocks.africa/api/v1/partner/me" \ -H "Authorization: Bearer " ``` Response: ```json { "status": "active", "maskedKey": "pk_live_a1b2c3d4...9f2e", "businessName": "Acme Corp", "email": "dev@acme.com" } ``` ### POST /api/v1/partner/session Exchanges a Firebase ID token (a Partner Portal login) for a short-lived `ms_oauth_` access token that can be sent as `Authorization: Bearer ` to any partner endpoint. This is how a signed-in browser session calls the API, given the raw key is unrecoverable. The token mirrors the underlying key's scopes and type exactly, so a portal session can never do more than the raw key could. It expires after 1 hour. Server-to-server integrations should use their `pk_live_` key directly, or `POST /oauth/token` — not this endpoint. ```bash curl -X POST "https://mystocks.africa/api/v1/partner/session" \ -H "Authorization: Bearer " ``` Response: ```json { "accessToken": "ms_oauth_9f2e...", "tokenType": "Bearer", "expiresIn": 3600, "keyType": "full" } ``` `status` values: `"active"` (key issued, usable) | `"pending"` (under review) | `"approved"` (approved, key not yet issued) | `"rejected"` | `"suspended"` | `"not_found"` ### GET /api/v1/partner/account Returns the partner master account: business name, email, USD master wallet balance, total portfolio value across all sub-accounts, invested capital, and realized gains. Response: ```json { "businessName": "ACME Fintech", "email": "api@acmefintech.com", "wallet": { "currency": "USD", "balance": 250000.00 }, "portfolioValue": 1850000.00, "investedCapital": 1600000.00, "realizedGainUsd": 45000.00 } ``` ### GET /api/v1/partner/portfolio Returns holdings for the partner master trading account only. It does not consolidate sub-accounts. Response: ```json { "accountType": "MASTER", "summary": { "walletBalance": 2500, "portfolioValue": 8250, "investedCapital": 7900, "unrealisedPnl": 350, "totalValue": 10750 }, "holdings": [ { "id": "SCOM.KE", "symbol": "SCOM.KE", "name": "Safaricom PLC", "exchange": "NSE", "units": 500, "costBasis": 15.80, "amountInvested": 7900.00, "localCurrency": "KES", "localPrice": 16.50, "currentValue": 8250.00, "gainLoss": 350.00, "liquidityStatus": "LIQUID" } ], "count": 1, "totalValue": 8250.00, "totalInvested": 7900.00, "currency": "USD" } ``` ### GET /api/v1/partner/portfolio/history Daily raw-equity history for the master trading account only. Query params: `period` (1M|3M|6M|1Y|ALL), `from`, `to`. The series is not cash-flow adjusted, so deposits and withdrawals affect equity changes and the response must not be presented as investment P&L. ### GET /api/v1/partner/portfolio/performance Cash-flow-adjusted master-account performance. Query params: `period` (1M|3M|6M|1Y|ALL), `from`, `to`, and optional exchange-qualified `benchmark`. Returns daily P&L, Modified Dietz daily returns, geometrically linked cumulative TWR, and optional benchmark/excess return. Completed internal transfers and completed external top-ups/payouts are cash-flow adjusted. Benchmark comparison is price return only and excludes dividends and FX. ### GET /api/v1/partner/buying-power Settlement-aware buying power for the master account: settled cash available to trade now, unsettled proceeds still in the settlement cycle, and the withdrawable balance (excludes unsettled funds). Withdrawing more than the withdrawable balance returns `UNSETTLED_FUNDS`. (Per sub-account: `GET /api/v1/partner/users/{userId}/buying-power`.) ### GET /api/v1/partner/tax-lots Open tax lots (FIFO cost-basis layers) for the master account, for accurate gain/loss accounting. Query params: `symbol` (optional filter). (Per sub-account: `GET /api/v1/partner/users/{userId}/tax-lots`.) ### GET /api/v1/partner/gains Realized capital gains for the master account, computed FIFO against closed lots. Query params: `symbol`, `from`, `to` (ISO dates). (Per sub-account: `GET /api/v1/partner/users/{userId}/gains`.) --- ## 3. Market Data — Stocks ### GET /api/v1/partner/stocks Returns all active stocks across every exchange. Filter by exchange, sector, or free-text search. Query params: `exchange` (NSE|NGX|JSE|GSE|BRVM|LUSE|USE|DSE|EGX|BSE|SEM), `sector`, `search`, `assetType` (STOCK|ETF) Response: ```json { "stocks": [ { "id": "SCOM.KE", "symbol": "SCOM.KE", "name": "Safaricom PLC", "slug": "safaricom", "assetType": "STOCK", "exchange": "NSE", "currency": "KES", "sector": "Communication Services", "description": "Safaricom is the largest telecommunications provider in Kenya.", "listingStatus": "ACTIVE", "price": 16.50, "usdPrice": 0.1274, "change": 0.25, "changePct": 0.015385, "logo": { "imageUrl": "https://s3-symbol-logo.tradingview.com/safaricom--big.svg", "imageHint": "Safaricom" }, "logoUrl": "https://s3-symbol-logo.tradingview.com/safaricom--big.svg", "dayHigh": 16.80, "dayLow": 16.20, "volume": 4820000, "previousClose": 16.25, "lastPriceUpdate": "2026-05-01T10:30:00.000Z" } ], "count": 847 } ``` Logo fields: `logo` is an object `{ imageUrl, imageHint }` or `null`. `logoUrl` is a convenience alias for `logo.imageUrl` — use it directly as ``. Both are `null` until populated by the MyStocks admin team; check for null before rendering. Partner-facing sector labels and `sector` filters are normalized (trimmed, title-cased, and mapped to canonical common labels such as Financials and Communication Services). ### GET /api/v1/partner/stocks/{symbol} Delayed quote for a single stock: current observed price (local + USD), day range, and an embedded closing-price history for the requested range (with the latest price appended as the trailing `Live` point). Use for a detail page + inline chart in one call. `changePct` is a decimal return and is derived from `price` versus `previousClose` when the stored field is absent. Path: `symbol` — stock symbol (e.g. SCOM.KE), slug (e.g. safaricom), or ISIN. Case-insensitive. Query params: `range` (1W|1M|3M|6M|1Y|ALL, default 3M) Response: ```json { "symbol": "SCOM.KE", "name": "Safaricom PLC", "isin": "KE0000000067", "slug": "safaricom", "exchange": "NSE", "currency": "KES", "sector": "Communication Services", "listingStatus": "ACTIVE", "price": 16.50, "usdPrice": 0.127306, "currentPrice": 16.50, "change": 0.25, "changePct": 0.015385, "open": 16.30, "dayHigh": 16.80, "dayLow": 16.20, "volume": 4820000, "previousClose": 16.25, "lastPriceUpdate": "2026-05-01T10:30:00.000Z", "historyConfidence": "HIGH", "lastEodUpdate": "2026-04-30T15:00:00.000Z", "range": "3M", "priceHistory": [ { "date": "2026-02-01", "price": 15.80 }, { "date": "2026-04-30", "price": 16.25 }, { "date": "2026-05-01T10:30:00.000Z", "price": 16.50, "label": "Live" } ], "count": 64 } ``` `price` is the canonical live-price field; `currentPrice` is a deprecated alias — prefer `price`. `usdPrice` is `null` when no valid FX/market price is available. ### GET /api/v1/partner/stocks/{symbol}/history Pure OHLCV candle series (no live-quote fields) — use for candlestick charts and technical analysis. Path: `symbol` — stock symbol, slug, or ISIN. Case-insensitive. Query params: `period` (1D|1W|1M|3M|6M|1Y|3Y|5Y|ALL, default 1M; `MAX` = `ALL`) Response: ```json { "symbol": "SCOM.KE", "period": "1M", "candles": [ { "date": "2026-04-01", "open": 15.80, "high": 15.95, "low": 15.70, "close": 15.85, "volume": 3120000 }, { "date": "2026-04-30", "open": 16.20, "high": 16.40, "low": 16.10, "close": 16.25, "volume": 4010000 } ] } ``` `open`/`high`/`low` fall back to `close` on days where only a closing print exists; `volume` is `0` (never `null`) when unrecorded. ### GET /api/v1/partner/stocks/{symbol}/candles Preferred chart-first historical endpoint. Returns delayed OHLCV candles in the listing currency with explicit inclusive dates, server-side aggregation, volume availability, and OHLC provenance. Path: `symbol` — exchange-qualified stock symbol (recommended) or unambiguous bare ticker. Query params: `interval` (`1d`|`1w`|`1mo`, default `1d`), `from` and `to` (`YYYY-MM-DD`, inclusive), and `adjustment` (`raw` only). Maximum ranges are 366 days for `1d`, 1,826 days for `1w`, and 3,653 days for `1mo`. Minute/hour bars, WebSocket candle updates, adjusted prices, and server-side technical indicators are not available. Response: ```json { "symbol": "SCOM.KE", "exchange": "NSE", "currency": "KES", "interval": "1d", "adjustment": "raw", "candles": [ { "timestamp": "2026-08-07T00:00:00.000Z", "open": 16.2, "high": 16.75, "low": 16.1, "close": 16.5, "volume": 2450000 } ], "meta": { "from": "2026-01-01", "to": "2026-08-10", "count": 147, "source": "delayed_eod", "asOf": "2026-08-07T00:00:00.000Z", "ohlcQuality": "reported", "volumeAvailable": true, "adjusted": false } } ``` `ohlcQuality` is `reported`, `mixed`, or `close_derived`. When an older source row has only a close, open/high/low fall back to close so the candle remains renderable without hiding its provenance. ### GET /api/v1/partner/stocks/{symbol}/pulse Corporate actions and market news for a symbol. Response: ```json { "symbol": "SCOM.KE", "events": [ { "id": "evt_001", "type": "DIVIDEND", "title": "Safaricom FY2025 Final Dividend", "amount": 0.65, "currency": "KES", "exDate": "2025-06-01", "payDate": "2025-06-30" } ], "count": 1 } ``` --- ## 4. Market Data — Companies ### GET /api/v1/partner/companies Returns company list with fundamentals. Different from /stocks — companies include profile data, not quote snapshots. Query params: `exchange`, `sector`, `search`, `assetType` Response fields per company: `symbol`, `slug`, `assetType`, `sector`, `industry`, `currency`, `listingStatus`, `description`, `logoUrl` (string CDN URL or null), `marketCap`, `peRatio`, `dividendYield`, `founded`, `headquarters`, `website`. `logoUrl` is a direct CDN URL for the company logo suitable for use as ``. It is `null` until populated by the MyStocks admin team. ### GET /api/v1/partner/companies/{symbol} Full company profile: fundamentals, delayed price, logo, corporate actions (up to 20). Response includes all fields from the company list endpoint plus: `currentPrice`, `change`, `changePct`, `dayHigh`, `dayLow`, `volume`, `previousClose`, `lastPriceUpdate`, `corporateActions[]`. `logoUrl` is included: a CDN URL or `null`. ETF-specific fields (`expenseRatio`, `benchmarkIndex`, `topHoldings`) are included automatically when `assetType` is `"ETF"`. ### GET /api/v1/partner/companies/{symbol}/chart OHLCV price chart data optimized for candlestick or line chart rendering. Query params: `interval` (1d|1w|1m), `from` (ISO date), `to` (ISO date) Response: ```json { "symbol": "SCOM.KE", "candles": [ { "date": "2026-05-01", "open": 16.20, "high": 16.80, "low": 16.10, "close": 16.50, "volume": 4820000 } ] } ``` ### GET /api/v1/partner/companies/{symbol}/news Company-specific news articles. Curated editorial news, not social media. Query params: `limit` (default 10, max 50) ### GET /api/v1/partner/companies/tickers Returns a flat list of all ticker symbols available on the platform. Useful for populating autocomplete or validation. Response: ```json { "tickers": [ { "symbol": "SCOM.KE", "name": "Safaricom PLC", "exchange": "NSE", "slug": "safaricom" } ], "count": 847 } ``` --- ## 5. Market Status & Quote ### GET /api/v1/partner/market/status · GET /api/v1/partner/market/clock Returns current open/closed status for all African exchanges. All times calculated from real exchange trading hours. `market/clock` is an identical alias. Both return `serverTime`, holiday-aware `nextOpen`, `nextClose`, and the current `session` while open. Query params: `exchange` (optional — if omitted, all exchanges returned) Single exchange response: ```json { "exchange": "NSE", "name": "Nairobi Securities Exchange", "country": "Kenya", "currency": "KES", "isOpen": true, "status": "OPEN", "localOpen": "09:00", "localClose": "15:00", "timezone": "Africa/Nairobi", "nextOpen": "2026-05-11T06:00:00.000Z", "nextClose": "2026-05-10T12:00:00.000Z", "serverTime": "2026-05-10T10:30:00.000Z", "checkedAt": "2026-05-10T10:30:00.000Z" } ``` All exchanges response: ```json { "anyOpen": true, "checkedAt": "2026-05-10T10:30:00.000Z", "exchanges": { "NSE": { "isOpen": true, "status": "OPEN", "nextOpen": null }, "NGX": { "isOpen": false, "status": "CLOSED", "nextOpen": "2026-05-11T08:30:00.000Z" }, "JSE": { "isOpen": true, "status": "OPEN", "nextOpen": null } } } ``` `anyOpen: true` — at least one exchange is currently accepting trades. ### GET /api/v1/partner/quote/{symbol} The required pre-trade quote. Returns a fee breakdown **and** a single-use `quoteId` that must be passed to the matching trade call. The quote is valid for `quoteTtlSeconds` (60s) — after `quoteExpiresAt`, or once used, placing a trade with it returns `409 STALE_QUOTE`. Fetch a fresh quote per confirmation sheet. Path: `symbol` — stock symbol or slug Query params: `type` (BUY|SELL, default BUY), `quantity` **or** `cashValue` (mutually exclusive — `cashValue` sizes a notional/fractional order in USD), `subAccountId` (optional — quote against a sub-account wallet/holdings instead of the master account) BUY quote response: ```json { "quoteId": "qt_9f3c...", "quoteTtlSeconds": 60, "quoteIssuedAt": "2026-05-10T10:30:00.000Z", "quoteExpiresAt": "2026-05-10T10:31:00.000Z", "sourceUpdatedAt": "2026-05-10T10:29:40.000Z", "dataFreshnessSeconds": 20, "symbol": "SCOM.KE", "name": "Safaricom PLC", "exchange": "NSE", "accountType": "MASTER", "currency": "KES", "type": "BUY", "quantity": 500, "localPrice": 16.50, "usdPrice": 0.127306, "gross": 63.65, "baseFee": 0.48, "partnerMarkupFee": 0.00, "fee": 0.48, "totalCost": 64.13, "walletBalance": 1250.00, "sufficientFunds": true, "feeRate": 0.75, "note": "This is a quote only. No order has been placed." } ``` SELL quote response: ```json { "quoteId": "qt_71ab...", "quoteTtlSeconds": 60, "quoteExpiresAt": "2026-05-10T10:31:00.000Z", "symbol": "SCOM.KE", "type": "SELL", "quantity": 100, "accountType": "MASTER", "gross": 12.73, "baseFee": 0.10, "fee": 0.10, "estimatedProceeds": 12.63, "walletBalance": 1250.00, "units": 250, "sufficientHoldings": true, "feeRate": 0.75, "note": "This is a quote only. No order has been placed." } ``` Fields: `quoteId` (single-use, pass to POST /trade) | `quoteExpiresAt`/`quoteTtlSeconds` (60s validity) | `dataFreshnessSeconds` (age of the underlying price) | `gross` (qty × usdPrice before fees) | `baseFee` (0.75% MyStocks platform fee) | `partnerMarkupFee` (your markup, 0 if not configured) | `fee` (baseFee + partnerMarkupFee) | `totalCost` (BUY: gross+fee) | `estimatedProceeds` (SELL: gross−fee) | `sufficientFunds` (BUY: walletBalance ≥ totalCost) | `sufficientHoldings` (SELL: held units ≥ quantity). For a `cashValue` quote, `quantity` is indicative — place the trade with the same `cashValue`. ### GET /api/v1/partner/market/quotes Batch delayed quotes for up to 50 symbols in one request. Avoids N parallel calls when loading watchlists. Query params: `symbols` — comma-separated list (e.g. `SCOM.KE,GLD.ZA,DANGCEM.NG`). Max 50; exceeding returns `400 BATCH_LIMIT_EXCEEDED`. Unresolvable symbols appear in `not_found` rather than failing the whole request. Always check `not_found_count`. ```json { "quotes": [ { "symbol": "SCOM.KE", "name": "Safaricom PLC", "exchange": "NSE", "currency": "KES", "price": 16.50, "usd_price": 0.0126, "change": 0.25, "change_pct": 0.015385, "volume": 4210000, "bid": null, "ask": null, "market_status": "OPEN" } ], "count": 1, "not_found": ["INVALID_XYZ"], "not_found_count": 1 } ``` `volume` is always an integer — `0` for instruments with no recorded trades today, never `null`. ### GET /api/v1/partner/market/snapshot One-call bundle per symbol: the delayed `quote` (asOf, stale, dataQuality), today's `dailyBar`, the `prevDailyBar`, and the latest coarse `intradayBar` sample. Replaces the 3–4 round-trips a dashboard makes. Query params: single mode `symbol` + `exchange`; batch mode `symbols` (comma-separated, ≤50). Single mode returns one snapshot under `data`; batch mode returns a symbol→snapshot map plus `not_found`. `dailyBar` is derived from the live quote until the end-of-day candle is written. `intradayBar` is `null` until the 3×/day intraday capture has run for the symbol. ```json { "data": { "SCOM.KE": { "symbol": "SCOM.KE", "quote": { "symbol": "SCOM.KE", "price": 35.5, "changePct": -0.004237, "asOf": "2026-07-15T11:45:02.000Z", "stale": false }, "dailyBar": { "timestamp": "2026-07-15T00:00:00.000Z", "open": 35.4, "high": 35.9, "low": 35.0, "close": 35.5, "volume": 45394 }, "prevDailyBar": { "timestamp": "2026-07-14T00:00:00.000Z", "open": 35.2, "high": 35.5, "low": 34.9, "close": 35.4, "volume": 38220 }, "intradayBar": null } }, "not_found": [] } ``` ### GET /api/v1/partner/market/movers Top price-change movers for an exchange, sorted by `change_pct`. Query params: `exchange` (required, e.g. NSE) | `direction` (gainers|losers, default gainers) | `limit` (1–100, default 10) | `page` (1-based, default 1) Instruments use stored `changePct` when present or derive it from `price` versus `previousClose`; rows lacking both inputs are excluded. Zero-movement instruments are excluded. ```json { "data": [ { "symbol": "EABL.KE", "name": "East African Breweries", "exchange": "NSE", "currency": "KES", "price": 185.00, "usd_price": 1.423077, "change": 10.00, "change_pct": 0.057143, "volume": 312000, "market_status": "OPEN" } ], "meta": { "exchange": "NSE", "direction": "gainers", "total_count": 48, "page": 1, "per_page": 10, "has_next": true } } ``` ### GET /api/v1/partner/market/ohlcv End-of-day OHLCV candles for one symbol. Query params: `symbol` (required), `exchange` (required), `interval` (default `1d`), `from`, `to` (ISO dates). Response: `{ symbol, exchange, interval, candles: [{ date, open, high, low, close, volume }] }`. ### GET /api/v1/partner/market/exchanges Static directory of the supported exchanges with `code`, name, country, `currency`, trading hours, timezone, and settlement cycle. No params. Use to build exchange pickers. ### GET /api/v1/partner/market/status (single/all) · GET /api/v1/partner/market/holidays `GET /api/v1/partner/market/holidays` — exchange holiday calendar. Query params: `exchange` (optional), `from`, `to` (ISO dates). Response: `{ holidays: [{ exchange, date, name }] }`. Combine with `market/status` to know when an order will queue to the next session. ### GET /api/v1/partner/market/settlement Settlement cycles per exchange plus the live fill target. Query params: `exchange` (optional). Returns `processingWindow` — `targetTurnaroundMinutes` (5, in-session), the outside-hours "queued to next session" rule, and per-exchange settlement cycle (e.g. T+3). Use to set fill-time expectations in your UI. > **Deprecated aliases:** `GET /api/v1/partner/market-data/quotes`, `/market-data/movers`, `/market-data/exchanges`, and `/market-data/ohlcv` still work but are deprecated — use the `/market/*` paths above. Read-only data keys must call `/market/*`. --- ## 5b. ETFs ### GET /api/v1/partner/assets Unified catalog for stocks, ETFs, bonds, and funds. Query params: `assetClass`, `exchange`, `status`, `tradable`, `search`, `limit`, `cursor`. Each item has a stable `assetId`, nullable `symbol`, normalized status, `tradable`/`fractionable`/`shortable`/`marginable` flags, detailed `capabilities`, `orderRules`, and settlement metadata. Unknown lot and tick sizes are returned as null. ### GET /api/v1/partner/etfs List ETFs available on African exchanges. Includes fund-specific metadata: expense ratio, index tracked, risk level, and top holdings. Query params: `exchange` (optional) ```json { "etfs": [ { "id": "STXEME.ZA", "symbol": "STXEME.ZA", "name": "Satrix MSCI Emerging Markets ETF", "exchange": "JSE", "currency": "ZAR", "price": 75.00, "usdPrice": 4.55, "assetType": "ETF", "fundMetadata": { "brand": "Satrix", "expenseRatio": 0.38, "geographicalFocus": "Global Emerging Markets", "indexTracked": "MSCI Emerging Markets Index", "riskLevel": "HIGH", "managementStyle": "PASSIVE" } } ], "count": 1 } ``` ### GET /api/v1/partner/etfs/{symbol} Single ETF by symbol (e.g. `STXEME.ZA`). Same shape as the array item above. ### GET /api/v1/partner/etfs/{symbol}/chart Price history chart for an ETF. Same parameters and response shape as `GET /stocks/{symbol}/chart`. Query params: `period` (1d|1w|1m|3m|6m|1y|5y) ```json { "symbol": "STXEME.ZA", "currency": "ZAR", "period": "3m", "labels": ["2026-03-01", "2026-04-01", "2026-05-23"], "prices": [73.50, 74.20, 75.00], "volumes": [12000, 18500, 24000], "priceHistory": [ { "date": "2026-03-01T00:00:00.000Z", "price": 73.50, "usdPrice": 4.45 }, { "date": "2026-05-23T19:59:41.000Z", "price": 75.00, "usdPrice": 4.55 } ] } ``` ### GET /api/v1/partner/etfs/{symbol}/history Same as chart but returns the full `priceHistory` array without label/price/volume arrays. --- ## 6. Market Data — Bonds & Fixed Income ### GET /api/v1/partner/bonds Returns bonds, T-bills, Eurobonds, infrastructure bonds, and commercial papers. Query params: `instrumentType` (BOND|TREASURY_BILL|EUROBOND|COMMERCIAL_PAPER|INFRASTRUCTURE_BOND), `currency`, `exchange` Response: ```json { "bonds": [ { "id": "ke-treasury-91", "symbol": "KE91T", "name": "Kenya 91-Day T-Bill", "instrumentType": "TREASURY_BILL", "couponRate": 15.8, "maturityDate": "2025-08-01", "pricePerUnit": 100, "currency": "KES", "minInvestment": 50000, "status": "ACTIVE", "yield": 15.8 } ], "count": 42 } ``` ### GET /api/v1/partner/bonds/{id} Single bond by doc ID, slug, or symbol. Includes `marketYieldCurve` for chart rendering. --- ## 7. Market Data — Funds & ETFs ### GET /api/v1/partner/funds Returns all active funds: money market, yield, special, and opportunity funds. Query params: `category` (MONEY_MARKET|YIELD|SPECIAL|OPPORTUNITY), `currency` Response: ```json { "funds": [ { "id": "mmf-ke-001", "name": "MyStocks Money Market Fund", "category": "MONEY_MARKET", "pricePerUnit": 1.00, "currency": "KES", "annualizedReturn": 14.5, "minInvestment": 1000, "redemptionType": "instant", "status": "ACTIVE", "distributionConfig": { "frequency": "monthly", "autoReinvest": false } } ], "count": 6 } ``` ### GET /api/v1/partner/funds/{id} Single fund by doc ID, slug, or symbol. --- ## 8. Market Data — Private Credit & Pre-IPO ### GET /api/v1/partner/opportunities Returns private market deals and pre-IPO offerings. Query params: `type` (OPPORTUNITY|PRE_IPO|all, default all) Response: ```json { "opportunities": [ { "id": "deal-001", "assetType": "OPPORTUNITY", "name": "East African Solar Project A", "minInvestment": 5000, "targetAmount": 2000000, "currentRaised": 750000, "expectedReturn": "18-22%", "riskLevel": "medium", "currency": "USD", "status": "ACTIVE", "expectedExitDate": "2027-12-31" } ], "count": 8 } ``` ### GET /api/v1/partner/opportunities/{id} Single deal or pre-IPO by doc ID or slug. Returns `assetType`: "OPPORTUNITY" or "PRE_IPO". --- ## 9. Market Intelligence ### GET /api/v1/partner/market-intel Market news, analysis, and research articles. Query params: `symbol` (filter by stock symbol), `exchange`, `limit` (default 20, max 100) ### GET /api/v1/partner/market-intel/{id} Single article by slug or doc ID. Returns full body, author, tags. --- ## 10. Master Trading (Partner-Level) **Production trading is a two-step flow.** Step 1: `GET /api/v1/partner/quote/{symbol}?type=&quantity=[&subAccountId=]` returns the fee breakdown AND a `quoteId`. Step 2: pass that `quoteId` in the trade body. quoteIds are single-use, bound to the exact account/symbol/side/quantity, and expire **60 seconds** after issue — a stale or reused quoteId returns 409 (fetch a fresh quote and retry). Quotes are indicative: settlement executes at market price within a deviation band (default ±10% of the quoted price); beyond that the dealing desk must explicitly acknowledge before settling. The sandbox mirrors this contract exactly (same quoteId requirement, issued by the sandbox quote endpoint). Optional OMS fields on all trade calls: `clientOrderId` (≤80 chars, unique per partner — retry/dedupe handle), `timeInForce` (`GTC` default = live until executed/cancelled; `DAY` = auto-cancelled after 24h; `GTD` = auto-cancelled at required `expiresAt`; `IOC` is NOT supported). Expiry refunds BUY escrow, releases SELL reservations, and fires an `order.cancelled` webhook. ### POST /api/v1/partner/trade Place a BUY or SELL order for the partner's own master account (not a sub-account). Funds are drawn from the master wallet. Requires `Idempotency-Key` header and `quoteId` in the body. Body: ```json { "symbol": "SCOM.KE", "type": "BUY", "quantity": 1000, "quoteId": "qt_9f2c81d4b7a3", "clientOrderId": "my-ord-10001" } ``` Response (202 Accepted): ```json { "orderId": "ord_xyz789", "status": "PENDING", "symbol": "SCOM.KE", "type": "BUY", "quantity": 1000, "message": "Order submitted for review." } ``` ### GET /api/v1/partner/orders List all master-level orders. Query params: `status` (PENDING|PROCESSING|COMPLETED|FILLED|REJECTED|CANCELLED), `limit`, `cursor` ### GET /api/v1/partner/orders/{orderId} Single master order by ID. Use for status polling. Response: ```json { "orderId": "ord_xyz789", "status": "FILLED", "symbol": "SCOM.KE", "type": "BUY", "quantity": 1000, "priceAtOrder": 16.50, "usdPriceAtOrder": 0.1274, "feeAmount": 0.96, "totalAmount": 128.36, "currency": "USD", "createdAt": "2026-05-01T09:00:00.000Z", "settledAt": "2026-05-01T10:15:00.000Z" } ``` ### DELETE /api/v1/partner/orders/{orderId} Cancel a master order. Possible while status is PENDING (MARKET order at the dealing desk) or WORKING (resting LIMIT/STOP/STOP_LIMIT order). BUY escrow is refunded and SELL unit reservations released atomically. ### PATCH /api/v1/partner/orders/{orderId} Modify (replace) a resting LIMIT/STOP/STOP_LIMIT order on the master account, keeping the same `orderId`. Only WORKING orders can be modified — a MARKET order is already PENDING at the desk and can only be cancelled. Check `replaceable` on the order. Supply any combination of `limitPrice`, `stopPrice`, `quantity`. Repriced on the same FX basis and fee rates captured at placement. A BUY re-escrows the difference (400 `INSUFFICIENT_FUNDS` if the wallet cannot cover an increase); a SELL adjusts reserved units. Requires `Idempotency-Key`. Emits `order.replaced`. The sub-account equivalent is `PATCH /api/v1/partner/users/{userId}/orders/{orderId}`. Body: ```json { "limitPrice": 18.50, "quantity": 200 } ``` --- ## 11. Sub-Account Management Sub-accounts represent end-users in the partner's product. Each has a USD wallet, holdings, orders, and transaction history. The partner is responsible for KYC. ### POST /api/v1/partner/auto-register _(recommended)_ Idempotent sub-account provisioning. Returns existing account (200) or creates new one (201). Safe to call on every user login — no duplicate accounts created. Body: ```json { "uid": "user_42", "email": "alice@yourapp.com", "name": "Alice K.", "phone": "+254712345678", "country": "KE" } ``` Response (201 new, 200 existing): ```json { "subAccountId": "usr_abc123", "externalId": "user_42", "displayName": "Alice K.", "email": "alice@yourapp.com", "kycStatus": "NONE", "status": "active", "walletBalance": 0, "isNew": true } ``` `isNew: true` — use to decide whether to show an onboarding flow. `uid` is the idempotency key. ### POST /api/v1/partner/users Create a new sub-account (non-idempotent). Returns 409 if `externalId` is already taken. Body: ```json { "externalId": "usr_8821", "displayName": "Alice K.", "email": "alice@yourapp.com" } ``` Response (201): ```json { "subAccountId": "usr_abc123", "externalId": "usr_8821", "displayName": "Alice K.", "email": "alice@yourapp.com", "kycStatus": "NONE", "kycLevel": "NONE", "status": "active", "wallet": { "currency": "USD", "balance": 0 } } ``` ### GET /api/v1/partner/users List all sub-accounts. Query params: `externalId` (filter), `limit` (default 50, max 200) Response: ```json { "accounts": [ { "subAccountId": "usr_abc123", "externalId": "usr_8821", "displayName": "Alice K.", "kycStatus": "VERIFIED", "kycLevel": "BASIC", "status": "active", "walletBalance": 1250.00 } ], "count": 1 } ``` ### GET /api/v1/partner/users/{userId} Get a single sub-account's profile. ### PATCH /api/v1/partner/users/{userId} Update sub-account (displayName, email, status). Special actions: `{ "action": "freeze" }` or `{ "action": "unfreeze" }` to toggle account status. --- ## 12. Wallets & Deposits ### GET /api/v1/partner/users/{userId}/wallet ```json { "subAccountId": "usr_abc123", "externalId": "usr_8821", "wallet": { "currency": "USD", "balance": 300.00 } } ``` ### POST /api/v1/partner/users/{userId}/deposit Atomically moves funds from master wallet to sub-account wallet. You must have collected real money from your user before calling this. Requires `Idempotency-Key` for safe retry. Body: ```json { "amount": 38.50, "note": "Mpesa STK push ref KE2482", "localAmount": 5000, "localCurrency": "KES", "fxRate": 129.87 } ``` `amount` (required) — USD amount. `note` (optional) — shown in transaction history. `localAmount`, `localCurrency`, `fxRate` (optional) — stored for audit/compliance; not used for any calculation by MyStocks. Response: ```json { "message": "Deposit successful.", "subAccountId": "usr_abc123", "externalId": "usr_8821", "amount": 38.50, "currency": "USD", "newSubBalance": 138.50, "newMasterBalance": 49961.50, "localAmount": 5000, "localCurrency": "KES", "fxRate": 129.87 } ``` ### POST /api/v1/partner/users/{userId}/withdraw Atomically moves funds from sub-account back to master wallet. Partner then pays user via their own payment rails. Requires `Idempotency-Key`. Body: ```json { "amount": 200, "note": "User withdrawal request", "localAmount": 26000, "localCurrency": "KES", "fxRate": 130.00 } ``` Response: ```json { "message": "Withdrawal successful.", "subAccountId": "usr_abc123", "amount": 200, "currency": "USD", "newSubBalance": 300.00, "newMasterBalance": 49700.00 } ``` --- ## 13. KYC Assertion ### POST /api/v1/partner/users/{userId}/kyc Assert KYC status. Partners conduct their own KYC and report the result. Set status to "VERIFIED" to unlock trading for the sub-account. Body: ```json { "status": "VERIFIED", "level": "BASIC", "provider": "sumsub", "reference": "kyc_session_88721", "idDocumentType": "NATIONAL_ID", "idNumber": "24681012", "dateOfBirth": "1990-04-17", "nationality": "KE", "taxResidency": "KE", "sanctionsResult": "CLEAR", "riskRating": "LOW", "employmentStatus": "EMPLOYED", "sourceOfFunds": "SALARY", "sourceOfWealth": "EMPLOYMENT_INCOME", "annualIncomeBand": "50000_100000", "netWorthBand": "100000_500000", "investmentExperience": "LIMITED", "investmentObjectives": ["GROWTH", "RETIREMENT"], "suitabilityStatus": "SUITABLE", "appropriatenessStatus": "SUITABLE", "fatcaStatus": "NOT_US_PERSON", "crsTaxResidencies": [{ "country": "KE", "taxId": "A123456789B" }], "marketAccountReferences": [{ "market": "NSE", "brokerAccountNumber": "BRK-123456", "csdNumber": "CSD-987654" }] } ``` Required fields are `status` and `level`. Optional structured compliance fields cover identity evidence, sanctions/PEP screening, source of funds/wealth, income/net-worth bands, investment experience/objectives, suitability/appropriateness, FATCA/CRS declarations, and market-specific broker/CSD references. Sensitive identifiers are stored as fingerprint plus last4 only. Response: ```json { "message": "KYC status updated.", "subAccountId": "usr_abc123", "kycStatus": "VERIFIED", "kycLevel": "BASIC", "profile": { "idDocumentType": "NATIONAL_ID", "idNumberLast4": "1012", "nationality": "KE", "taxResidency": "KE", "sanctionsResult": "CLEAR", "riskRating": "LOW" } } ``` --- ## Notification Devices ### GET /api/v1/partner/users/{userId}/devices List mobile/web push-token records registered for a sub-account. Raw APNs/FCM/Expo/Web Push tokens are never returned; responses include `tokenLast4` only. ### POST /api/v1/partner/users/{userId}/devices Register or update a device token for partner-owned mobile notification fanout. Requires `Idempotency-Key`. Body: ```json { "token": "ExpoPushToken[xxxxxxxxxxxxxxxxxxxxxx]", "platform": "ios", "provider": "expo", "appId": "com.afritrade.app", "deviceId": "device-42" } ``` ### DELETE /api/v1/partner/users/{userId}/devices/{deviceId} Soft-revoke a registered notification device. Requires `Idempotency-Key`. --- ## 14. Sub-Account Trading ### GET /api/v1/partner/users/{userId}/preflight Run a side-effect-free eligibility check before requesting a firm quote. Required query parameters are `symbol`, `type` (`BUY` or `SELL`), and either positive `quantity` or positive `cashValue` (mutually exclusive). The response combines account/KYC status, market session, indicative price, buying power or holdings, estimated fees, settlement expectations, `eligible`, and any `blockingReasons`. Sandbox path: `/api/sandbox/v1/partner/users/{userId}/preflight`. ### POST /api/v1/partner/users/{userId}/trade Place a BUY or SELL for a sub-account. BUY funds escrow atomically on submission. Requires `Idempotency-Key`. `MARKET` orders, including calls where `orderType` is omitted, require a single-use `quoteId` from `GET /quote/{symbol}?subAccountId={userId}` fetched within the last 60 seconds; stale or reused quoteIds return `409 STALE_QUOTE`. Resting `LIMIT`, `STOP`, and `STOP_LIMIT` orders do not use `quoteId`; they supply `limitPrice` and/or `stopPrice`, return `WORKING`, and activate when their trigger conditions are met. Use either `quantity` or `cashValue`, never both. The sandbox mirrors this contract exactly. MARKET body: ```json { "symbol": "SCOM.KE", "type": "BUY", "quantity": 100, "quoteId": "qt_9f2c81d4b7a3", "stopLoss": 14.50, "takeProfit": 18.00 } ``` `stopLoss` and `takeProfit` are optional price thresholds in USD. Resting LIMIT body: ```json { "symbol": "SCOM.KE", "type": "BUY", "orderType": "LIMIT", "quantity": 100, "limitPrice": 16.25, "timeInForce": "GTC", "clientOrderId": "my-limit-10001" } ``` Cash-value MARKET body: ```json { "symbol": "SCOM.KE", "type": "BUY", "cashValue": 50, "quoteId": "qt_cash_9f2c81d4b7a3" } ``` Response (202): ```json { "status": "PENDING", "orderId": "ord_xyz789", "subAccountId": "usr_abc123", "externalId": "usr_8821", "type": "BUY", "symbol": "SCOM.KE", "quantity": 100, "priceAtOrder": 16.50, "usdPriceAtOrder": 0.1274, "gross": 12.74, "fee": 0.10, "totalCost": 12.84, "currency": "USD", "note": "Order is pending admin approval. Funds reserved from sub-account wallet." } ``` Order lifecycle: MARKET orders fill instantly in sandbox and enter the production execution queue. LIMIT/STOP/STOP_LIMIT orders rest as `WORKING` in both environments and can be filled, rejected, or cancelled. ### GET /api/v1/partner/users/{userId}/orders List sub-account orders. Query params: `status` (PENDING|WORKING|PROCESSING|COMPLETED|FILLED|REJECTED|CANCELLED), `symbol` (exact exchange-qualified symbol, e.g. SCOM.KE), `cursor`, `limit` (default 50, max 200). Symbol/status filtering is index-safe in production and sandbox. ### GET /api/v1/partner/users/{userId}/orders/{orderId} Single sub-account order. Use for status polling. Response: ```json { "orderId": "ord_xyz789", "type": "BUY", "status": "FILLED", "symbol": "SCOM.KE", "quantity": 100, "priceAtOrder": 16.50, "usdPriceAtOrder": 0.1274, "feeAmount": 0.10, "totalAmount": 12.84, "currency": "USD", "createdAt": "2026-05-01T09:00:00.000Z", "settledAt": "2026-05-01T10:15:00.000Z" } ``` ### DELETE /api/v1/partner/users/{userId}/orders/{orderId} Cancel an active PENDING or WORKING sub-account order in production or sandbox. BUY cash and SELL unit reservations are released. --- ## 15. Sub-Account Portfolio & Transactions ### GET /api/v1/partner/users/{userId}/portfolio Holdings and portfolio summary for a sub-account. Response: ```json { "subAccountId": "usr_abc123", "externalId": "usr_8821", "summary": { "walletBalance": 289.48, "portfolioValue": 2410.52, "investedCapital": 2100.00, "unrealisedPnl": 310.52, "totalValue": 2700.00 }, "holdings": [ { "symbol": "SCOM.KE", "stockName": "Safaricom PLC", "units": 100, "avgCost": 0.1274, "currentValue": 13.10, "investedCapital": 12.74, "unrealisedPnl": 0.36, "currency": "USD" } ] } ``` ### GET /api/v1/partner/users/{userId}/portfolio/history Daily raw-equity history for one partner-owned sub-account. Query params: `period` (1M|3M|6M|1Y|ALL), `from`, `to`. The series includes wallet cash and holdings and is explicitly not cash-flow adjusted P&L. ### GET /api/v1/partner/users/{userId}/portfolio/performance Cash-flow-adjusted performance for one partner-owned sub-account. Query params: `period` (1M|3M|6M|1Y|ALL), `from`, `to`, and optional exchange-qualified `benchmark`. Completed deposits and withdrawals are external cash flows. Returns daily P&L, Modified Dietz daily returns, linked cumulative TWR, and optional benchmark/excess return. ### GET /api/v1/partner/users/{userId}/transactions Transaction history. Query params: `type` (DEPOSIT|WITHDRAWAL|INVEST|SELL|DISTRIBUTION|REDEEM|FEE|TRANSFER_IN|TRANSFER_OUT), `from` (ISO date), `to` (ISO date), `cursor`, `limit`. Completed rows include `settledAt`; legacy completed rows return their immutable completion/creation timestamp when the original field was absent. ### GET /api/v1/partner/users/{userId}/watchlist List the symbols a sub-account has saved. Response: `{ subAccountId, watchlist: [{ symbol, addedAt }] }`. ### POST /api/v1/partner/users/{userId}/watchlist Add a symbol to the sub-account watchlist. Body: `{ "symbol": "SCOM.KE" }`. Requires `Idempotency-Key`. ### DELETE /api/v1/partner/users/{userId}/watchlist/{symbol} Remove a symbol from the watchlist. Requires `Idempotency-Key`. --- ## 16. Subscribe to Bonds, Funds, Private Deals ### POST /api/v1/partner/users/{userId}/subscribe Unified subscription endpoint for non-equity assets. Full amount escrowed immediately. BOND body: `{ "assetType": "BOND", "assetId": "ke-treasury-91", "units": 10 }` FUND body: `{ "assetType": "FUND", "assetId": "mmf-ke-001", "units": 500 }` OPPORTUNITY/PRE_IPO body: `{ "assetType": "OPPORTUNITY", "assetId": "deal-001", "amount": 5000.00 }` Response (202): ```json { "message": "Commitment registered.", "orderId": "ord_bond_001", "reservedUsd": 120.00, "status": "PENDING" } ``` Status lifecycle: `PENDING → PROCESSING → ALLOCATED` ### POST /api/v1/partner/users/{userId}/redeem Redeem fund units (only for funds with `redemptionType === "instant"`). Body: `{ "holdingId": "mmf-ke-001", "unitsToRedeem": 100 }` Response: ```json { "message": "Redemption successful. Funds credited to sub-account wallet.", "proceeds": 102.50, "fundName": "MyStocks Money Market Fund", "pricePerUnit": 1.025, "unitsRedeemed": 100 } ``` --- ## 17. Reports ### GET /api/v1/partner/report/aum Total AUM across all sub-accounts, broken down by asset class. ### GET /api/v1/partner/report/positions All open positions across all sub-accounts. ### GET /api/v1/partner/report/fees Trading fee report. Query params: `from`, `to` (ISO dates). Returns total fees, trade count, and monthly breakdown. ### GET /api/v1/partner/report/revenue Partner revenue report — markups, referral fees, and net earnings. Query params: `from`, `to`, `groupBy` (day|month) Response: ```json { "totalRevenue": 1250.00, "currency": "USD", "breakdown": [ { "period": "2026-05", "markupRevenue": 420.00, "trades": 180 } ] } ``` ### GET /api/v1/partner/report/invoice Monthly invoice for platform fees. Query params: `month` (YYYY-MM) Response: ```json { "invoiceId": "inv_2026_05", "month": "2026-05", "partnerName": "Acme Corp", "baseFees": 840.00, "markupRevenue": 420.00, "netPayable": 420.00, "currency": "USD", "lineItems": [ { "date": "2026-05-01", "trades": 12, "fee": 28.50 } ] } ``` --- ### GET /api/v1/partner/report/reconciliation Daily reconciliation pack: cash ledger, securities ledger, unsettled trades, fees, dividends, corporate actions, and custody positions across the master account and all sub-accounts. JSON includes `proof.status`, a cash roll-forward, and per-instrument beneficial-versus-custody exceptions. Query params: `asOf` (YYYY-MM-DD) or `from`/`to` range; `format=csv§ion=summary|cash|securities|unsettled|fees|dividends|custody_positions` downloads one section as CSV. ### GET /api/v1/partner/orders/{orderId}/executions ### GET /api/v1/partner/users/{userId}/orders/{orderId}/executions OMS-style execution reports — every order lifecycle transition (accepted, processing, completed, rejected, cancelled) with timestamps, for partner-level and sub-account orders. A filled legacy order that predates the immutable journal returns one compatibility FILL marked `synthetic: true` and `sourceEvidence: LEGACY_ORDER_STATE`, never an unexplained empty list. ### GET /api/v1/partner/client-activity Unified reverse-chronological activity feed across all sub-accounts: trades, deposits, withdrawals, subscriptions, redemptions, KYC changes. Supports `limit` and cursor pagination. --- ## 17b. Enterprise Security & Certification (production only) ### GET /api/v1/partner/security ### PATCH /api/v1/partner/security Read/update the enterprise security policy for your key: `ipAllowlist`, `requireSignedRequests`, `requireMtls`, `keyRotationDays`, scoped-key governance, and security evidence URLs. Once signed requests or mTLS are enabled, later write requests must satisfy the configured controls. ### POST /api/v1/partner/oauth/token OAuth 2.0 client-credentials grant (requires `oauthClientCredentialsEnabled` in the security policy). Send the `pk_live_` key as client secret via HTTP Basic auth, form body, or JSON body; returns a 15-minute `ms_oauth_` Bearer token, optionally narrowed to a scope subset (e.g. `market:read trading:read`). ### GET /api/v1/partner/certification ### PATCH /api/v1/partner/certification ### POST /api/v1/partner/certification Go-live certification checklist (sandbox golden path, concurrency/idempotency, webhook retry, failover drill, reconciliation exports, enterprise security, MyStocks approval). PATCH partner-owned checks with `status`, `evidenceUrl`, `notes`; POST requests the final MyStocks go-live review. --- ## 18. Fund Flow (Partner ↔ MyStocks) ### POST /api/v1/partner/topup Request a capital injection into the partner's master wallet. MyStocks settles via wire/SWIFT. Body: `{ "amount": 100000, "currency": "USD", "note": "Q2 capital allocation" }` ### GET /api/v1/partner/topup List top-up request history. ### POST /api/v1/partner/payout Request a payout from the partner's master wallet. Body: ```json { "amount": 50000, "currency": "USD", "bankDetails": { "bankName": "Stanbic Bank", "accountNumber": "0123456789", "accountName": "ACME Fintech Ltd", "swiftCode": "SBICKENX" } } ``` ### GET /api/v1/partner/payout List payout request history. ### GET /api/v1/partner/float Master-account funding headroom: current USD master balance, your `creditLimitUsd` line, `lowBalanceThresholdUsd`, and `availableToFundUsd` (balance + credit line still available to fund sub-accounts). Poll this, or subscribe to the `float.low` event, to remit before end-user funding calls start failing. ### PATCH /api/v1/partner/float Set your low-balance alert threshold (`lowBalanceThresholdUsd`) — the level at which a `float.low` webhook/stream event fires. Requires `Idempotency-Key`. --- ## 19. Dividends ### GET /api/v1/partner/dividends/calendar Upcoming dividend declarations for stocks held by the partner's sub-accounts. `partnerEligible: true` flags dividends where at least one sub-account holds the stock. ### GET /api/v1/partner/dividends/{symbol}/history Historical dividend declarations for a single symbol (ex-date, pay-date, amount, currency), regardless of holdings. Query params: `limit`. Market-data endpoint — usable with a read-only data key. ### GET /api/v1/partner/users/{userId}/dividends Dividend payment history for a specific sub-account. ### GET /api/v1/partner/report/dividends Aggregated dividend report across all sub-accounts. Query params: `from`, `to` (ISO dates) Response: ```json { "totalUsdReceived": 12450.00, "distributionCount": 87, "bySymbol": [{ "symbol": "SCOM.KE", "totalUsd": 4200.00, "count": 30 }], "bySubAccount": [{ "subAccountId": "usr_abc", "displayName": "John Doe", "totalUsd": 210.50 }] } ``` --- ## 20. Webhooks ### POST /api/v1/partner/webhooks Register a webhook endpoint. `secret` must be at least 16 characters. Body: ```json { "url": "https://yourapp.com/webhooks/mystocks", "events": ["trade.settled", "deposit.confirmed", "kyc.updated"], "secret": "your-secret-min-16-chars" } ``` Response: `{ "id": "wh_abc123", "url": "...", "events": [...], "status": "active" }` ### GET /api/v1/partner/webhooks List registered webhooks. ### DELETE /api/v1/partner/webhooks/{id} Delete a webhook. ### Available events ``` trade.settled deposit.confirmed wallet.credited trade.rejected withdraw.confirmed kyc.updated dividend.paid account.frozen incident.declared incident.resolved ``` ### Signature verification (Node.js) ```javascript import { createHmac, timingSafeEqual } from 'crypto'; function verifyWebhook(rawBody, signature, secret) { const expected = 'sha256=' + createHmac('sha256', secret).update(rawBody).digest('hex'); // timingSafeEqual prevents timing attacks — never use === for HMAC comparison return timingSafeEqual(Buffer.from(expected), Buffer.from(signature)); } // Express / Next.js route handler: app.post('/webhooks/mystocks', express.raw({ type: '*/*' }), (req, res) => { const sig = req.headers['x-mystocks-signature']; // lowercase header name if (!verifyWebhook(req.body.toString(), sig, process.env.MYSTOCKS_WEBHOOK_SECRET)) { return res.status(401).json({ error: 'Invalid signature' }); } const { event, data, timestamp } = JSON.parse(req.body.toString()); // ... handle event res.json({ received: true }); }); ``` Header: `x-mystocks-signature` (lowercase). Value format: `sha256=`. ### Event payloads **trade.settled:** ```json { "event": "trade.settled", "timestamp": "2026-05-01T10:45:00.000Z", "data": { "subAccountId": "usr_abc123", "externalId": "user_42", "orderId": "ord_xyz789", "type": "BUY", "symbol": "SCOM.KE", "quantity": 500, "priceAtOrder": 16.50, "usdPriceAtOrder": 0.1274, "feeAmount": 0.48, "totalAmount": 64.18, "currency": "USD" } } ``` **trade.rejected:** ```json { "event": "trade.rejected", "timestamp": "2026-05-01T11:00:00.000Z", "data": { "subAccountId": "usr_abc123", "externalId": "user_42", "orderId": "ord_xyz789", "type": "BUY", "symbol": "SCOM.KE", "quantity": 500, "rejectionReason": "Insufficient liquidity on exchange" } } ``` **deposit.confirmed:** ```json { "event": "deposit.confirmed", "timestamp": "2026-05-01T09:12:00.000Z", "data": { "subAccountId": "usr_abc123", "externalId": "user_42", "amount": 38.50, "currency": "USD", "newBalance": 138.50, "localAmount": 5000, "localCurrency": "KES", "fxRate": 129.87 } } ``` **withdraw.confirmed:** ```json { "event": "withdraw.confirmed", "timestamp": "2026-05-01T14:30:00.000Z", "data": { "subAccountId": "usr_abc123", "externalId": "user_42", "amount": 25.00, "currency": "USD", "newBalance": 113.50, "localAmount": 3250, "localCurrency": "KES", "fxRate": 130.00 } } ``` **wallet.credited** — master wallet credited by MyStocks admin: ```json { "event": "wallet.credited", "timestamp": "2026-05-01T09:00:00.000Z", "data": { "amount": 10000, "newBalance": 10000, "currency": "USD" } } ``` **kyc.updated:** ```json { "event": "kyc.updated", "timestamp": "2026-05-01T08:00:00.000Z", "data": { "subAccountId": "usr_abc123", "externalId": "user_42", "kycStatus": "VERIFIED", "kycLevel": "FULL", "reference": "SMILES-KYC-789456" } } ``` **dividend.paid:** ```json { "event": "dividend.paid", "timestamp": "2026-04-25T10:00:00.000Z", "data": { "subAccountId": "usr_abc123", "externalId": "user_42", "symbol": "SCOM.KE", "amountUsd": 12.60, "units": 500, "dividendPerShare": 0.29, "localCurrency": "KES", "dividendId": "div_abc123" } } ``` **incident.declared** — platform-wide; all active partners receive this: ```json { "event": "incident.declared", "timestamp": "2026-05-01T06:15:00.000Z", "data": { "id": "inc_xyz123", "title": "Trading API degraded performance", "severity": "P1", "status": "investigating", "affectedServices": ["trading-api"], "startedAt": "2026-05-01T06:10:00.000Z", "message": "We are investigating elevated latency on order submission." } } ``` **incident.resolved:** ```json { "event": "incident.resolved", "timestamp": "2026-05-01T08:45:00.000Z", "data": { "id": "inc_xyz123", "title": "Trading API degraded performance", "severity": "P1", "status": "resolved", "resolvedAt": "2026-05-01T08:45:00.000Z", "duration": "2h 35m" } } ``` ### Delivery guarantee & retry schedule MyStocks attempts delivery immediately, then retries: 5s → 30s → 5m → 30m → 2h. After 6 failed attempts, delivery is marked `failed`. Endpoint must return HTTP 2xx within 8 seconds. Monitor failed deliveries in the partner dashboard. ### POST /api/v1/partner/webhooks/{id}/test Fire a signed test delivery to a registered webhook so you can verify signature handling and endpoint reachability. Requires `Idempotency-Key`. Returns the HTTP status your endpoint responded with. ### GET /api/v1/partner/webhooks/{id}/deliveries Cursor-paginated delivery history for a specific webhook. Each entry: event, HTTP status returned, duration, success/failure. Query params: `limit` (default 50, max 200), `nextCursor` ### GET /api/v1/partner/stream Real-time event stream over Server-Sent Events (`text/event-stream`) — the polling-free alternative to (or complement of) webhooks. Emits the same events (`order.filled`, `order.rejected`, `order.cancelled`, `order.triggered`, `deposit.confirmed`, `withdraw.confirmed`, `kyc.updated`, `dividend.paid`, `float.low`, …). Auth: `Authorization: Bearer pk_live_…` (server) or `?access_token=` for a browser `EventSource` (which can't set headers). Resume after a disconnect with the `Last-Event-ID` header or `?since=` (replays up to the last hour). The stream self-closes near 110s; `EventSource` reconnects automatically. --- ## 21. API Key Management ### GET /api/v1/partner/api-keys/data-key Returns only a masked registry identifier in dataKey plus keyId; dataKey is null when none exists. GET never returns a usable secret. POST /api-keys/data-key issues a read-only credential once; keep secrets on your server and use restricted scopes or short-lived tokens for browser clients. ### POST /api/v1/partner/api-keys/rotate Rotates the calling API key. Old key is revoked immediately; new key is returned. Response: `{ "newKey": "pk_live_yyy...", "revokedAt": "2026-05-01T12:00:00.000Z" }` ### POST /api/v1/partner/api-keys/revoke Permanently revokes the calling API key. Use with caution — this cannot be undone. --- ## 22. Observability ### GET /api/v1/partner/audit Paginated list of every API call made by your key: endpoint, method, IP, user-agent, timestamp. Ordered newest-first. Query params: `limit` (default 50, max 200), `before` (ISO timestamp cursor) Response: ```json { "count": 3, "hasMore": true, "entries": [ { "id": "aud_1", "endpoint": "/api/v1/partner/users/usr_abc/trade", "method": "POST", "ip": "41.139.20.5", "userAgent": "Riven-App/2.1.0", "timestamp": "2026-03-28T10:02:31.000Z" } ] } ``` ### GET /api/v1/partner/usage Daily API call volumes for up to 90 days plus current rate limit window. Query params: `days` (default 30, max 90) Response: ```json { "keyId": "pk_live_a1b2c3...", "tier": "growth", "periodDays": 30, "totalCalls": 14820, "daily": [{ "date": "2026-03-01", "calls": 420 }, { "date": "2026-03-02", "calls": 518 }], "currentWindow": { "limit": 500, "remaining": 487, "resetAt": "2026-03-28T10:03:00.000Z" } } ``` --- ## 23. Partner Settings ### GET /api/v1/partner/settings Returns all partner-level settings: business profile, SMTP config, notification preferences, markup fee configuration. ### PATCH /api/v1/partner/settings Update partner settings. Configurable fields include: - `businessName`, `supportEmail`, `logoUrl`, `primaryColor` - `markupBps` — partner markup fee in basis points (e.g. 25 = 0.25% on top of MyStocks 0.75%) - `smtp` — `{ host, port, user, pass, from }` for partner-branded transactional emails - `notifyOnTrade`, `notifyOnDeposit`, `notifyOnKyc` — boolean notification toggles ### POST /api/v1/partner/settings _(SMTP test)_ Sends a test email using the partner's configured SMTP settings. Response: `{ "message": "Test email sent to you@partner.com" }` ### GET /api/v1/partner/pricing Returns your effective markup pricing: the default `markupBps` plus any per-symbol / per-exchange / per-asset-class overrides that determine the `partnerMarkupFee` added on top of the 0.75% MyStocks base fee. ### PATCH /api/v1/partner/pricing Update your markup pricing (default `markupBps` and override rules). Applies to future quotes and trades. Requires `Idempotency-Key`. --- ## 23b. Price Alerts Back the `price.alert` webhook. Register a threshold on a symbol; when the delayed observed price crosses it while the exchange is open, `price.alert` fires (webhook + SSE stream). Production keys only — not mirrored in sandbox. Thresholds are in the instrument's **local trading currency** — the same basis as a quote's `price`. Alerts are evaluated on the same ~15-minute polling cycle as quotes, so an alert fires on the first poll after the crossing, not at the instant of the tick. Do not use a price alert as an execution trigger; place a resting LIMIT or STOP order instead. Maximum 200 active alerts. ### POST /api/v1/partner/price-alerts Create a price alert. Requires `Idempotency-Key` and a full key (`pk_live_`). Body: ```json { "symbol": "SCOM.KE", "exchange": "NSE", "condition": "above", "threshold": 20.00, "repeat": false, "clientAlertId": "my-ref-1" } ``` `repeat: false` (default) fires once then disarms. `repeat: true` re-arms, but only after the price crosses back through the threshold, so a price hovering at the threshold cannot spam the endpoint. State is one of `ARMED`, `TRIGGERED`, `DISARMED`. ### GET /api/v1/partner/price-alerts List your alerts. Optional `?state=ARMED|TRIGGERED|DISARMED` and `?limit=` (max 200). ### GET /api/v1/partner/price-alerts/{alertId} Fetch a single alert. ### DELETE /api/v1/partner/price-alerts/{alertId} Remove an alert. Requires `Idempotency-Key` and a full key. --- ## 24. SLA ### GET /api/v1/partner/sla Returns real-time system health for all covered services, active incidents with update timeline, upcoming maintenance windows, past 30-day incident history, and the calling partner's SLA tier commitments. SLA portal: https://mystocks.africa/partners/sla SLA Agreement: https://mystocks.africa/partners/sla/docs --- ## Exchange Coverage | Exchange | Code | Country | Asset Types | Timezone | |----------|------|---------|------------|---------| | Nairobi Securities Exchange | NSE | Kenya | Equities, T-Bills, Bonds | Africa/Nairobi | | Nigerian Exchange Group | NGX | Nigeria | Equities, Bonds, ETFs | Africa/Lagos | | Johannesburg Stock Exchange | JSE | South Africa | Equities, ETFs, Bonds | Africa/Johannesburg | | Ghana Stock Exchange | GSE | Ghana | Equities | Africa/Accra | | Bourse Régionale des Valeurs Mobilières | BRVM | West Africa (UEMOA) | Equities | Africa/Abidjan | | Lusaka Securities Exchange | LuSE | Zambia | Equities | Africa/Lusaka | | Uganda Securities Exchange | USE | Uganda | Equities | Africa/Kampala | | Dar es Salaam Stock Exchange | DSE | Tanzania | Equities | Africa/Dar_es_Salaam | --- ## Fees - **Trading fee**: 0.75% of gross trade value (base, applied to all equity trades) - **Partner markup**: configurable via settings (`markupBps`); applied on top of the 0.75% base; visible in quote response as `partnerMarkupFee` - **Subscription/redemption**: no additional fees on bond/fund subscriptions - **Deposit/withdrawal**: no platform fee; partner handles FX conversion --- ## Official TypeScript SDK The official SDK is published as `@mystocks-africa/partner-sdk` on npm. ### Install ```bash npm install @mystocks-africa/partner-sdk ``` Requires Node.js 18+ (native fetch + Web Crypto API). Pass a custom `fetch` via `options.fetch` for Node 16 or Cloudflare Workers. ### Initialise ```typescript import { MyStocksClient } from '@mystocks-africa/partner-sdk'; const client = new MyStocksClient({ apiKey: 'sk_sandbox_...', // sk_sandbox_ for dev, pk_live_ for production environment: 'sandbox', // or 'production' }); ``` ### Resource namespaces | Namespace | Description | |---|---| | `client.market` | Stocks, ETFs, quotes, movers, OHLCV, exchanges, companies | | `client.subAccounts` | Create, deposit, withdraw, trade, KYC, portfolio | | `client.trading` | Partner master-account trading and order management | | `client.webhooks` | Register, test, inspect delivery history | | `client.reports` | AUM, positions, fees, revenue, invoices | | `client.account` | Profile, settings, API keys, audit log, usage, SLA | | `client.fundFlow` | Master wallet top-up and payout requests | | `client.assetClasses` | Bonds, funds, opportunities, market intel, dividend calendar | ### Idempotency Pass `idempotencyKey` on deposit, withdraw, and trade calls: ```typescript await client.subAccounts.deposit(userId, { amount: 500 }, { idempotencyKey: 'dep_001' }); ``` ### Error handling All errors throw `MyStocksError` (extends `Error`) with `code`, `status`, `requestId`: ```typescript import { MyStocksError } from '@mystocks-africa/partner-sdk'; try { await client.subAccounts.trade(userId, { symbol: 'SCOM.KE', type: 'BUY', quantity: 1000 }); } catch (err) { if (MyStocksError.isInsufficientFunds(err)) { /* top-up prompt */ } if (MyStocksError.isKycRequired(err)) { /* KYC redirect */ } if (MyStocksError.isRateLimited(err)) { /* back off */ } } ``` ### Webhook verification ```typescript import { verifyWebhookSignature } from '@mystocks-africa/partner-sdk'; const valid = await verifyWebhookSignature(rawBody, sig, process.env.WEBHOOK_SECRET); if (!valid) return res.status(401).end(); ``` Uses `crypto.subtle` — works in Node.js 18+, Cloudflare Workers, Vercel Edge. ### SDK source Source lives in `packages/sdk-ts/` in the main repository. Regenerate OpenAPI types: `cd packages/sdk-ts && npm run generate:types` --- ## Partner Operations Evidence - `GET /installations` — production-only OnPrem inventory scoped to the authenticated organization; requires accounts:read scope and organization.read for member sessions. Returns up to 25 redacted licenses plus nextCursor; pass it as `after`. License validity, last cloud verification and operator acceptance are distinct from current service health. No keys, private evidence URLs or administrator identifiers are returned. See https://partners.mystocks.africa/partners/docs/onprem-operations for readiness checks and support. - `GET /documents` — list PDF document templates and recent generation evidence. - `POST /documents` — generate an account statement, compliance summary, or partner-wide operations-summary PDF. - `GET /notification-rules` — retrieve notification rules and the supported event/channel catalogues. - `PUT /notification-rules` — replace the validated notification policy (maximum 50 rules). - `GET /reconciliation-signoffs` — list dated reconciliation review sign-offs. - `POST /reconciliation-signoffs` — record reconciliation review evidence and exception counts. Writes require an `Idempotency-Key`. Customer-specific documents are restricted to sub-accounts owned by the authenticated partner. Generated-document records and reconciliation sign-offs are retained as audit evidence. --- ## Contact & Access - Apply for API access: https://mystocks.africa/partners - API documentation: https://partners.mystocks.africa/partners/docs - SLA portal: https://mystocks.africa/partners/sla - Support: support@mystocks.africa - Data licensing: data@mystocks.africa - SLA issues: sla@mystocks.africa - Partnerships: partnerships@mystocks.africa ## Corporate Governance API Corporate-action discovery and authoritative terms: - `GET /corporate-actions` — list events across symbols and exchanges; filters: symbol, exchange, type, status, limit. - `GET /corporate-actions/{actionId}` — retrieve authoritative terms, options, deadlines, defaults, and documents. - `GET /users/{userId}/corporate-actions/{actionId}/entitlement` — retrieve record-date entitlement. - `GET /users/{userId}/corporate-actions/{actionId}/elections` — track the latest election revision and custodian evidence. - `POST /users/{userId}/corporate-actions/{actionId}/elections` — submit or amend an election; requires Idempotency-Key. Shareholder meetings and proxy voting: - `GET /shareholder-meetings` — list AGM, EGM, court, class, and other meetings. - `GET /shareholder-meetings/{meetingId}` — retrieve meeting details, proxy documents, resolutions, and ballot choices. - `GET /users/{userId}/shareholder-meetings/{meetingId}/ballot` — retrieve record-date voting entitlement and ballot. - `GET /users/{userId}/shareholder-meetings/{meetingId}/votes` — track vote revisions and custodian-confirmation evidence. - `POST /users/{userId}/shareholder-meetings/{meetingId}/votes` — submit or amend resolution-level votes; requires Idempotency-Key. Successful writes start in `PENDING_CUSTODIAN`. Downstream acceptance is established only when the instruction becomes `ACCEPTED`; retain the custodian reference, accepted timestamp, and confirmation document URL. Production and sandbox expose the same paths. Sandbox terms, eligibility, and evidence are simulated and are not proof of a live market instruction. ## Partner Console Access and Support Human console access is separate from machine API scopes. Organization members receive system or custom roles; permissions are checked against the current member record on every console request. These routes require a short-lived member-bound console session and are not available to raw partner API keys: - `GET /team` and `PATCH /team` — organization, members, role catalogue, and privileged-role MFA policy. - `POST /team/invites` and `DELETE /team/invites` — create or cancel verified-email invitations. - `PATCH /team/members/{memberId}` — change roles, suspend, or restore a member; the final Owner is protected. - `GET /team/roles`, `POST /team/roles`, `PATCH /team/roles/{roleId}`, and `DELETE /team/roles/{roleId}` — inspect and manage custom roles. - `GET /sessions` and `DELETE /sessions` — inspect or immediately revoke console sessions. - `GET /support` and `POST /support` — list or open organization-scoped P0–P3 support cases. - `GET /support/{ticketId}` and `PATCH /support/{ticketId}` — retrieve details or resolve/close a case. - `POST /support/{ticketId}/messages` — add a partner-visible case reply. Support cases carry tier-specific acknowledgement and next-update clocks plus optional request, order, sub-account, and transaction references. Do not include credentials or unredacted identity/payment data. ## Maker-Checker and Enterprise Access Human high-risk operations can be governed by an organization maker-checker policy. The initiator cannot approve their own request; evidence is bound to the canonical payload fingerprint and execution idempotency key. Approved executions send `X-MS-Approval-Id` with the original mutation. - `GET/PATCH /approvals/policies` — read or configure action rules, thresholds, approver count, expiry, and delegation. - `GET/POST /approvals` and `GET/PATCH /approvals/{approvalId}` — request, inspect, approve, reject, cancel, or delegate operations. - `GET/PATCH /enterprise/sso` — configure platform-activated SAML or OIDC SSO. - `GET/POST/DELETE /enterprise/scim` — manage one-time SCIM provisioning tokens. - `GET/POST/PATCH /enterprise/access-reviews` — list/start reviews and configure recurring certification. - `GET/PATCH /enterprise/access-reviews/{reviewId}` — inspect subjects and record access decisions. - `GET /enterprise/evidence` — download a no-cache JSON evidence package with a SHA-256 Digest header. SCIM 2.0 is served from `/api/scim/v2` and supports Users, Groups, and ServiceProviderConfig. SCIM tokens are shown once, stored as hashes, and scoped to one organization. Removing a user revokes active console access. ## Commercial and historical cash records GET /commercial is production only and requires reports:read scope plus reports.read member permission. Select kind=contracts, invoices, registry or periods. Pages contain at most 25 organization-owned records; follow nextCursor using after for the same kind. This endpoint omits private operator evidence, administrator identity and credentials. Historical cash reports compare operator-supplied USD statement boundaries against resumably scanned account ledgers; they are separate from current-state securities/custody proof. Registry access and installation-license validity are separate records. ## Workspace access update - 5 October 2026 Choose Hosted API, OnPrem or Both. Deployment intent does not grant permissions. GET /api/v1/partner/me?workspace=1 requires verified Firebase identity and returns separate Hosted and installation status, a maximum of 50 installation entries and next actions. POST /api/v1/partner/me accepts {"action":"select_environment","environment":"live"} or {"action":"deployment_preference","deploymentPreference":"both"}. It validates access before navigation and never issues credentials. The personal preference does not change organization authority. Both actions use Firebase identity, not partner API keys, and are exempt from integration idempotency. Explicit Hosted Live approval is independent of OnPrem expiry/revocation. Legacy organizations keep their existing grant checks until explicitly reviewed. Installation evaluation remains Sandbox-only even when the organization has separate Hosted approval. Installation emails contain secure retrieval links, image references and instructions, never raw installation keys. Deployment choices: https://partners.mystocks.africa/partners/docs/deployment-options Workspace status and examples: https://partners.mystocks.africa/partners/docs/partner-workspace ## Self-service OnPrem evaluation (reviewed 6 October 2026) Verified customers can start a 14-day Sandbox-only evaluation at https://partners.mystocks.africa/partners/onprem. One canonical organization, verified contact and account may issue one evaluation; repeat trials and extensions require administrator review. Supply an intended hostname and supported Linux deployment. DNS ownership proof is required for production, while HTTPS routing and authorized Firebase sign-in remain installation prerequisites. The server selects an approved compatible digest; retrieve the key once after recent sign-in. Installation emails contain a secure retrieval link and instructions, never the key. Google-linked image-reader provisioning is a separate resumable step, with visible blockers and scheduled revocation. Kubernetes/private-edge topologies require review. Admins use /admin/partners?tab=onprem, View self-service evaluations, and license management for audited extension/revocation and independent production readiness. See https://partners.mystocks.africa/partners/docs/onprem-activation and https://partners.mystocks.africa/partners/docs/onprem-operations. ## Managed funds catalogue contract GET /api/v1/partner/funds supports category and currency filters. Sandbox reads the same published managed funds with virtual transactions. Responses use pricePerUnit, yieldApy (decimal fraction, nullable), operator and descriptive region. They do not guarantee country, NAV, USD conversions or performance history. ETFs use /etfs. The dashboard displays missing regions and unavailable numbers without hiding records. ## Catalogue and reporting contract clarifications (2026-10-07) Funds: category/currency filters; canonical operator, pricePerUnit, yieldApy (decimal fraction), nullable missing values, root count. Bonds: instrumentType/currency/exchange filters; coupon/currentYield/yieldToMaturity in percentage points. Opportunities: ALL/PRE_IPO/OPPORTUNITY filters; assetType and expectedReturn, nullable maturityDate/expectedExitDate. Orders honor UTC from/to date bounds; users honor active/frozen/closed status and externalId lookup. Invalid limits/cursors return 400. Filtered pages can be empty while hasMore=true; continue nextCursor. Market intelligence supports limit/cursor, exchange/symbol and stable equal-time ordering. AUM reports current stored valuations only, totals and per-account breakdown, generatedAt/historical=false/valuationBasis; asOf requests return 422 HISTORICAL_REPORT_UNSUPPORTED. CSV report bodies are text. See /partners/docs/reports, /partners/docs/bonds-funds and /partners/docs/pagination. Partner actual-wallet FX: POST /users/{userId}/fx/quote creates managed terms; POST /users/{userId}/fx/convert explicitly confirms them. Both require Idempotency-Key and an owned active account. Sandbox is virtual. Live is disabled until identity, partner currency entitlement and funding/payout/reconciliation acceptance are approved. Actual currency wallets use walletContract=2; legacy wallets arrays are non-additive indicative equivalents. Firm currency wallets: POST /api/v1/partner/fx/quote and POST /api/v1/partner/fx/convert. Requires funding permissions and Idempotency-Key; Sandbox uses virtual money. ## Canonical operation index Generated from docs/openapi.yaml. Request and response schemas are in /openapi.json and /openapi.yaml. - GET /orders/blotter (listCustomerOrderBlotter) - GET /users/summary (getCustomerWalletSummaries) - GET /commercial (listPartnerCommercialRecords) - POST /register (createRegister) - GET /account (listAccount) - GET /me (listMe) - POST /me (updatePartnerWorkspace) - POST /session (createPartnerSession) - POST /reset (createReset) - GET /upgrade-request (getUpgradeRequest) - POST /upgrade-request (createUpgradeRequest) - GET /assets (listAssets) - GET /etfs (listEtfs) - GET /etfs/{symbol} (getEtf) - GET /etfs/{symbol}/history (getEtfHistory) - GET /etfs/{symbol}/chart (getEtfChart) - GET /market/quotes (getBatchQuotes) - GET /stocks (listStocks) - GET /stocks/{symbol} (getStocks) - GET /stocks/{symbol}/history (listHistory) - GET /stocks/{symbol}/candles (getStockCandles) - GET /stocks/{symbol}/chart (getStockChart) - GET /stocks/{symbol}/pulse (listPulse) - GET /companies (listCompanies) - GET /companies/tickers (listTickers) - GET /companies/{symbol} (getCompanies) - GET /companies/{symbol}/chart (listChart) - GET /companies/{symbol}/news (listNews) - GET /market-intel (listMarketIntel) - GET /market-intel/{id} (getMarketIntelArticle) - GET /market/status (getMarketStatus) - GET /market/clock (getMarketClock) - GET /market/settlement (getMarketSettlement) - GET /market/holidays (getMarketHolidays) - GET /fx/rates (listFxRates) - GET /quote/{symbol} (getQuote) - POST /trade (createTrade) - GET /portfolio (listPortfolio) - GET /portfolio/history (getPortfolioHistory) - GET /portfolio/performance (getPortfolioPerformance) - GET /orders (listOrders) - GET /orders/{orderId} (getOrder) - DELETE /orders/{orderId} (deleteOrders) - PATCH /orders/{orderId} (patchOrder) - GET /orders/{orderId}/executions (getOrderExecutions) - GET /bonds (listBonds) - GET /bonds/{id} (getBonds) - GET /funds (listFunds) - GET /funds/{id} (getFunds) - GET /opportunities (listOpportunities) - GET /opportunities/{id} (getOpportunity) - POST /auto-register (createAutoRegister) - POST /users (createUsers) - GET /users (listUsers) - GET /users/{userId} (getUsers) - PATCH /users/{userId} (updateUsers) - DELETE /users/{userId} (closeUsers) - POST /users/{userId}/deposit (createDeposit) - POST /users/{userId}/withdraw (createWithdraw) - POST /fx/quote (createMasterCurrencyQuote) - POST /users/{userId}/fx/quote (createSubAccountCurrencyQuote) - POST /fx/convert (confirmMasterCurrencyQuote) - POST /users/{userId}/fx/convert (confirmSubAccountCurrencyQuote) - GET /users/{userId}/wallet (listWallet) - GET /users/{userId}/buying-power (getSubAccountBuyingPower) - GET /users/{userId}/preflight (getTradePreflight) - GET /stream (streamEvents) - GET /price-alerts (listPriceAlerts) - POST /price-alerts (createPriceAlert) - GET /price-alerts/{alertId} (getPriceAlert) - DELETE /price-alerts/{alertId} (deletePriceAlert) - GET /pricing (getPricing) - PATCH /pricing (updatePricing) - GET /float (getFloat) - PATCH /float (updateFloatThreshold) - POST /float (createFloatCreditLimitRequest) - GET /users/{userId}/tax-lots (getSubAccountTaxLots) - GET /users/{userId}/gains (getSubAccountGains) - GET /tax-lots (getTaxLots) - GET /gains (getGains) - GET /buying-power (getBuyingPower) - POST /users/{userId}/trade (createUserTrade) - GET /users/{userId}/portfolio (getUserPortfolio) - GET /users/{userId}/portfolio/history (getUserPortfolioHistory) - GET /users/{userId}/portfolio/performance (getUserPortfolioPerformance) - GET /users/{userId}/orders (listUserOrders) - GET /users/{userId}/orders/{orderId} (getUserOrder) - DELETE /users/{userId}/orders/{orderId} (deleteUsersUserIdOrdersOrderId) - PATCH /users/{userId}/orders/{orderId} (replaceUserOrder) - GET /users/{userId}/orders/{orderId}/executions (getUserOrderExecutions) - GET /users/{userId}/transactions (listTransactions) - POST /users/{userId}/kyc (createKyc) - GET /users/{userId}/devices (listUserDevices) - POST /users/{userId}/devices (registerUserDevice) - DELETE /users/{userId}/devices/{deviceId} (revokeUserDevice) - POST /users/{userId}/subscribe (createSubscribe) - POST /users/{userId}/redeem (createRedeem) - GET /users/{userId}/dividends (listDividends) - GET /users/{userId}/watchlist (listWatchlist) - POST /users/{userId}/watchlist (addToWatchlist) - DELETE /users/{userId}/watchlist/{symbol} (removeFromWatchlist) - GET /client-activity (listClientActivity) - GET /report/operation (getFinancialOperationStatus) - GET /report/aum (listAum) - GET /report/positions (listPositions) - GET /report/fees (listFees) - GET /report/revenue (listRevenue) - GET /report/invoice (listInvoice) - GET /report/reconciliation (getReconciliationReport) - GET /topup (listTopup) - POST /topup (createTopup) - GET /payout (listPayout) - POST /payout (createPayout) - GET /webhooks (listWebhooks) - POST /webhooks (createWebhooks) - DELETE /webhooks/{id} (deleteWebhooks) - GET /webhooks/{id} (getSandboxWebhook) - POST /webhooks/{id}/test (createTest) - GET /webhooks/{id}/deliveries (listDeliveries) - GET /dividends/{symbol}/history (getDividendHistory) - GET /dividends/calendar (listCalendar) - GET /report/dividends (getDividendReport) - GET /api-keys/data-key (listDataKey) - POST /api-keys/data-key (createDataKey) - DELETE /api-keys/data-key (deleteDataKey) - POST /api-keys/rotate (createRotate) - POST /api-keys/revoke (createRevoke) - DELETE /api-keys/revoke (deleteSandboxKeyRevokeAlias) - GET /audit (listAudit) - GET /usage (listUsage) - GET /sla (listSla) - POST /oauth/token (createOAuthToken) - GET /security (getEnterpriseSecurity) - PATCH /security (updateEnterpriseSecurity) - GET /certification (getCertification) - PATCH /certification (updateCertification) - POST /certification (requestGoLiveReview) - GET /installations (listPartnerInstallations) - GET /documents (listPartnerDocuments) - POST /documents (generatePartnerDocument) - GET /notification-rules (getNotificationRules) - PUT /notification-rules (replaceNotificationRules) - GET /reconciliation-signoffs (listReconciliationSignoffs) - POST /reconciliation-signoffs (createReconciliationSignoff) - GET /settings (listSettings) - PATCH /settings (updateSettings) - POST /settings (createSettings) - POST /test-tools/deposit (createTestToolsDeposit) - POST /sandbox/deposit (createSandboxDeposit) - POST /test-tools/trade (createTestToolsTrade) - PATCH /test-tools/orders/{orderId} (updateTestToolsOrder) - POST /sandbox/trade (createSandboxTrade) - GET /test-tools/orders (listTestToolsOrders) - GET /sandbox/orders (listSandboxOrders) - GET /market/movers (getMarketMovers) - GET /market-data/movers (getMarketDataMovers) - GET /market-data/quotes (getMarketDataQuotes) - GET /market/exchanges (getMarketExchanges) - GET /market-data/exchanges (getMarketDataExchanges) - GET /market/snapshot (getMarketSnapshot) - GET /market/ohlcv (getMarketOhlcv) - GET /market-data/ohlcv (getOhlcv) - POST /apply (submitPartnerApplication) - GET /corporate-actions (listCorporateActions) - GET /corporate-actions/{actionId} (getCorporateAction) - GET /users/{userId}/corporate-actions/{actionId}/entitlement (getCorporateActionEntitlement) - GET /users/{userId}/corporate-actions/{actionId}/elections (getCorporateActionElection) - POST /users/{userId}/corporate-actions/{actionId}/elections (submitCorporateActionElection) - GET /shareholder-meetings (listShareholderMeetings) - GET /shareholder-meetings/{meetingId} (getShareholderMeeting) - GET /users/{userId}/shareholder-meetings/{meetingId}/ballot (getShareholderBallot) - GET /users/{userId}/shareholder-meetings/{meetingId}/votes (getShareholderVote) - POST /users/{userId}/shareholder-meetings/{meetingId}/votes (submitShareholderVote) - GET /team (getPartnerTeam) - PATCH /team (updatePartnerAccessPolicy) - POST /team/invites (invitePartnerMember) - DELETE /team/invites (cancelPartnerInvitation) - PATCH /team/members/{memberId} (updatePartnerMember) - GET /team/roles (listPartnerRoles) - POST /team/roles (createPartnerRole) - GET /sessions (listPartnerSessions) - DELETE /sessions (revokePartnerSession) - PATCH /team/roles/{roleId} (updatePartnerRole) - DELETE /team/roles/{roleId} (deletePartnerRole) - GET /support (listPartnerSupportTickets) - POST /support (createPartnerSupportTicket) - GET /support/{ticketId} (getPartnerSupportTicket) - PATCH /support/{ticketId} (closePartnerSupportTicket) - POST /support/{ticketId}/messages (replyToPartnerSupportTicket) - GET /approvals/policies (getPartnerApprovalPolicy) - PATCH /approvals/policies (updatePartnerApprovalPolicy) - GET /approvals (listPartnerApprovals) - POST /approvals (createPartnerApproval) - GET /approvals/{approvalId} (getPartnerApproval) - PATCH /approvals/{approvalId} (decidePartnerApproval) - GET /enterprise/sso (getPartnerSso) - PATCH /enterprise/sso (updatePartnerSso) - GET /enterprise/scim (listPartnerScimTokens) - POST /enterprise/scim (createPartnerScimToken) - DELETE /enterprise/scim (revokePartnerScimToken) - GET /enterprise/access-reviews (listPartnerAccessReviews) - POST /enterprise/access-reviews (createPartnerAccessReview) - PATCH /enterprise/access-reviews (schedulePartnerAccessReviews) - GET /enterprise/access-reviews/{reviewId} (getPartnerAccessReview) - PATCH /enterprise/access-reviews/{reviewId} (decidePartnerAccessReview) - GET /enterprise/evidence (exportPartnerEvidence) - GET /documents/{id} (downloadSandboxDocument) - GET /public-brand (getPublicPartnerBrand) - GET /openapi.json (getPartnerOpenApiJson) - GET /openapi.yaml (getPartnerOpenApiYaml) # Published Pre-IPO integration Source: https://partners.mystocks.africa/partners/docs/pre-ipo-integration ## What can a partner browse? `GET /opportunities?type=PRE_IPO` includes published offering information with `PUBLISHED`, `LISTED` or `ALLOCATED` status, including Dangote when published. `catalogueSource` distinguishes `PUBLISHED` information from `SYNTHETIC` demos. Sandbox rows have `simulationOnly: true`. Neither publication nor Sandbox availability guarantees production allocation eligibility. ## How do we commit virtual funds? Follow the [executable Pre-IPO recipe](/partners/docs/recipes/published-pre-ipo). Obtain an actual ID from the list, read `/opportunities/{id}`, check `subscriptionAvailable`, `subscriptionRestriction` and `minimumCommitmentUsd`, then submit `{ assetType: "PRE_IPO", assetId, amount }` to the Sandbox customer's subscribe endpoint with a stable `Idempotency-Key`. The customer must already have sufficient virtual USD. IDs are canonical subscription identifiers; slugs are browsing aliases. No real shares, production reservations, customer wallets or offering funding totals change. Verify the resulting virtual holding, order and wallet, then replay the identical request to prove it cannot debit twice. ## What does admin handle? `/admin/partners` tracks partner access and acceptance evidence. `/admin/pre-ipo` owns real published offering information and the actual offering lifecycle. Keep those controls distinct from virtual Sandbox commitments. Production eligibility, reservation and allocation require their separate reviewed workflow. ## What errors should we handle? An unknown or unpublished offering returns 404. Wrong asset type, unavailable USD terms or a below-minimum virtual commitment are rejected. Display the returned restriction; do not invent FX or assume that a listed offering remains open for new real subscriptions. See [API Reference](/partners/docs/api-reference), [acceptance](/partners/docs/integration-acceptance) and [errors](/partners/docs/errors). # Hosted API, OnPrem or both Source: https://partners.mystocks.africa/partners/docs/deployment-options ## Can one account use Hosted API and OnPrem? Yes. Choose **Hosted API**, **OnPrem** or **Both** during onboarding. One partner account can have hosted API access and installations, with separate approvals and credentials. Choosing a deployment model records your intent; it does not authorize production access. | Choice | Start here | Production requirement | | --- | --- | --- | | Hosted API | [Register](https://partners.mystocks.africa/partners/register), then build in Sandbox | Approved Hosted Live access and an active production API credential | | OnPrem | [Start a 14-day evaluation](https://partners.mystocks.africa/partners/onprem#request) with a verified account, or request administrator review | Installation license, release, identity and production readiness approval | | Both | Register once and request an installation under the same approved organization | Hosted and installation approvals are independent | A Hosted API/Both partner application approval explicitly approves Hosted Live. An OnPrem-only partner application creates evaluation access. Approving an OnPrem request or preparing its evaluation package does not approve Hosted Live, including when that installation request says Both. Administrators can review Hosted Live separately in the organization's workspace. Existing organizations keep their established permissions when an installation request is linked. ## What does Sandbox versus Live mean? **Sandbox** is the testing environment. **Live** uses production authorization and can affect real accounts and funds. The dashboard selector checks access on the server before navigating; changing the selection does not issue a key or approve your organization. API authentication also rechecks permissions on each call. | Environment | Direct hosted base URL | Credential | Important boundaries | | --- | --- | --- | --- | | Sandbox | `https://mystocks.africa/api/sandbox/v1/partner` | `sk_sandbox_` | Synthetic execution; sandbox prices delayed 15 minutes; enterprise/team/security endpoints unavailable | | Live | `https://mystocks.africa/api/v1/partner` | `pk_live_` or an authorized derived credential | Hosted approval, scopes, organization status, commercial and financial controls still apply | Master `/trade` and `/payout` deliberately reject Sandbox requests. Check each operation's availability in [the API catalog](/partners/docs/api-products); do not assume full environment parity. [Market-data tiers](/partners/docs/market-data) explain the current 15-minute delay for Sandbox and paid licenses, and the prerequisites for future real-time delivery. ## Which credential should I use? | Credential | Purpose | Lifecycle | | --- | --- | --- | | Sandbox API key | Synthetic Sandbox integration | Managed in the Sandbox console; never a production approval | | Production full API key | Authorized Hosted Live integration from your backend | Issued through the approved console; rotation/revocation retains the stable organization | | Data key | Restricted read-only market-data families | Derived from a parent API credential; no trading, funding or customer PII | | OAuth token | Short-lived authorized API calls | Inherits key type/scopes; expires after 15 minutes and remains subject to current authorization | | Firebase ID token | Signed-in portal actions | Represents the user, not a partner integration API key | | Installation license credential | Domain-bound gateway authorization | Temporary or permanent/revocable license; installed privately and bound to enrolled installation identity | Do not put an installation credential into hosted API examples or expose it to browsers. [Key Management](/partners/docs/key-management) covers API rotation; [activation and renewal](/partners/docs/onprem-activation) covers installation credentials and authenticated one-time retrieval. Notification emails contain retrieval links and instructions, not secret keys. ## Can we evaluate before DNS is ready? Yes. Hosted evaluation requires no installation domain. Self-hosted evaluation permits synthetic Sandbox workflows before ownership verification, but still needs appropriate hostname routing, HTTPS and sign-in configuration. Production activation requires a fresh verified ownership challenge, enrolled identity, an approved compatible image and an active applied commercial contract. DNS proof alone never enables production. ## Who operates each component? | Responsibility | Hosted API | OnPrem | | --- | --- | --- | | API hosting and platform workers | MyStocks | MyStocks cloud remains authoritative; partner operates the gateway | | Host, container runtime, storage and backups | MyStocks | Partner, using the approved deployment runbook | | Installation domain, routing DNS and TLS | Not required for direct hosted API access | Partner; ownership TXT/CNAME is separate from routing and TLS | | Application secrets and integration behavior | Partner | Partner; also protect the installation private identity | | Licensing, production approval and cloud permissions | MyStocks administration | MyStocks administration with partner readiness evidence | | Wallet, order, KYC and settlement authority | MyStocks platform controls | The same cloud controls; no offline trading or local balance authority | | Monitoring and incident response | Shared integration responsibility | Shared; partner additionally monitors its host and gateway | Next: [use your workspace](/partners/docs/partner-workspace), [build the API integration](/partners/docs/quickstart), or [install OnPrem](/partners/docs/onprem-installation). # On-prem deployment Source: https://partners.mystocks.africa/partners/docs/onprem For Hosted API/OnPrem/Both choices, separate approvals and credential lifecycles, start with [Deployment options](/partners/docs/deployment-options) and [Partner workspace](/partners/docs/partner-workspace). ## What runs on your infrastructure? The on-prem image hosts the partner workspace and a restricted HTTP proxy on your own HTTPS domain. MyStocks Cloud remains authoritative for trading, balances, membership, permissions and licensing. An active cloud connection is required: this is not an offline exchange. Reviewed October 6, 2026. Use the approved release digest and installation instructions supplied for your organization. ## Start here 1. [Request onboarding and access](https://partners.mystocks.africa/partners/onprem#request). Start a 14-day self-service evaluation with a verified account, or request administrator review for Enterprise access and unsupported topologies. 2. [Prepare and install](/partners/docs/onprem-installation): host, registry, domain, TLS and installer options. 3. [Activate and manage keys](/partners/docs/onprem-activation): verification, expiry, renewal and revocation. 4. [Connect applications](/partners/docs/onprem-connectivity): sign-in, API credentials, sandbox and proxy behavior. 5. [Operate and troubleshoot](/partners/docs/onprem-operations): readiness, upgrades, rollback and support. ## Hosted versus on-prem responsibilities | Responsibility | MyStocks-hosted workspace | On-prem workspace | | --- | --- | --- | | Workspace hosting and TLS | MyStocks | Your infrastructure team | | Server patches, backups and monitoring | MyStocks | Your infrastructure team | | Local proxy, DNS and release upgrades | MyStocks | Your infrastructure team | | API authorization, trading and balances | MyStocks Cloud | MyStocks Cloud | | Team permissions and identity policies | Authorized organization administrators | Authorized organization administrators | | Installation license and domain approval | Not an on-prem requirement | Self-service evaluation policy; administrator approves production; your team installs securely | ## What does the license include? Evaluation approval permits hosted sandbox exploration without DNS. Self-hosted evaluation uses a temporary identity-bound license. Production requires separate domain verification, commercial entitlement and explicit administrator confirmation. A license permits the installation to connect. It does not expand your API entitlements, supported markets, permissions or sandbox capabilities. Self-service evaluation lasts 14 days with one installation identity. Repeat evaluations and extensions require administrator review; reviewed evaluations have an administrator-set expiry. Permanent activation has no scheduled expiry but remains revocable. Pricing, scope and service terms are agreed with sales; this guide makes no additional availability or latency guarantee. ## Can we operate without cloud connectivity? No. Readiness and protected API access fail closed when license verification cannot reach MyStocks. Public pages may still load while the installation is not ready. Plan monitoring and recovery around both local infrastructure and the cloud dependency. ## Public addresses The public documentation home is [partners.mystocks.africa/partners/docs](https://partners.mystocks.africa/partners/docs). Cloud production API calls continue to use `https://mystocks.africa/api/v1/partner`; moving documentation does not change API endpoints. For agents, use the [documentation catalog](/partners/docs/catalog.json), [plain-text source](/partners/docs/raw/onprem), and [OpenAPI contract](https://mystocks.africa/openapi.json). Never include credentials in prompts, examples or support tickets. ## Can I choose Hosted API, OnPrem or both? Yes. Select **Hosted API**, **OnPrem** or **Both** when applying. Your connection preference does not grant an entitlement. One partner account shows **API access** and **Installations & licenses** as separate sections on the dashboard overview. You can change your personal connection preference there. The **Sandbox / Live** selector checks access on the server. Hosted Live approval and an OnPrem production activation are separate decisions. An OnPrem evaluation remains Sandbox-only even if the same organization has Hosted Live approval. Conversely, a separately approved Hosted Live service is not disabled merely because an installation license expires. Existing accounts retain their previous access policy until partner operations makes an explicit Hosted Live decision. | Credential | Purpose | Lifecycle | | --- | --- | --- | | Sandbox API key | Synthetic calls in `/api/sandbox/v1/`; quotes delayed by 15 minutes | Created and rotated in the Sandbox console; cannot authorize Live calls | | Production API key | Approved Live API calls in `/api/v1/partner/` | Issued/rotated for the organization, independently suspendable and revocable; API scopes and commercial entitlements still apply | | Installation license credential | Authorizes a particular gateway, installation identity and domain | Self-service evaluation for 14 days, reviewed temporary access with an admin-set expiry, or permanent and revocable production; retrieval, renewal, domain verification and installation proof are separate from API approval | Partner operations uses **Access & deployments** in `/admin/partners/{partnerId}` to review Hosted Live approval independently from domain verification, installation status, license expiry and the next required action. An approval or block requires an authorized administrator, a review reason, explicit confirmation and recent sign-in. It records audit evidence and queues a customer notification. Installation production activation retains its own DNS, identity and commercial checks. # Install the on-prem platform Source: https://partners.mystocks.africa/partners/docs/onprem-installation [Journey overview](/partners/docs/onprem) · Next: [activation and keys](/partners/docs/onprem-activation) ## Before installation For supported Linux VM deployments, verified customers can choose **Start 14-day evaluation** at [OnPrem Access](https://partners.mystocks.africa/partners/onprem#request). Supply the intended hostname; ownership proof is not required yet. The server selects the latest tested compatible standard image. Check image-download preparation, retrieve the installation key securely and follow the selected command shown in your request. Deployment targets do not create separate product builds. See [evaluation issuance and limits](/partners/docs/onprem-activation). Use the [deployment planner](https://partners.mystocks.africa/partners/onprem#configure) to preview commands for an on-site, AWS, Azure, Google Cloud or other Linux VM. Enter your final choices in the access request. These targets use the same supported installer; your infrastructure team first creates the VM, networking, DNS and identity configuration. Kubernetes and private-edge selections require architecture review and a separate agreed runbook; the planner does not claim to provision them automatically. ### What resources and limits apply? | Item | Current behavior | | --- | --- | | Request body | Up to 10 MiB through the on-prem proxy. | | Ordinary upstream request | 30-second timeout. | | Server-sent events | Connection lifetime up to 300 seconds; reconnect and revalidate. | | Private application port | 3000 by default; installer accepts 1024 through 65535. | | CPU, RAM, disk and concurrent users | No benchmark-certified minimum or throughput guarantee is published. Submit available vCPUs, RAM and disk in GiB, and expected users for capacity review. | | Offline use | Not supported; cloud verification is required for protected access. | These proxy limits do not override cloud endpoint limits or your partner rate-limit tier. Resource fields in the form are planning inputs, not reservations or enforced container quotas. ### Host prerequisites - Obtain an approved organization and authorized accounts. A 14-day self-service evaluation or an administrator-reviewed evaluation permits sandbox-only installation; production requires separate confirmed activation. - Prepare a Linux AMD64 or ARM64 host with Docker Engine, Docker Compose and Python 3. Capacity is agreed during onboarding; no universal sizing guarantee is implied. - Control an exact HTTPS installation domain. TXT or CNAME ownership proof is required before production activation; evaluation installation can precede it. Point A and any AAAA records to working addresses; remove stale IPv6 records. - Allow inbound 80/443 as required by your HTTPS proxy and certificate challenge. Keep the application port private (default loopback port 3000). - Allow DNS and outbound HTTPS to MyStocks, Firebase authentication and your approved image registry. Maintain accurate system time. - Obtain a domain-bound license through a secure channel, registry reader access and an immutable approved image digest. Registry access and the installation license are separate credentials. - Have the identity administrator register your installation domain in the authoritative Firebase project's authorized domains. - Use Safari 16.4+, Chrome 111+ or Firefox 128+ for the workspace. ## Which installer version should we use? These commands were checked against installer revision `ce0c36171` on 3 October 2026. Obtain the approved image **digest** from onboarding; the installer and image have separate versions. The download URL serves the current installer. Verify its checksum before running this revision: ```sh curl -fsSLo install-onprem.sh https://mystocks.africa/install-onprem.sh printf '%s %s\n' '062a79c154403945abb7a2f63097d52e2b85869f3d2c079a11d5247281bf4e5b' 'install-onprem.sh' | sha256sum --check - bash -n install-onprem.sh ``` Stop on checksum mismatch and obtain reviewed release instructions. Do not bypass the check or assume an updated script is compatible with an older image. Keep the verified script with the release record. ## Default installation: Docker and Caddy Authenticate Docker to the registry specified in your release instructions before installation. Download and review the installer; do not pipe an unreviewed script into a privileged shell. ```sh curl -fsSLo install-onprem.sh https://mystocks.africa/install-onprem.sh # Review the file. Replace the domain and image with approved values. sudo bash install-onprem.sh --domain trading.example.com \ --image REGISTRY/IMAGE@sha256:DIGEST \ --mode docker --proxy caddy ``` Enter the license at the hidden terminal prompt. For automation, use `--key-file PATH` with a file readable only by its owner; never put a license in command arguments, shell history or browser code. The installer verifies the license before pulling the image and writes a protected environment file under `/opt/mystocks` by default. The installer uses flags rather than an interactive deployment-choice menu. Docker and Caddy are the defaults. ## Select a proxy | Flag | Required preparation | | --- | --- | | `--proxy caddy` | Working public DNS and certificate-challenge reachability; Caddy obtains TLS certificates. | | `--proxy nginx` | Install the generated configuration, provide certificates at its configured paths and validate with `nginx -t`. Certificate issuance is your responsibility. | | `--proxy traefik` | Provide the existing proxy network, `websecure` entrypoint and `letsencrypt` resolver. Select a network with `--traefik-network`. | | `--proxy none` | Supply and manage an external TLS reverse proxy yourself. | Preserve the verified domain's Host header, keep upstream port 3000 private, and disable response buffering for server-sent events. Do not disable TLS certificate verification. The generated installer configuration differs from the repository's example Compose networking; use one complete configuration rather than mixing fragments. ## Exact proxy commands After verifying the script, set your approved values. The digest must contain 64 hexadecimal characters: ```sh DOMAIN='trading.example.com' IMAGE='REGISTRY/IMAGE@sha256:DIGEST' # Choose ONE command matching your prepared infrastructure: sudo bash install-onprem.sh --domain "$DOMAIN" --image "$IMAGE" --mode docker --proxy caddy sudo bash install-onprem.sh --domain "$DOMAIN" --image "$IMAGE" --mode docker --proxy nginx sudo bash install-onprem.sh --domain "$DOMAIN" --image "$IMAGE" --mode docker --proxy traefik --traefik-network proxy sudo bash install-onprem.sh --domain "$DOMAIN" --image "$IMAGE" --mode docker --proxy none ``` Do not run all four alternatives. Nginx needs your installed TLS certificates; Traefik needs the existing `proxy` network, entrypoint and resolver described above. Use `--output-dir` consistently when your approved installation directory differs from `/opt/mystocks`. ## Native service option Use `--mode bare-metal --proxy nginx` or `--proxy none` on Debian 12 or Ubuntu 24.04 with Node.js 22 and systemd. Docker is still required to extract the matching glibc image bundle. The application runs as a dedicated unprivileged service user; this is not a Docker-free installation path. ```sh sudo bash install-onprem.sh --domain "$DOMAIN" --image "$IMAGE" --mode bare-metal --proxy nginx # Or use --proxy none with your independently managed TLS ingress. ``` ## Verify before accepting traffic ```sh curl --fail --show-error https://trading.example.com/api/live curl --fail --show-error https://trading.example.com/api/health ``` Liveness alone is insufficient. Confirm readiness, certificate hostname and chain, authorized sign-in and a read-only API call. Then test authorized sandbox workflows, rejection of anonymous/cross-partner requests, and restart recovery in a dedicated test installation. `--render-only` produces configuration with an invalid fixture credential; it does not deploy or verify a working installation. Continue with [API connectivity](/partners/docs/onprem-connectivity) and [operations](/partners/docs/onprem-operations). ## Which release can an administrator approve? The administration workspace offers tested releases registered after a successful manual image publication. Registration checks the exact GitHub source commit, successful release and publish jobs, the registry's digest bytes, its source tag and its Linux AMD64/ARM64 index. Activation rechecks the approved record, requested architecture and operating system inside its transaction. A retired or incompatible release cannot be substituted. New customer retrieval requires Ed25519 identity support. The email includes the selected immutable image and commands tailored to the request's approved mode, proxy, domain, port and Traefik network. The image is obtained from the private registry with separate reader credentials; it is not an email attachment. No passwords or private keys are emailed. ## How do VM targets differ? | Target | Customer infrastructure responsibilities | | --- | --- | | On-site / other VM | Linux host, DNS delegation, NAT/ingress, outbound DNS/HTTPS, persistent identity directory and time synchronization. | | AWS | Create the Linux instance and persistent storage; configure security groups and your ingress/TLS service. The installer does not provision EC2 or IAM. | | Azure | Create the Linux VM and persistent storage; configure network security groups and ingress/TLS. The installer does not provision Azure resources or identities. | | Google Cloud | Create the Linux VM and persistent storage; configure VPC firewall/ingress and TLS. Registry reader access does not grant project-wide administration. | | Kubernetes / private edge | Architecture review and an approved runbook are required. The VM installer does not claim to create clusters, multi-replica installations or private edge routing. | For every VM target, keep the application port private and expose the chosen exact domain through HTTPS. Caddy requires a reachable certificate challenge on ports 80/443. Nginx requires the operator's certificate files and `nginx -t`. Existing Traefik requires the chosen external Docker network, `websecure` entrypoint and `letsencrypt` resolver. External ingress must preserve Host and avoid SSE buffering. Test the actual firewall and certificate chain after installation; rendered configuration alone does not prove public reachability. ## Which new installation errors require action? | Error | Meaning and next step | | --- | --- | | `APPROVED_RELEASE_INCOMPATIBLE` | Choose a registered, approved image for the requested OS/architecture and identity flow. | | `INSTALLATION_ALREADY_BOUND` | Another cryptographic identity is registered. Ask the administrator to review recovery or migration. | | `INSTALLATION_ENROLLMENT_REQUIRED` | A migration/recovery policy requires the updated runtime to enroll before protected calls. | | `INSTALLATION_PROOF_INVALID` | Check system time, configured domain, persistent key and proxy version. Do not bypass signature checks. | | `INSTALLATION_REPLAY` | A nonce was reused; let the runtime sign a new request. Do not blindly repeat a financial operation without its idempotency key. | | `INSTALLATION_INACTIVE` | The identity/license was retired or changed. Obtain the administrator's current approved recovery instructions. | ## Verify the documentation shipped with this image After installation, open `/docs/api-reference`, follow its sandbox-tester link and confirm both pages load from your installation. The reference JavaScript and OpenAPI document are served locally; protected API access still requires the documented cloud connectivity. Read `/api/docs-release` and retain `apiVersion`, `openapiSha256`, `docsSnapshotSha256` and `sourceCommit` with your image digest. API major version identifies the contract generation; the documentation snapshot identifies the exact bundled content. Compare these values to the release record before upgrading. A matching API major alone does not establish compatibility with a newer hosted gateway. If a contract or asset is missing, stop rollout and retain the previous image while checking the approved release bundle. Continue with [Activation and keys](/partners/docs/onprem-activation), then the [operations runbook](/partners/docs/onprem-operations). # OnPrem partner and admin workflow Source: https://partners.mystocks.africa/partners/docs/onprem-workflow ## Can we explore before DNS verification? Yes. Eligible customers can request a restricted evaluation at [OnPrem Access](/partners/onprem). It permits Sandbox exploration before domain ownership proof. It does not grant Live API access or skip identity, licensing and registry checks. [Evaluation and activation rules](/partners/docs/onprem-activation) describe current eligibility and limits. ## What happens after submission? The partner chooses the deployment target and hostname. `/admin/partners?tab=onprem` shows the request, organization association, approval scope, license expiry, domain state, installation release and next action. Admin confirms the authorized decision; shared state and notification records must reflect it. Retrieve the actual installation secret through the secure setup flow, not a public documentation page. ## Which credentials do we use? | Credential | Purpose | | --- | --- | | Sandbox API key | Virtual hosted API requests. | | Production API key | Separately approved Live API requests. | | Installation license | Domain and installation policy, activation and expiry wall. | | Registry identity | Authorized download of the approved image. | None is interchangeable. Do not send passwords, private keys or licenses in onboarding free-text fields. ## How do we install? Follow the [versioned installation guide](/partners/docs/onprem-installation) for exact flags, checksum, DNS, TLS, ports, proxy modes, health checks, upgrade and rollback. Supported VM targets use one standard digest-pinned image, selected for the required architecture. Kubernetes and private-edge targets require a separately reviewed runbook. The installer uses explicit flags and secure key input; it does not provision an entire cloud network automatically. ## How do verification and renewal work? Publish the selected TXT or CNAME record in the partner's DNS zone. Verification can be pending, verified or failed and must be checked separately from request approval. Before Live activation, complete applicable domain and identity checks. Temporary licenses expire at the approved time; permanent licenses remain revocable. The expiry wall requires a new approved activation or renewal. Registry download access is a separate state and scheduled revocation can lag until cleanup succeeds. Follow [the OnPrem recipe](/partners/docs/recipes/onprem-installation-and-renewal), [administration](/partners/docs/onprem-operations), [API connectivity](/partners/docs/onprem-connectivity) and [troubleshooting](/partners/docs/onprem-operations). Successful email dispatch alone does not prove delivery, installation or API connectivity. # On-prem activation and keys Source: https://partners.mystocks.africa/partners/docs/onprem-activation [Journey overview](/partners/docs/onprem) · Next: [connect applications](/partners/docs/onprem-connectivity) ## Start a self-service evaluation 1. Sign in with a verified email at [OnPrem Access](https://partners.mystocks.africa/partners/onprem#request). Enter your organization and intended installation hostname, select a supported deployment and accept the terms. 2. Choose **Start 14-day evaluation**. The server selects the latest approved compatible immutable image and issues a temporary Sandbox-only license. You cannot select permanent access, change the duration or grant yourself Hosted Live. 3. Open **Your requests** and retrieve the key once after recent sign-in. The installation email provides a retrieval link, image and installation alternatives; it contains no plaintext secret. 4. Follow the installation guide and enroll one Ed25519 identity. DNS ownership verification can wait until production; hostname routing, HTTPS and authorized Firebase sign-in are still required. 5. Inspect image-download setup in the request. Link the approved email to Google sign-in and use **Retry image-download setup** if needed. Preparation uses existing repository-scoped IAM and scheduled revocation. Failed IAM or an unhealthy expiry worker is a platform-operator task; issuance does not prove download access is ready. The 14 days start at issuance, including time spent preparing infrastructure. One self-service evaluation is permitted per canonical organization, verified contact and account. Changing the request reference or creating another account with the same email does not restart the trial. Existing invited or non-owner team members must use their organization owner or administrator review instead of creating a second organization. This is not proof of legal company identity; suspected duplicate organizations need administrator review. Previous issued evaluations cannot be restarted through self-service. Lost keys, expired retrieval offers, extensions and repeat evaluations require an administrator. Kubernetes and private-edge topologies require a reviewed enterprise runbook. No compatible approved image returns `APPROVED_RELEASE_UNAVAILABLE`; no trial is consumed until issuance commits successfully. ## Request administrator-reviewed access 1. Submit the [OnPrem Access form](https://partners.mystocks.africa/partners/onprem#request) with your organization, contact and requirements. A new evaluation request may omit its installation domain. Use the same form for a renewal request. 2. An administrator selects **Confirm Approval — Evaluation access** and an exact expiry without DNS proof. New customers receive an evaluation organization; linking an existing organization requires explicit confirmation and preserves its established permissions. The approval email links to the hosted sandbox. 3. When ready to self-host, select your domain and deployment profile in the signed-in request before license issuance. An administrator selects one approved compatible image and confirms temporary evaluation installation access, bounded by your approved evaluation expiry. DNS ownership proof is required before production activation, rather than evaluation approval or issuance. A reachable HTTPS hostname, routing DNS and authorized sign-in domain are still required for installation and login. 4. For new request-based activations, sign in to the authenticated retrieval workspace linked by email and retrieve the installation credential once. The offer lasts at most 24 hours and never extends beyond license expiry; sign-in must be within the last 15 minutes. Self-service selects an approved compatible digest automatically; administrator-reviewed applications must also use an approved immutable digest. Activation email includes that image reference and instructions tailored to your selected deployment, without the secret. Registry reader access is separate from the key; check preparation status before pulling the image. 5. Install the key on the approved server and confirm readiness. The image registers one Ed25519 installation identity; preserve its private identity across restarts and key replacement. A license does not automatically enroll MFA or configure your identity provider. Copies, replicas and disaster recovery require review. 6. For production, publish and check a fresh TXT or CNAME ownership challenge, obtain active applied commercial entitlements and use the administrator's **Confirm Production Activation** decision. DNS verification alone never grants production authority. ## Can we explore before verifying DNS? Yes. Hosted evaluation requires neither an installation domain nor DNS verification. Self-hosted evaluation permits synthetic sandbox workflows only. Live trading, funding, payouts, production streams, direct API keys, data keys and OAuth tokens cannot bypass the applicable evaluation restriction. A separately approved Hosted Live organization can use its own hosted credentials directly, while the evaluation installation remains Sandbox-only. Sandbox enterprise/team/security operations remain unavailable. Sandbox and paid-license quotes currently have a 15-minute delay. Real-time delivery is unavailable pending approved feed verification. Check [market-data implementation status](/partners/docs/market-data) before assuming the deployed feed changes with a license. Account-event delivery is separate from quote timing. ## How does administration manage a self-service evaluation? Open `/admin/partners?tab=onprem` and **View self-service evaluations** to see all states, including active, expired and revoked records. The request shows its issuance source, policy duration, selected deployment, image-download blocker and owner. Open license management to inspect identity and retrieval, replace an offer, revoke, or approve an evaluation extension with an exact expiry. Self-service extensions and revocations require a review reason recorded in the audit. An extension stays Sandbox-only, retires prior credentials and queues a new retrieval offer; it never promotes production. Customer request status and administrative license state are shared records. Expiry is enforced when requests are authenticated even before the scheduled worker updates display state. Notifications and audit records accompany lifecycle decisions; queued notifications are not inbox proof. ## What does the production readiness panel check? In `/admin/partners`, administrators see approval, license, domain, identity, release and commercial readiness. Production confirmation requires the correct approved organization and active full credential, an active evaluation installation with enrolled identity, a fresh verified unused ownership challenge, an approved compatible image, and an active commercial contract with entitlements applied to that organization. Choose temporary expiry or permanent, revocable duration separately. Activation preserves the stable license and installation identity, retires evaluation credentials and creates a replacement authenticated retrieval offer. Update the existing server key securely and recheck readiness. Shared state, notification and audit evidence are committed together. Existing production organizations retain their established permissions. Organizations without an explicit Hosted Live decision retain legacy direct-access checks, including linked installation grants and commercial contracts. An explicit Hosted approval establishes an independent hosted lifecycle; it never overrides installation licensing. See [workspace access status](/partners/docs/partner-workspace). ## Temporary versus permanent Duration and entitlement are separate. Evaluation is always temporary and sandbox-only. Production can be temporary or permanent. Neither duration expands cloud API scopes, market-data licensing, trading permissions or team roles. A permanent installation does not override an expired commercial agreement. Temporary access ends at its configured expiry. Permanent access has no scheduled expiry, but an administrator can revoke it. Both remain bound to the approved domain and partner and require successful cloud verification. Application receipt and lifecycle notifications communicate progress. Email delivery is not proof that the installation is active: verify the administrative state and `/api/health` on the deployed server. ## What happens when a key expires? Protected calls are denied and the installation presents an access wall with a request link. Reminders are queued within 72 hours of expiry, once per expiry value; hosted-only approvals also receive reminders and expiry notices. Submit a renewal for review. **Evaluation renewal** remains temporary and sandbox-only. **Confirm Production Renewal** requires a fresh ownership challenge, active applied commercial contract and the existing enrolled identity. It can restore an expired production license, choose temporary or permanent duration and retire prior credentials. Ordinary production renewal does not revive revoked access. The operator retrieves the replacement credential and rechecks readiness. There is no offline grace period. An active stream can remain open until its bounded lifetime ends; server-sent event connections reconnect at most every five minutes to revalidate authorization. Do not describe expiry as instant termination of every existing connection. ## Replace or recover a key Use the administrator's Replace key action. Issuance revokes the old key, so coordinate the change with the server operator. Rerun the reviewed installer with the same approved domain and image digest, entering the replacement at the hidden prompt (or via an owner-only key file). The installer verifies it, replaces the environment configuration and recreates/restarts the service. A lost one-time credential must be reissued. Do not email keys, paste them into support tickets, or restore a revoked key during rollback. Keep configuration backups in a secret manager with restricted access. ## Change the installation domain A key issued for one domain does not authorize another. Ask an administrator to approve and verify the new domain, update authorized sign-in domains, DNS and TLS, and provide the appropriate replacement activation. Confirm rejection of the old configuration according to the approved migration plan. ## What should an administrator verify before approval? - Match the request to the correct partner organization and exact installation domain. - Review the requested host, OS, CPU architecture, installation mode, proxy, network, identity provider and available resources. Select a release digest built for that architecture. Kubernetes and private-edge topologies require an agreed enterprise runbook before activation. - Approve evaluation without DNS; confirm a fresh supplied ownership challenge before production activation or production renewal. - Choose temporary access with an explicit expiry date/time and timezone, or permanent revocable access. - Confirm customer retrieval status and offer expiry. Replace an expired retrieval offer if necessary; do not include keys in email or tickets. - Confirm the activation email contains installation instructions, then have the operator verify readiness. - For renewal, review the new request, approve the access term, replace the key and recheck readiness. The application, license and activation email share a versioned deployment profile. Replacing a key keeps the previous profile and image unless a new approved application supplies revised choices or the administrator approves another digest. A renewal form restores your previous deployment choices for review; update them if your infrastructure has changed. Resource values describe your proposed host and expected users, not a guaranteed capacity or automatic cloud provisioning request. ## Does an activation email prove access is working? No. The email provides instructions. Registry permission, DNS/TLS, valid credentials, identity setup and successful readiness checks are separate requirements. A replacement key revokes its predecessor; coordinate the handover with the operator before issuing it. ## How do TXT and CNAME verification work? Choose TXT or CNAME in the access request. After partner approval, the administrator prepares a unique challenge for the exact installation hostname, previews the email and chooses **ownership records only** or **all supplied records**. All records includes the ownership challenge and any explicitly supplied routing record; no IP address or hosting destination is invented. Your signed-in request and verification email display the complete name, value, TTL and 72-hour expiry. The administrator can replace an expired challenge. For an installation at `onprem.hostlyke.co.ke`, the full record name is `_mystocks-onprem.onprem.hostlyke.co.ke`. Edit the DNS zone for **hostlyke.co.ke**, not MyStocks. If the DNS provider appends `hostlyke.co.ke`, enter `_mystocks-onprem.onprem` as the Host. Other providers require the full name: check their zone display rather than guessing the relative name. - TXT: enter only `mystocks-onprem=CHALLENGE` in the Value field. - CNAME: enter the exact unique `CHALLENGE.onprem-verification.mystocks.africa` target supplied by the application. The alias itself proves ownership; this verification target is not the API hosting address. - Recommended TTL: 300 seconds, or the provider's supported Automatic setting. Use one method at the verification hostname; do not add a TXT record alongside a CNAME at the same name. Keep installation routing records and HTTPS certificates separate. Customers and administrators can check DNS independently; shared status shows pending, checking, verified or failed, the last check and error. Retry failed checks. A transient failure after successful verification preserves historical proof and displays the latest error; it does not silently revoke existing access. Verification never promotes production access. Signed installation proofs bind protected requests to the enrolled identity; DNS alone cannot prevent credential copying. ## Lost or expired retrieval offers For a customer-delivered license, administrators use **Replace retrieval offer & notify customer** in the license workspace. This invalidates the previous offer without renewing the license. A previously retrieved credential remains valid until the replacement is redeemed; redemption revokes the old credential, so coordinate the server update. The license ID remains stable, including its image-registry grant association. The approved applicant must use the verified account that submitted the request. Forwarding the email does not authorize a different user. Successful retrieval produces the key once, directly into the signed-in page; storage and notification payloads contain no plaintext credential. If the response is lost or the page is refreshed before the key is saved, request a replacement offer. Legacy administrator-delivered licenses retain their existing process until migration. ## One-action evaluation preparation Administrators use **Prepare evaluation package** after organization approval. It upgrades eligible older evaluation requests without changing existing production permissions, selects the latest tested compatible standard image, prepares authenticated key retrieval and provisions repository-only download access for the approved, verified Google-linked account. Evaluation registry access is bounded by approval and license expiry and uses scheduled revocation. Missing images, registry permissions, expiry-worker health or customer setup are shown with the responsible owner and a retry action. No production commercial contract is created for evaluation. The signed-in customer request displays the same next task. DNS challenges last 72 hours and are checked automatically by the existing scheduler; customers can still check immediately. Background verification updates ownership status only. Publication, production confirmation and commercial entitlement remain explicit decisions. Once an administrator authorizes evaluation package preparation, the existing registry-expiry worker retries incomplete packages in bounded batches. It resumes after customer prerequisites or release availability change; it never approves a request or renews an expired evaluation automatically. # On-prem API and identity connectivity Source: https://partners.mystocks.africa/partners/docs/onprem-connectivity [Journey overview](/partners/docs/onprem) · Next: [operations and troubleshooting](/partners/docs/onprem-operations) ## How requests reach MyStocks Your application calls your approved HTTPS installation domain. The on-prem server forwards permitted requests to MyStocks with a server-only installation credential and the caller's own API key or user token. Cloud partner identity, scopes, rate limits and permissions remain authoritative; the installation key is not a replacement for API authentication. | Purpose | Address | | --- | --- | | Cloud production API | `https://mystocks.africa/api/v1/partner` | | On-prem production proxy | `https://YOUR-DOMAIN/api/v1/partner` | | Cloud sandbox API | `https://mystocks.africa/api/sandbox/v1/partner` | | On-prem sandbox proxy | `https://YOUR-DOMAIN/api/sandbox/v1/partner` | Use the endpoint's authentication requirements from [Authentication](/partners/docs/auth) and [OpenAPI](https://mystocks.africa/openapi.json). Start with a permitted read-only request from the [Quick Start](/partners/docs/quickstart), changing only the origin to your approved installation. Keep credentials server-side; do not embed installation secrets in SDKs or browser requests. ## Evaluation boundaries An approved evaluation can open the hosted sandbox without DNS verification. A self-hosted evaluation routes login to the sandbox workspace and permits synthetic sandbox APIs only. Live APIs, direct API keys, data keys, OAuth tokens and production streams cannot bypass the organization restriction. Production requires explicit administrator confirmation after domain, identity and commercial readiness checks. Sandbox and paid-license quotes currently have a 15-minute delay. Real-time delivery is unavailable pending approved feed verification. Check [market-data implementation status](/partners/docs/market-data) before assuming the deployed feed changes with a license. Account-event delivery is separate. ## Sandbox boundaries Use sandbox credentials only with sandbox paths and confirm the required sub-account identifiers. An on-prem license does not enable unavailable sandbox enterprise/team/security operations or master trade/payout operations. Follow the [sandbox guide](/partners/docs/paper-demo-trading) and each endpoint's documented availability. ## Sign-in, SSO and MFA Users sign in with their real MyStocks accounts and must belong to the licensed organization. The installer obtains public Firebase client configuration through license verification; never install a Firebase administrative credential in this image. For SAML/OIDC, configure the active provider in the authoritative Firebase/Identity Platform project and partner SSO settings. Rerun the installer after changing the provider configuration. The exact provider identity is checked; a license alone does not enroll users. Membership creation through invitations or just-in-time provisioning remains subject to configured organization policies. Enrolled Firebase TOTP authenticator challenges are supported. Enroll or recover factors through your identity administrator before enforcing MFA. SMS challenge UI and authenticator enrollment are not included in this image. Verify your actual identity provider; acceptance with one test provider does not certify every vendor configuration. ## Proxy and edge behavior Preserve the approved Host header and use verified HTTPS upstream connections. Configure streaming without response buffering. The application proxy implements HTTP and server-sent events; an edge proxy accepting WebSocket upgrades does not establish a WebSocket API contract. Do not inject trusted certificate-attestation headers from clients. Any required mutual-TLS integration must use the approved trusted proxy configuration and server-side attestation secret; certificate headers alone are not authorization. Cloud SCIM uses the gateway URL returned by the cloud console. ## Acceptance checks - Readiness succeeds on the public domain and login resolves the expected organization. - A permitted read succeeds; anonymous, wrong-domain and cross-partner requests fail. - Authorized sandbox actions work within their documented restrictions, with no production money movement. - Streaming reconnects and revalidates authorization; credentials are absent from URLs and application logs. - Revocation, expiry and cloud-disconnection behavior are exercised in a dedicated test installation. # Operate and troubleshoot on-prem Source: https://partners.mystocks.africa/partners/docs/onprem-operations [Journey overview](/partners/docs/onprem) · [Installation](/partners/docs/onprem-installation) · [Key renewal](/partners/docs/onprem-activation) ## Where can I see my installation status? Open **Platform → Your OnPrem installations** in the partner dashboard. MyStocks operations reads the same license records in **Partner admin → Licenses & installations**. The page shows the domain, temporary/permanent access, expiry, approved image digest, last successful cloud verification and operator acceptance. License activation does not mean the installation has passed acceptance. Production API clients with `accounts:read` scope can also use the installation inventory. Member sessions additionally need `organization.read`. This endpoint is unavailable in sandbox. ```bash curl --fail-with-body 'https://mystocks.africa/api/v1/partner/installations' \ -H "Authorization: Bearer $MYSTOCKS_API_KEY" ``` The response contains `installations` and a nullable `nextCursor`. Pass a returned cursor as `?after=…` to request the next page (25 records per page). Credentials, private operator evidence URLs and administrator identifiers are omitted. `awaiting_installation` means no successful verification has been observed; `license_verified` means the cloud accepted the credential; `operator_verified` means an administrator recorded installation acceptance; `access_blocked` means the license check fails. Cloud verification is recorded at most once per five minutes on a best-effort basis. These are point-in-time observations, not continuous availability guarantees. Use readiness monitoring below for current service health. For installation support, submit a partner support case with the domain and request reference, but no key or password. The administrator can review the shared conversation, reply and request further evidence. Failed lifecycle emails can be requeued by operations; queued or sent status does not prove the message was read. ## How do I check current readiness? `/api/live` checks the running process. `/api/health` performs a fresh license check and returns 503 when the license is invalid, expired or revoked, cloud verification is unavailable, or required sign-in configuration is missing. A page loading or container running does not prove the gateway is ready. Monitor the public HTTPS URL, readiness, certificate expiry and application logs. Keep secrets and authorization headers out of logs and alerts. ## Diagnose by symptom Evaluation applicants use their signed-in OnPrem request to inspect approval, expiry and DNS status; the production installation inventory API remains unavailable to evaluation-only organizations. Keep request approval, ownership verification, installation readiness and production approval distinct when diagnosing blocked access. | Error | Next action | | --- | --- | | `EVALUATION_PRODUCTION_BLOCKED` | Use sandbox routes; request explicit production activation after prerequisites are met. | | `EVALUATION_EXPIRED` | Request reviewed evaluation renewal; DNS alone cannot renew access. | | `PRODUCTION_ACTIVATION_INACTIVE` | Ask operations to review the installation grant, revocation and organization binding. | | `PRODUCTION_ACCESS_EXPIRED` | Request production renewal and a fresh domain challenge, then install the replacement key securely. | | `PRODUCTION_CONTRACT_INACTIVE` | Review the active commercial agreement and applied entitlements. | | `DOMAIN_VERIFICATION_REQUIRED` | Publish a fresh supplied challenge and check DNS before production confirmation. | | `APPROVED_RELEASE_INCOMPATIBLE` | Choose an approved image supporting the requested OS, architecture and identity protocol. | | Symptom | Check next | | --- | --- | | Registry pull fails | Separate registry reader permission, correct registry and approved immutable image digest. A license does not grant registry login. | | DNS or TLS failure | A/AAAA records, hostname, certificate chain, ports 80/443 and proxy challenge configuration. Compare IPv4 and IPv6 reachability. | | `/api/live` succeeds, `/api/health` returns 503 | License status/domain, outbound cloud access, system time and runtime sign-in configuration. Do not bypass verification. | | API returns 401 | Required caller API credential or user token; installation credential alone is insufficient. | | API returns 403 | Organization membership, scope, SSO/MFA requirements and permitted domain; inspect the response error code. | | Login rejects the domain/provider | Authorized Firebase domain and the exact organization provider ID; rerun installer after approved configuration changes. | | Sandbox operation is rejected | Published endpoint availability and required sub-account fields before assuming a platform failure. | | Events stall or repeatedly disconnect | Proxy buffering/timeouts and outbound connectivity. Reconnection within five minutes is expected. | | Access wall appears | Expiry/revocation and cloud verification; submit a renewal request when needed. | For a default installer-managed Docker deployment, inspect service status without displaying the secret environment file: ```sh sudo docker compose --project-directory /opt/mystocks \ -f /opt/mystocks/docker-compose.yml ps ``` For native deployment, inspect `systemctl status mystocks-onprem.service`. If you selected a different output directory, substitute it in operational commands. Review logs locally and redact credentials before sharing diagnostics. ## Upgrade and rollback 1. Obtain the next approved digest and confirm cloud compatibility. Back up configuration securely and record the prior approved digest. 2. Test the release in a dedicated installation, including readiness, login, permitted reads, sandbox and license lifecycle. 3. Schedule the change. Rerun the installer with the new digest, verified domain and current valid license; preserve your proxy/mode choices explicitly. 4. Recheck public TLS, readiness and authenticated functionality after restart. 5. If rollback is required, use the prior cloud-compatible image and current valid credentials. Never restore a revoked key or an obsolete image that allowed anonymous proxy access. For an installer-managed Docker/Caddy deployment, an upgrade or rollback uses the same command. Supply the selected, approved digest and current valid key at the hidden prompt: ```sh DOMAIN='trading.example.com' # Set the new approved digest for upgrade, or the prior compatible digest for rollback. IMAGE='REGISTRY/IMAGE@sha256:DIGEST' sudo bash install-onprem.sh --domain "$DOMAIN" --image "$IMAGE" --mode docker --proxy caddy curl --fail --show-error "https://$DOMAIN/api/live" curl --fail --show-error "https://$DOMAIN/api/health" ``` Use the [matching proxy/mode command](/partners/docs/onprem-installation#exact-proxy-commands) for Nginx, Traefik, external TLS or native installations. Reuse the checksum-verified installer approved for that release; replacing an image is not a backup restore. The installer performs no production data migration. Your team owns server patches, TLS, local configuration backups and operational monitoring; agree incident responsibilities and service terms during onboarding. ## Ask for help Contact support@mystocks.africa with the installation domain, image digest, UTC timestamp, failing path, HTTP status and request ID where available. Include redacted symptoms and whether liveness/readiness pass. Never send passwords, tokens, installation keys or complete environment files. ## Where can I see my contract, invoice and image access? Open **Platform → Contracts, billing and operational records** in the partner dashboard. A member needs `reports.read`; an API key needs `reports:read`. Operators use the corresponding partner **Commercial** workspace. Contract tier, invoice payment, registry reader access and installation-license validity are separate approvals. ```bash curl --fail-with-body \ -H "Authorization: Bearer $MYSTOCKS_PARTNER_API_KEY" \ 'https://mystocks.africa/api/v1/partner/commercial?kind=registry' ``` Use `kind=contracts`, `invoices`, `registry` or `periods`. Each page returns at most 25 records. Follow `nextCursor` using `after` with the same `kind`. The endpoint is available in production, not sandbox, and does not return private administrator evidence or keys. For private images, supply your organization's verified Google user or service-account identity to Partner Operations. After approval, sign in as that identity and configure Docker for the registry host stated in your installation instructions. Workload identity is appropriate for automated deployment; do not send passwords or private keys in an access request. The registry grant expires at the earlier approved contract or license boundary. A scheduled cleanup worker removes managed reader access after that boundary or revocation; download access can persist until cleanup succeeds. The installation expiry wall remains independent. Other active grants for the same Google identity retain its reader membership. An installation key itself does not authenticate Docker. Historical cash reports use dated USD statement boundaries and full resumable ledger scans. They are separate from current-state securities and custody reconciliation. Missing or changed source records block sign-off; contact Treasury with the report reference for corrections. ## How do we replace a lost host or private installation key? A license permits one registered cryptographic installation identity. Do not copy its private key into another independently operated installation. Cloning a private key cannot be distinguished from the original host by this protocol; hardware attestation is not currently offered. Replicas, shared keys, high availability and disaster recovery require an agreed deployment policy before use. For customer-retrieved licenses, an authorized administrator opens **On-prem licenses → Recover or move installation**, records the destination and reason, and confirms. This atomically retires the old identity and all installation credentials. It creates a fresh, time-limited retrieval offer for the approved applicant. The old installation cannot continue serving protected API calls. The applicant signs in again, retrieves the replacement key once, and installs it on the intended host. The current image generates a protected Ed25519 key in its persistent installation directory, enrolls its public identity and signs subsequent proxy and readiness requests. Keep that directory across restarts and ordinary image upgrades. Never email its private key. Check `/api/health` and a read-only partner account call after recovery. Recovery does not extend license expiry or expand API permissions. Legacy administrator-delivered licenses require rotation and a reviewed migration first. ## Self-service evaluation troubleshooting | Outcome | Meaning and next action | | --- | --- | | `EVALUATION_ALREADY_USED` | Organization, contact or account has already had an evaluation. Request an administrator-approved extension; a new request ID cannot renew it. | | `APPROVED_RELEASE_UNAVAILABLE` | No compatible tested image for the selected OS/architecture. Choose a supported profile or contact the release operator. | | `DEPLOYMENT_REVIEW_REQUIRED` | Kubernetes/private-edge requires an agreed enterprise runbook. Submit an administrator-reviewed request. | | `ORGANIZATION_REVIEW_REQUIRED` | Existing identity or organization data is ambiguous or inactive. An administrator must resolve it; self-service will not link an unrelated organization. | | `EVALUATION_POLICY_FIXED` | A request attempted to choose expiry, permanent access or another organization's ID. Use the standard evaluation form. | | `EVALUATION_DECISION_REASON_REQUIRED` | An administrator must supply a reason for extending or revoking self-service access. | Image setup may remain blocked while the customer links Google sign-in or the platform operator repairs repository IAM/expiry-worker readiness. Use **Retry image-download setup** from the signed-in request. A retry never restarts the trial. Scheduled image-reader removal can lag; the license expiry wall is independently enforced. No offline license grace is introduced. The request form handles extension and production requests. Operations reviews those requests against the existing license and organization; it must not create a second trial as a workaround. Preserve the private installation identity across updates, and use the authorized recovery flow when moving hosts. ## What administrator security policy applies? Partner license permissions remain required for every action. Approval, licensing, revocation and recovery also require authentication within the previous 15 minutes. Use **Confirm administrator sign-in** in the request or license workspace, then retry. Refreshing an old ID token alone does not satisfy this check. A configured administrator MFA requirement is checked using Firebase's verified second-factor claim; root authority does not bypass it. The workspace shows whether MFA is currently required and verified. MFA is not claimed to be globally enabled when policy is unset. Administrators must complete their approved MFA enrollment/sign-in flow before enforcement is enabled. Installation identity, retrieval-offer expiry, failed lifecycle notifications and last accepted cloud verification are visible to permitted operators. A queued or sent email is not evidence of inbox receipt, and an accepted license is not evidence of public TLS or a completed customer installation. A retired private installation identity cannot be enrolled again after recovery: use a fresh identity on the intended host and preserve that new identity across ordinary upgrades. ## How does an existing installation migrate to signed requests? An authorized operator selects **Plan identity migration** on an active, unbound license in `/admin/partners`, selects the verified identity-capable image, records a reason and confirms an exact deadline. The deadline must be in the future, at most 30 days away and no later than the license expiry. This is a reviewed decision for one installation; there is no automatic bulk cutover. The customer receives the digest-pinned image and the deployment instructions by email, with no installation secret. Preserve the existing protected license configuration and use the approved installer to upgrade. The updated runtime generates and enrolls its private installation identity. Once enrollment succeeds, unsigned protected requests are rejected immediately, even when the migration deadline has not arrived. At the deadline, an installation that has not enrolled receives `INSTALLATION_ENROLLMENT_REQUIRED` and must complete the upgrade before using protected APIs. Grace never overrides license expiry, revocation, partner suspension or normal API authorization. Do not roll back to an unsigned runtime after enrollment. An ordinary restart or image upgrade must retain the identity volume. Moving to a replacement host requires the administrator recovery workflow described above. Migration notices, the deadline and enrollment evidence are available to permitted operators; email queue acceptance is not proof the upgrade completed. ## Why can enterprise sign-in succeed while the partner session is rejected? An identity-provider login alone does not authorize a partner session. For OIDC, configure the provider to include the customer's `email` and `email_verified: true` in the signed ID token used by Identity Platform. Email available only from the provider's UserInfo endpoint may be absent from an ID-token credential exchange. Also check the approved provider identifier, organization domain, active membership or approved JIT enrollment, and role policy. A password-only sign-in cannot bypass enforced SSO. If an earlier identity was created without email, ask an authorized identity administrator to review the account before retrying; do not delete customer identities or relax verification to work around an error. # Partner workspace and access status Source: https://partners.mystocks.africa/partners/docs/partner-workspace ## Where do I see API access and installations? Sign in with your verified email. The Sandbox and Live dashboards show **API access** and **Installations & licenses** separately. You can save a personal Hosted API/OnPrem/Both preference; this changes your workspace preference, not your organization's authority. The API section shows Hosted Live eligibility, approval status and the next required action. The installation section shows requests, licenses, access level, expiry, domain verification, identity enrollment and credential retrieval. Older licenses without a linked application can also appear. The summary returns at most 50 installation entries; ask operations if an expected older entry is missing. ## Can I start an OnPrem evaluation myself? Yes. Follow **Start evaluation / request renewal** to OnPrem Access. Verified customers can issue one 14-day Sandbox-only installation license for a supported deployment. Choose an intended hostname, retrieve the key securely and inspect image-download preparation. Installation licenses and Sandbox API keys are separate; manage the latter in the Sandbox console. Extensions and production require administration. See [activation and evaluation policy](/partners/docs/onprem-activation). ## Why is Live unavailable? Use the displayed next action. An active key alone does not establish production approval. A suspended organization, blocked Hosted access, inactive parent credential, membership restrictions or commercial controls can prevent access. A failed selector check leaves you in the current environment. | Status or error code | Meaning | Next action | | --- | --- | --- | | `HOSTED_LIVE_APPROVAL_REQUIRED` | No explicit Hosted Live approval | Ask partner operations to review Hosted Live; continue in Sandbox | | `HOSTED_LIVE_BLOCKED` | An administrator blocked Hosted Live | Request review with the reason and request reference | | `PARTNER_INACTIVE` | Organization or parent credential is inactive | Ask operations to restore eligible access | | `EVALUATION_PRODUCTION_BLOCKED` | The applicable evaluation/legacy access policy denies production | Complete the appropriate production approval; changing the key prefix cannot help | | `PRODUCTION_ACCESS_EXPIRED` or `PRODUCTION_ACTIVATION_INACTIVE` | Legacy direct access depends on an installation grant that is no longer active | Ask operations to review the legacy activation and Hosted approval | | `PRODUCTION_CONTRACT_INACTIVE` | Required commercial agreement is not active | Ask operations to review the contract and applied entitlements | | `INSTALLATION_LIVE_APPROVAL_REQUIRED` | The current installation context cannot enter Live | Complete installation production readiness; use separately approved Hosted access through its own context | These are access outcomes, not a promise that every endpoint returns the same status/body. Use the actual HTTP response and [error contract](/partners/docs/errors). ## Does an expired installation disable my Hosted API? For organizations with an explicit approved Hosted Live decision, the lifecycles are independent: installation expiry/revocation blocks installation calls while approved direct Hosted access remains subject to its own controls. Older organizations without an explicit Hosted decision retain their legacy checks, including installation-linked production grants. There is no automatic migration that grants new rights. Ask an administrator to review the intended access model. Installation evaluation cannot mint a Live console session, even if the organization also has Hosted Live approval. Installation requests still enforce their license, exact domain, signed identity proof and tenant membership. Identity enrollment means a device identity was registered; it is not evidence that the full installation passed readiness checks. ## How does the portal select an environment? These are **signed-in portal operations**, not API-key integration endpoints. Obtain a fresh Firebase ID token through the authenticated portal; never copy tokens into tickets or source control. The following Bash examples assume `FIREBASE_ID_TOKEN` was securely supplied in your process environment. ```bash curl --fail-with-body 'https://mystocks.africa/api/v1/partner/me?workspace=1' \ -H "Authorization: Bearer $FIREBASE_ID_TOKEN" ``` ```bash curl --fail-with-body -X POST 'https://mystocks.africa/api/v1/partner/me' \ -H "Authorization: Bearer $FIREBASE_ID_TOKEN" \ -H 'Content-Type: application/json' \ -d '{"action":"select_environment","environment":"live"}' ``` Successful selection returns `navigateTo`: `/partners/dashboard` for Live or `/partners/sandbox` for Sandbox. Failure returns an error rather than granting access. This action does not mint credentials or modify approvals. ```bash curl --fail-with-body -X POST 'https://mystocks.africa/api/v1/partner/me' \ -H "Authorization: Bearer $FIREBASE_ID_TOKEN" \ -H 'Content-Type: application/json' \ -d '{"action":"deployment_preference","deploymentPreference":"both"}' ``` The preference is saved for the authenticated user and audited. Supported values are `hosted`, `onprem`, `both`; environment values are `sandbox`, `live`. These portal actions do not use the partner integration idempotency mechanism. ## How do I finish onboarding or renew access? 1. Choose your [deployment model](/partners/docs/deployment-options) and submit the correct application or installation request under your verified account. 2. Review the dashboard's next action. Operations must match the application to the correct organization; another organization's approval is not transferable. 3. For Hosted Live, wait for the explicit decision and use the proper production credential. For OnPrem, follow [activation](/partners/docs/onprem-activation), retrieve the credential once and verify the installation. 4. For expired offers, renewal, release compatibility or registry access, use the installation workspace's specific action and [operations guide](/partners/docs/onprem-operations). 5. Contact support with the request/license reference, timestamp, error code and sanitized health evidence. Never include raw keys, private identity files, passwords or account tokens. ## What does administration change? Administrators review Hosted approval separately from licenses in **Access & deployments**. Hosted decisions require a review reason, explicit confirmation and authorized recent administrator authentication. The decision updates shared authorization, records audit evidence and queues a notification. An email being queued is not proof of inbox delivery or an operational installation. Trading, funding, payout and reconciliation remain separate workflows with their own permissions, balances, eligibility and settlement state. Approval or switching to Live does not fund a wallet, clear KYC, settle an order or waive limits. See [operational controls](/partners/docs/operational-controls) and [daily reconciliation](/partners/docs/daily-reconciliation).