Skip to content
ApiqDevelopers
API v1.64.0Open console

Register device

POST/v1/devices
Accepts bearer

Register this phone's push token for the signed-in user

Human session only (the devices tag): an API key or a service token is 403 PERMISSION_DENIED, details.reason SESSION_REQUIRED.Show moreHuman session only (the devices tag): an API key or a service token is 403 PERMISSION_DENIED, details.reason SESSION_REQUIRED. No permission is needed to register — what a device receives is decided when each push is sent: it gets an order's events only while its user holds orders:read. Idempotent on (platform, token), so it takes no Idempotency-Key: registering a token this user already registered answers 200 with the same deviceId (appVersion refreshed); a token registered under another user, of this tenant or of another, moves to the caller — 201 with a new deviceId, and the earlier registration ends (its deviceId is a 404 to its former owner from then on). The token is stored, never logged and never returned: responses carry its last six characters only. A SUSPENDED tenant's users can still register, because push serves the post-booking servicing that suspension leaves up.

Request body

  • platformstringRequired
    APNS for an iOS device, FCM for an Android device
    • APNS
    • FCM
  • tokenstringRequired
    The APNs device token (hex) or the FCM registration token, exactly as the OS handed it to the app.Show moreThe APNs device token (hex) or the FCM registration token, exactly as the OS handed it to the app. Treated like a credential: stored for sending, never logged, never returned (a response shows tokenSuffix only).
  • appVersionstringOptional
    The app's version string, for support only; refreshed on every registration

Responses

  • 200This user had already registered the token — the same device, appVersion refreshedDevice
  • 201Registered for the caller — a new token, or one moved from another userDevice
  • 400VALIDATION — platform is not APNS or FCM, or the token is empty or longer than 4096 charactersApiErrorResponse
  • 401
    UNAUTHENTICATED — missing or expired token.Show moreUNAUTHENTICATED — missing or expired token. Declared on every operation because `security` is declared globally at the document root: every route is authenticated, so every route can answer 401.
    ApiErrorResponse
  • 403
    The 403 of the /v1/devices routes: PERMISSION_DENIED with details.reason SESSION_REQUIRED when the credential is not a human session — an API key (X-Api-Key) or a service token from POST…Show moreThe 403 of the /v1/devices routes: PERMISSION_DENIED with details.reason SESSION_REQUIRED when the credential is not a human session — an API key (X-Api-Key) or a service token from POST /v1/oauth/token, whatever its scopes. A device belongs to a person, and only a person's session can register, list or delete one.
    ApiErrorResponse
  • 405
    VALIDATION — the public edge serves GET, POST, PUT, PATCH and DELETE only; any other method is refused before the platform sees it (details.reason METHOD_NOT_ALLOWED, details.source edge).Show moreVALIDATION — the public edge serves GET, POST, PUT, PATCH and DELETE only; any other method is refused before the platform sees it (details.reason METHOD_NOT_ALLOWED, details.source edge). Not retryable as sent.
    ApiErrorResponse
  • 413
    VALIDATION — the request body is larger than the surface's limit.Show moreVALIDATION — the request body is larger than the surface's limit. Not retryable as sent: shrink the body. Declared on every operation that takes a request body. details carries exactly one key, maxBodyBytes (integer): the limit that applies to this surface, in bytes.
    ApiErrorResponse
  • 414
    VALIDATION — the request URI (path and query string) is longer than 8 KiB; the public edge refuses it before the platform sees it (details.reason URI_TOO_LONG, details.source edge).Show moreVALIDATION — the request URI (path and query string) is longer than 8 KiB; the public edge refuses it before the platform sees it (details.reason URI_TOO_LONG, details.source edge). Not retryable as sent: send long input in the body of a POST.
    ApiErrorResponse
  • 415
    VALIDATION — a request body that is not JSON (application/json or application/*+json; a form body only on the OAuth token routes).Show moreVALIDATION — a request body that is not JSON (application/json or application/*+json; a form body only on the OAuth token routes). The public edge refuses it before the platform sees it (details.reason UNSUPPORTED_MEDIA_TYPE, details.source edge). Not retryable as sent: send Content-Type application/json. Declared on every operation that takes a JSON request body.
    ApiErrorResponse
  • 500INTERNAL — a bug, and traceId is the support handle.ApiErrorResponse

Errors you should handle

Branch on code and honour retryable — never on the HTTP status alone.

400VALIDATION
platform must be APNS or FCM
not retryable
401UNAUTHENTICATED
The bearer token is expired. Re-authenticate and retry.
not retryable
403PERMISSION_DENIED
Devices are registered by a signed-in person only. Sign in with POST /v1/auth/login; API keys and service tokens are refused here whatever their scopes.
not retryable
405VALIDATION
This method is not served.
not retryable
413VALIDATION
The request body is larger than this API accepts (262144 bytes).
not retryable
414VALIDATION
The request URI is longer than 8 KiB.
not retryable
415VALIDATION
Send application/json.
not retryable
500INTERNAL
An unexpected error occurred. Quote the traceId to support.
retryable