Register notification device
Sub-Accounts & White-Label Retail KYC
/users/{userId}/devices
Register notification device
registerUserDeviceRegisters or updates a push-token record for your mobile/web app. MyStocks stores only a token hash and last4. This endpoint gives partners a durable device-token model for mobile notification fanout. Webhooks remain the server-side event source of truth; your backend should receive webhooks or SSE events and fan out user-visible notifications through APNs, FCM, Expo, or Web Push using the device records you maintain.
Parameters
userIdstringpathRequiredExample: usr_abc123
Headers
AuthorizationstringRequiredBearer sk_sandbox_<your_key> for sandbox requests.
Idempotency-KeystringheaderRequiredUnique string that makes write calls safe to retry on network failure. Required for money movement, trading, KYC, subscriptions, and webhook creation. Deduplicated for 24 hours -- duplicate keys return the cached response. HTTP 409 if a concurrent request with the same key is still in progress.
Example: dep_user42_1743152580
Request body
tokenstringRequiredMobile/web push token from APNs, FCM, Expo, or Web Push. Stored as sha256 hash plus last4 only.
Example: "ExpoPushToken[xxxxxxxxxxxxxxxxxxxxxx]"
platformios | android | webRequiredExample: "ios"
providerfcm | apns | expo | webpushRequiredExample: "expo"
appIdstringPartner app bundle/package ID.
Example: "com.afritrade.app"
deviceIdstringOptional partner device identifier. Used to keep one stable MyStocks deviceId across token rotations.
Example: "afritrade-device-42"
localestringExample: "en-KE"
timezonestringExample: "Africa/Nairobi"
tagsstring[]Example: ["retail","beta"]
enabledbooleanResponse fields
See the response format and API Reference for this endpoint.
Response codes
200Existing device registration updated.201Device registered.