---
title: "Register this device for notifications"
method: POST
path: "/me/push-devices"
tags: ["Push"]
---

# Register this device for notifications

`POST /me/push-devices`

## Request

- Base URL: `https://bodylab.lol/api/v1`
- URL: `https://bodylab.lol/api/v1/me/push-devices`
- Auth: HTTP bearer

Idempotent: registering an address that is already known updates it in place and returns the same id, so a client can call this on every launch. An address registered under a different account moves to this one — a device only ever belongs to whoever last signed in on it.

## Headers

- `X-Client-Platform` string
- `X-Client-Version` string

## Request body

- object
  - `platform` 'apns' | 'web', required
  - `token` string, required: APNs: the device token as hex. Web Push: the subscription's endpoint URL.
  - `environment` 'sandbox' | 'production', nullable: APNs only, and required there: which APNs environment issued the token. A development or TestFlight build gets a sandbox token, an App Store build a production one, and neither works against the other host — the token itself doesn't say which it is, so the client must.
  - `keys` object, nullable: Web Push only, and required there: the subscription's keys, which its payloads are encrypted to.
    - `p256dh` string, required: The subscription's public key, base64url, from PushSubscription.getKey('p256dh').
    - `auth` string, required: The subscription's authentication secret, base64url, from PushSubscription.getKey('auth').
  - `label` string, nullable: How to name this device back to its owner, e.g. "iPhone" or "Firefox on macOS". Display only.

## Response `200`

OK

- object
  - `id` string, required: Opaque identifier.

## Other responses

- `401`: Error: UNAUTHORIZED.

---

[API](https://skmtc.dev/bodylab/apis/body-lab-api.md) · [All operations](https://skmtc.dev/bodylab/apis/body-lab-api/llms.txt) · [OpenAPI document](https://skmtc.dev/bodylab/apis/body-lab-api/revisions/544c201eaf88?raw)
