BSV blockchainBSV blockchain

Register a device for FCM push notifications

POST/registerDevice

Stores or refreshes an FCM token for the authenticated identity. A token already owned by another identity cannot be reassigned through this route. Re-registering a token for the same identity updates its device metadata and last-used timestamp.

Body application/json

fcmTokenstringrequired

Firebase Cloud Messaging registration token.

deviceIdstring

Optional caller-supplied device identifier.

platform"ios" | "android" | "web"

Device platform.

Response

Device registered (or updated) successfully.

status"success"
messagestring
deviceIdinteger

Database row ID of the registration record.

Invalid request parameters. Codes: ERR_INVALID_FCM_TOKEN, ERR_INVALID_PLATFORM

status"error"
codestring

Machine-readable error code (see specs/errors.md).

descriptionstring

Human-readable explanation.

Authentication required (ERR_AUTHENTICATION_REQUIRED).

status"error"
codestring

Machine-readable error code (see specs/errors.md).

descriptionstring

Human-readable explanation.

Device token is already registered to another identity.

status"error"
codestring

Machine-readable error code (see specs/errors.md).

descriptionstring

Human-readable explanation.

Internal server error (ERR_DATABASE_ERROR, ERR_INTERNAL).

status"error"
codestring

Machine-readable error code (see specs/errors.md).

descriptionstring

Human-readable explanation.

Request
curl -X POST "https://{host}/registerDevice" \
  -H "Content-Type: application/json" \
  -H "x-bsv-auth-identity-key: <x-bsv-auth-identity-key>" \
  -d '{
  "fcmToken": "string",
  "deviceId": "string",
  "platform": "ios"
}'
Response
{
  "status": "success",
  "message": "string",
  "deviceId": 0
}