Skip to main content
PUT
/
users
/
{user_id}
/
tokens
/
{token}
JavaScript
import Courier from '@trycourier/courier';

const client = new Courier({
  apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});

await client.users.tokens.addSingle('token', { user_id: 'user_id', provider_key: 'firebase-fcm' });
{
  "message": "<string>",
  "type": "invalid_request_error"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

user_id
string
required

The user's ID. This can be any uniquely identifiable string.

token
string
required

The full token string.

Body

application/json

Request body for adding a single token. The token value itself is provided via the path parameter, so it is omitted from the body.

provider_key
enum<string>
required
Available options:
firebase-fcm,
apn,
expo,
onesignal
expiry_date

ISO 8601 formatted date the token expires. Defaults to 2 months. Set to false to disable expiration.

properties
any | null

Properties about the token.

device
UsersDevice · object

Information about the device the token came from.

tracking
usersTracking · object

Tracking information about the device the token came from.

Response