---
title: "Register a device for push notifications"
description: "Register an FCM registration token for the subject user.\n\nIdempotent — re-sending the same token refreshes it. If the token was\npreviously registered to a different user (the device was handed over, or\nsomeone logged out and back in), ownership moves to the subject user so the\nprevious owner stops receiving that device's notifications."
---

> Documentation Index
> Fetch the complete documentation index at: https://truememory-docs.mvstg.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: AI Gateway API › Notifications

`POST /notifications/devices`

Register an FCM registration token for the subject user.

Idempotent — re-sending the same token refreshes it. If the token was
previously registered to a different user (the device was handed over, or
someone logged out and back in), ownership moves to the subject user so the
previous owner stops receiving that device's notifications.

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Header parameters

- `X-App-Id` (`register_device.header.X-App-Id`; any of, optional)
  - any of: `string`, `null`
- `X-On-Behalf-Of` (`register_device.header.X-On-Behalf-Of`; any of, optional)
  - any of: `string`, `null`
- `X-External-User-Id` (`register_device.header.X-External-User-Id`; any of, optional)
  - any of: `string`, `null`

## Request body

_Required._

- `token` (`register_device.token`; string, required) — FCM registration token.
  - minLength 1; maxLength 4096
- `platform` (`register_device.platform`; any of, optional) — Informational only — FCM routes by token, not by this field.
  - any of: `string`, `null`

## Example request

```json
{
  "token": "string",
  "platform": "ios"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://truememory-api.mvstg.com/notifications/devices \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "token": "string",
  "platform": "ios"
}
'
```

### TypeScript

```typescript
const url = 'https://truememory-api.mvstg.com/notifications/devices';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({token: 'string', platform: 'ios'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://truememory-api.mvstg.com/notifications/devices"

payload = {
    "token": "string",
    "platform": "ios"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

Successful Response

#### Example

```json
{
  "id": "string",
  "app_id": "string",
  "user_id": "string",
  "token": "string",
  "platform": "ios",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}
```

- `id` (`register_device.response.201.id`; string, required)
- `app_id` (`register_device.response.201.app_id`; string, required)
- `user_id` (`register_device.response.201.user_id`; string, required)
- `token` (`register_device.response.201.token`; string, required)
- `created_at` (`register_device.response.201.created_at`; string, required)
  - format `date-time`
- `updated_at` (`register_device.response.201.updated_at`; string, required)
  - format `date-time`
- `platform` (`register_device.response.201.platform`; any of, optional)
  - any of: `string`, `null`

### 422

Validation Error

#### Example

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

- `detail` (`register_device.response.422.detail`; array<object>, optional)
  - `loc` (`register_device.response.422.detail.loc`; array<any of>, required)
    - any of: `string`, `integer`
  - `msg` (`register_device.response.422.detail.msg`; string, required)
  - `type` (`register_device.response.422.detail.type`; string, required)
  - `input` (`register_device.response.422.detail.input`; unknown, optional)
  - `ctx` (`register_device.response.422.detail.ctx`; object, optional)


Source: https://truememory-docs.mvstg.com/api/notifications/devices/create/index.md
