Register a device for push
Call after every sign-in, whenever the OS hands the app a new token
(APNs didRegisterForRemoteNotificationsWithDeviceToken, FCM
onNewToken), and on app start if the token or the language changed.
Upserts by (platform, token) and binds the device to the calling user
and session: a token registered by another account moves to this one,
and an earlier token of this session on the same platform is dropped
(token rotation). Pushes stop when the session ends: sign-out or
DELETE /me/sessions/{id} deletes its devices.
Needs a session access token (sid); store API tokens cannot
register devices.
Authorization
bearer_auth Authorization: Bearer <token>. Either a session access token from POST /auth/login (refresh it with POST /auth/refresh) or a store API token (mobi_st_…). A store API token works only for the store it was issued in, and can do at most what its issuing user can there, narrowed to the scopes it was issued with.
In: header
Header Parameters
A unique value (e.g. a UUID) per logical request. Retrying with the same key within 24 hours replays the first response instead of repeating the side effect; the replay carries Idempotent-Replayed: true. Reusing a key for a different request is a 422 idempotency_key_reused; retrying while the first is still running is a 409 idempotency_request_in_progress. JSON bodies up to 1 MB.
length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/me/devices" \ -H "Content-Type: application/json" \ -d '{ "platform": "ios", "token": "string" }'{
"active": true,
"app_version": "string",
"created_at": "2019-08-24T14:15:22Z",
"current": true,
"device_name": "string",
"environment": "production",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"last_push_at": "2019-08-24T14:15:22Z",
"locale": "string",
"platform": "ios",
"token": "string",
"updated_at": "2019-08-24T14:15:22Z"
}{
"active": true,
"app_version": "string",
"created_at": "2019-08-24T14:15:22Z",
"current": true,
"device_name": "string",
"environment": "production",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"last_push_at": "2019-08-24T14:15:22Z",
"locale": "string",
"platform": "ios",
"token": "string",
"updated_at": "2019-08-24T14:15:22Z"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}{
"code": "not_found",
"details": {},
"error": "Order not found"
}