---
title: "Save a Web Push token"
method: PUT
path: "/channels/web_push/tokens"
tags: ["web_push"]
---

# Save a Web Push token

`PUT /channels/web_push/tokens`

Saves the Web Push token for the authenticated user. This token serves as a credential for accessing channel-specific functionality. Each token is unique to the user and channel combination, allowing for direct communication with the user via the channel.

## Request body

- WebPushTokenPayload
  - `endpoint` string, uri, required — The push subscription URL obtained from PushSubscription.endpoint after calling registration.pushManager.subscribe(). This is the unique URL for this device that push messages will be sent to.
  - `keys` object, required — The encryption keys from the PushSubscription.getKey() method, needed to encrypt push messages for this subscription.
    - `auth` string, byte, required — The authentication secret obtained from PushSubscription.getKey('auth'). Used to encrypt push messages for this subscription.
    - `p256dh` string, byte, required — The P-256 ECDH public key obtained from PushSubscription.getKey('p256dh'). Used to encrypt push messages for this subscription.

## Response `200`

OK

- WebPushTokenPayload
  - `endpoint` string, uri, required — The push subscription URL obtained from PushSubscription.endpoint after calling registration.pushManager.subscribe(). This is the unique URL for this device that push messages will be sent to.
  - `keys` object, required — The encryption keys from the PushSubscription.getKey() method, needed to encrypt push messages for this subscription.
    - `auth` string, byte, required — The authentication secret obtained from PushSubscription.getKey('auth'). Used to encrypt push messages for this subscription.
    - `p256dh` string, byte, required — The P-256 ECDH public key obtained from PushSubscription.getKey('p256dh'). Used to encrypt push messages for this subscription.

---

[API](https://skmtc.net/magicbell/apis/magicbell-api.md) · [All operations](https://skmtc.net/magicbell/apis/magicbell-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/magicbell/magicbell-api/revisions/8b99dca11019/schema)
