Skip to content

Device Tokens API ​

Device tokens are used for push notifications via the Expo Push API. The mobile app registers its Expo push token on launch and deactivates it on logout.

POST /device_tokens ​

Register or update a device push token. If the token already exists for this user, it is reactivated.

Auth required: Yes

Request body:

json
{
  "token": "ExponentPushToken[xxxxxx]",
  "platform": "ios"
}
FieldTypeDescription
tokenstringExpo push token
platformstringios or android

Response (200):

json
{
  "device_token": {
    "id": 1,
    "token": "ExponentPushToken[xxxxxx]",
    "platform": "ios",
    "active": true
  }
}
bash
curl -X POST http://localhost:3000/api/v1/device_tokens \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"token":"ExponentPushToken[xxxxxx]","platform":"ios"}'

DELETE /device_tokens ​

Deactivate a device push token. Called on logout to stop sending push notifications to this device.

Auth required: Yes

Request body:

json
{
  "token": "ExponentPushToken[xxxxxx]"
}

Response (200):

json
{
  "message": "Token deactivated"
}

Errors:

StatusCause
404Token not found for this user

TIP

Tokens are soft-deleted (set active: false) rather than destroyed. This prevents issues if the same token is re-registered later.

bash
curl -X DELETE http://localhost:3000/api/v1/device_tokens \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"token":"ExponentPushToken[xxxxxx]"}'

Internal documentation — not for public distribution