> For the complete documentation index, see [llms.txt](https://docs.codemash.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codemash.io/norbix-cloud/notifications/push/devices-api.md).

# Devices API

## Register Device

<mark style="color:green;">`POST`</mark> `https://api.norbix.ai/:version/notifications/push/devices`

Registers a device without a token. Devices without a token won't receive push notifications.

#### Path Parameters

| Name    | Type   | Description                                             |
| ------- | ------ | ------------------------------------------------------- |
| version | string | The version of the API endpoint. Current latest **v1**. |

#### Headers

| Name           | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| Authorization  | string | Your project's secret key.                             |
| x-cm-projectid | string | Your project's ID. Can be passed as a query parameter. |

#### Request Body

| Name     | Type   | Description                                             |
| -------- | ------ | ------------------------------------------------------- |
| userId   | string | The ID of a user.                                       |
| timeZone | string | The timezone of a device in a tz database format.       |
| meta     | object | Key-value pair (string: string) object for custom data. |

{% tabs %}
{% tab title="200 Returns an ID of created notification group." %}

```javascript
{
    Result: ""
}
```

{% endtab %}

{% tab title="401 Returns if the user does not have a valid permission to call this method." %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title=".NET" %}

```csharp
var client = new NorbixClient(apiKey, projectId);
var pushService = new NorbixPushService(client);

var response = await pushService.RegisterDeviceAsync(
    new RegisterDeviceRequest
    {
        UserId = Guid.parse("{USER_ID}"),
        TimeZone = "Etc/UTC",
        Meta = new Dictionary<string, string>
        {
            { "Os", "Android" }            
        }
    }
```

{% endtab %}

{% tab title="Node" %}

```
```

{% endtab %}

{% tab title="PHP" %}

```php
use Norbix\NorbixClient;
use Norbix\NorbixPushNotification;

class NorbixService
{
    protected NorbixPushNotification $norbixPushNotification;

    public function __construct()
    {
        $secretKey = '{YOUR_SECRET_KEY}';
        $projectId = '{YOUR_PROJECT_ID}';

        $client = new NorbixClient($secretKey, $projectId);
        $norbixPushNotification = new NorbixPushNotification($client);
    }
    
    public function registerDevice()
    {
        $responseData = $this->norbixPushNotification->registerDevice([
            'userId' => '{USER_ID}',
            'timeZone' => 'Etc/UTC',
            'meta' => [
                'Brand' => 'Apple'
            ]
    }
    
}
```

{% endtab %}
{% endtabs %}

## Register Expo Token

<mark style="color:green;">`POST`</mark> `https://api.norbix.ai/:version/notifications/push/token/expo`

Registers a device with an Expo token and creates a device if not yet created.

#### Path Parameters

| Name    | Type   | Description                                             |
| ------- | ------ | ------------------------------------------------------- |
| version | string | The version of the API endpoint. Current latest **v1**. |

#### Headers

| Name           | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| Authorization  | string | Your project's secret key.                             |
| x-cm-projectid | string | Your project's ID. Can be passed as a query parameter. |

#### Request Body

| Name     | Type   | Description                                                      |
| -------- | ------ | ---------------------------------------------------------------- |
| token    | string | Token of a device provided by the Expo.                          |
| deviceId | string | The ID of a device. If not provided, a new device will be added. |
| userId   | string | The ID of a user.                                                |
| timeZone | string | The timezone of a device in a tz database format.                |
| meta     | object | Key-value pair (string: string) object for custom data.          |

{% tabs %}
{% tab title="200 Returns an ID of created notification group." %}

```javascript
{
    Result: ""
}
```

{% endtab %}

{% tab title="401 Returns if the user does not have a valid permission to call this method." %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title=".NET" %}

```csharp
var client = new NorbixClient(apiKey, projectId);
var pushService = new NorbixPushService(client);

var response = await pushService.RegisterExpoTokenAsync(
    new RegisterDeviceExpoTokenRequest
    {
        UserId = Guid.parse("{USER_ID}"),
        Token = "ExponentPushToken[**********************]",
        TimeZone = "Etc/UTC",
        Meta = new Dictionary<string, string>
        {
            { "Os", "Android" }            
        }
    }
```

{% endtab %}

{% tab title="Node" %}

```
```

{% endtab %}

{% tab title="PHP" %}

```php
use Norbix\NorbixClient;
use Norbix\NorbixPushNotification;

class NorbixService
{
    protected NorbixPushNotification $norbixPushNotification;

    public function __construct()
    {
        $secretKey = '{YOUR_SECRET_KEY}';
        $projectId = '{YOUR_PROJECT_ID}';

        $client = new NorbixClient($secretKey, $projectId);
        $norbixPushNotification = new NorbixPushNotification($client);
    }
    
    public function registerExpoToken()
    {
        $responseData = $this->norbixPushNotification->registerExpoToken([
            'userId' => '{USER_ID}',
            'timeZone' => 'Etc/UTC',
            'meta' => [
                'Brand' => 'Apple'
            ],
            'token' => 'ExponentPushToken[**********************]',
        ]);
    }
    
}
```

{% endtab %}
{% endtabs %}

## Get Device

<mark style="color:blue;">`GET`</mark> `https://api.norbix.ai/:version/notifications/push/devices/:id`

Gets a device.

#### Path Parameters

| Name    | Type   | Description                                             |
| ------- | ------ | ------------------------------------------------------- |
| version | string | The version of the API endpoint. Current latest **v1**. |
| id      | string | The ID of a device to get.                              |

#### Headers

| Name           | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| Authorization  | string | Your project's secret key.                             |
| x-cm-projectid | string | Your project's ID. Can be passed as a query parameter. |

{% tabs %}
{% tab title="200 Returns an ID of created notification group." %}

```javascript
{
    Result: ""
}
```

{% endtab %}

{% tab title="401 Returns if the user does not have a valid permission to call this method." %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title=".NET" %}

```csharp
var client = new NorbixClient(apiKey, projectId);
var pushService = new NorbixPushService(client);

var response = await pushService.GetDeviceAsync(
    new GetDeviceRequest
    {
        Id = "{DEVICE_ID}"
    }
);
```

{% endtab %}

{% tab title="Node" %}

```
```

{% endtab %}

{% tab title="PHP" %}

```php
use Norbix\NorbixClient;
use Norbix\NorbixPushNotification;

class NorbixService
{
    protected NorbixPushNotification $norbixPushNotification;

    public function __construct()
    {
        $secretKey = '{YOUR_SECRET_KEY}';
        $projectId = '{YOUR_PROJECT_ID}';

        $client = new NorbixClient($secretKey, $projectId);
        $norbixPushNotification = new NorbixPushNotification($client);
    }
    
    public function getDevice()
    {
        $responseData = $this->norbixPushNotification->getDevice([
            'id' => '{DEVICE_ID}',
        ]);
    }
    
}
```

{% endtab %}
{% endtabs %}

## Get Devices

<mark style="color:blue;">`GET`</mark> `https://api.norbix.ai/:version/notifications/push/devices`

Gets many devices.

#### Path Parameters

| Name    | Type   | Description                                             |
| ------- | ------ | ------------------------------------------------------- |
| version | string | The version of the API endpoint. Current latest **v1**. |

#### Headers

| Name           | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| Authorization  | string | Your project's secret key.                             |
| x-cm-projectid | string | Your project's ID. Can be passed as a query parameter. |

{% tabs %}
{% tab title="200 Returns an ID of created notification group." %}

```javascript
{
    Result: ""
}
```

{% endtab %}

{% tab title="401 Returns if the user does not have a valid permission to call this method." %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title=".NET" %}

```csharp
var client = new NorbixClient(apiKey, projectId);
var pushService = new NorbixPushService(client);

var response = await pushService.GetDevicesAsync(
    new GetDevicesRequest()
);
```

{% endtab %}

{% tab title="Node" %}

```
```

{% endtab %}

{% tab title="PHP" %}

```php
class NorbixService
{
    protected NorbixPushNotification $norbixPushNotification;

    public function __construct()
    {
        $secretKey = '{YOUR_SECRET_KEY}';
        $projectId = '{YOUR_PROJECT_ID}';

        $client = new NorbixClient($secretKey, $projectId);
        $norbixPushNotification = new NorbixPushNotification($client);
    }
    
    public function getDevices()
    {
        $responseData = $this->norbixPushNotification->getDevices();
    }
    
}
```

{% endtab %}
{% endtabs %}

## Delete Device

<mark style="color:red;">`DELETE`</mark> `https://api.norbix.ai/:version/notifications/push/devices/:id`

Deletes a particular device.

#### Path Parameters

| Name    | Type   | Description                                             |
| ------- | ------ | ------------------------------------------------------- |
| version | string | The version of the API endpoint. Current latest **v1**. |
| id      | string | The ID of a device to delete.                           |

#### Headers

| Name           | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| Authorization  | string | Your project's secret key.                             |
| x-cm-projectid | string | Your project's ID. Can be passed as a query parameter. |

{% tabs %}
{% tab title="200 Returns an ID of created notification group." %}

```javascript
{
    Result: ""
}
```

{% endtab %}

{% tab title="401 Returns if the user does not have a valid permission to call this method." %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title=".NET" %}

```csharp
var client = new NorbixClient(apiKey, projectId);
var pushService = new NorbixPushService(client);

var response = await pushService.DeleteDeviceAsync(
    new DeleteDeviceRequest
    {
        Id = "{DEVICE_ID}"
    }
);
```

{% endtab %}

{% tab title="Node" %}

```
```

{% endtab %}

{% tab title="PHP" %}

```php
class NorbixService
{
    protected NorbixPushNotification $norbixPushNotification;

    public function __construct()
    {
        $secretKey = '{YOUR_SECRET_KEY}';
        $projectId = '{YOUR_PROJECT_ID}';

        $client = new NorbixClient($secretKey, $projectId);
        $norbixPushNotification = new NorbixPushNotification($client);
    }
    
    public function deleteDevice()
    {
        $responseData = $this->norbixPushNotification->deleteDevice([
            'id' => '{DEVICE_ID}',
        ]);
    }
    
}
```

{% endtab %}
{% endtabs %}

## Delete Device Token

<mark style="color:red;">`DELETE`</mark> `https://api.norbix.ai/:version/notifications/push/devices/:id/token`

Deletes a token of a particular device.

#### Path Parameters

| Name    | Type   | Description                                             |
| ------- | ------ | ------------------------------------------------------- |
| version | string | The version of the API endpoint. Current latest **v1**. |
| id      | string | The ID of a device.                                     |

#### Headers

| Name           | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| Authorization  | string | Your project's secret key.                             |
| x-cm-projectid | string | Your project's ID. Can be passed as a query parameter. |

{% tabs %}
{% tab title="200 Returns an ID of created notification group." %}

```javascript
{
    Result: ""
}
```

{% endtab %}

{% tab title="401 Returns if the user does not have a valid permission to call this method." %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title=".NET" %}

```csharp
var client = new NorbixClient(apiKey, projectId);
var pushService = new NorbixPushService(client);

var response = await pushService.DeleteTokenAsync(
    new DeleteDeviceTokenRequest
    {
        Id = "{DEVICE_ID}"
    }
);
```

{% endtab %}

{% tab title="Node" %}

```
```

{% endtab %}

{% tab title="PHP" %}

```php
class NorbixService
{
    protected NorbixPushNotification $norbixPushNotification;

    public function __construct()
    {
        $secretKey = '{YOUR_SECRET_KEY}';
        $projectId = '{YOUR_PROJECT_ID}';

        $client = new NorbixClient($secretKey, $projectId);
        $norbixPushNotification = new NorbixPushNotification($client);
    }
    
    public function deleteDeviceToken()
    {
        $responseData = $this->norbixPushNotification->deleteDeviceToken([
            'id' => '{DEVICE_ID}',
        ]);
    }
    
}
```

{% endtab %}
{% endtabs %}

## Update Device Meta

<mark style="color:purple;">`PATCH`</mark> `https://api.norbix.ai/:version/notifications/push/devices/:id/metadata`

Updates a meta-information of a particular device.

#### Path Parameters

| Name    | Type   | Description                                             |
| ------- | ------ | ------------------------------------------------------- |
| version | string | The version of the API endpoint. Current latest **v1**. |
| id      | string | The ID of a device to update.                           |

#### Headers

| Name           | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| Authorization  | string | Your project's secret key.                             |
| x-cm-projectid | string | Your project's ID. Can be passed as a query parameter. |

#### Request Body

| Name | Type   | Description                                            |
| ---- | ------ | ------------------------------------------------------ |
| meta | string | Key-value pair (string: string) object of custom data. |

{% tabs %}
{% tab title="200 Returns an ID of created notification group." %}

```javascript
{
    Result: ""
}
```

{% endtab %}

{% tab title="401 Returns if the user does not have a valid permission to call this method." %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title=".NET" %}

```csharp
var client = new NorbixClient(apiKey, projectId);
var pushService = new NorbixPushService(client);

var response = await pushService.UpdateDeviceMetaAsync(
    new UpdateDeviceMetaRequest
    {
        Id = "{DEVICE_ID}",
        Meta = new Dictionary<string, string>
        {
            { "Os", "iOs" }            
        }
    }
);
```

{% endtab %}

{% tab title="Node" %}

```
```

{% endtab %}

{% tab title="PHP" %}

```php
class NorbixService
{
    protected NorbixPushNotification $norbixPushNotification;

    public function __construct()
    {
        $secretKey = '{YOUR_SECRET_KEY}';
        $projectId = '{YOUR_PROJECT_ID}';

        $client = new NorbixClient($secretKey, $projectId);
        $norbixPushNotification = new NorbixPushNotification($client);
    }
    
    public function updateDeviceMeta()
    {
        $responseData = $this->norbixPushNotification->updateDeviceMeta([
            'id' => '{DEVICE_ID}',
            'meta' => ['Brand' => 'Apple'],
        ]);
    }
    
}
```

{% endtab %}
{% endtabs %}

## Update Device Timezone

<mark style="color:purple;">`PATCH`</mark> `https://api.norbix.ai/:version/notifications/push/devices/:id/timezone`

Updates a timezone of a particular device.

#### Path Parameters

| Name    | Type   | Description                                             |
| ------- | ------ | ------------------------------------------------------- |
| version | string | The version of the API endpoint. Current latest **v1**. |
| id      | string | The ID of a device to update.                           |

#### Headers

| Name           | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| Authorization  | string | Your project's secret key.                             |
| x-cm-projectid | string | Your project's ID. Can be passed as a query parameter. |

#### Request Body

| Name     | Type   | Description                                       |
| -------- | ------ | ------------------------------------------------- |
| timezone | string | The timezone of a device in a tz database format. |

{% tabs %}
{% tab title="200 Returns an ID of created notification group." %}

```javascript
{
    Result: ""
}
```

{% endtab %}

{% tab title="401 Returns if the user does not have a valid permission to call this method." %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title=".NET" %}

```csharp
var client = new NorbixClient(apiKey, projectId);
var pushService = new NorbixPushService(client);

var response = await pushService.UpdateDeviceTimeZoneAsync(
    new UpdateDeviceTimeZoneRequest
    {
        Id = "{DEVICE_ID}",
        TimeZone = "Etc/UTC",
    }
);
```

{% endtab %}

{% tab title="Node" %}

```
```

{% endtab %}

{% tab title="PHP" %}

```php
class NorbixService
{
    protected NorbixPushNotification $norbixPushNotification;

    public function __construct()
    {
        $secretKey = '{YOUR_SECRET_KEY}';
        $projectId = '{YOUR_PROJECT_ID}';

        $client = new NorbixClient($secretKey, $projectId);
        $norbixPushNotification = new NorbixPushNotification($client);
    }
    
    public function updateDeviceTimezone()
    {
        $responseData = $this->norbixPushNotification->updateDeviceTimezone([
            'id' => '{DEVICE_ID}',
            'timezone' => 'ETC/UTC',
        ]);
    }
    
}
```

{% endtab %}
{% endtabs %}

## Update Device User

<mark style="color:purple;">`PATCH`</mark> `https://api.norbix.ai/:version/notifications/push/devices/:id/timezone`

Updates a user of a particular device.

#### Path Parameters

| Name    | Type   | Description                                             |
| ------- | ------ | ------------------------------------------------------- |
| version | string | The version of the API endpoint. Current latest **v1**. |
| id      | string | The ID of a device to update.                           |

#### Headers

| Name           | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| Authorization  | string | Your project's secret key.                             |
| x-cm-projectid | string | Your project's ID. Can be passed as a query parameter. |

#### Request Body

| Name   | Type   | Description           |
| ------ | ------ | --------------------- |
| userId | string | The ID of a new user. |

{% tabs %}
{% tab title="200 Returns an ID of created notification group." %}

```javascript
{
    Result: ""
}
```

{% endtab %}

{% tab title="401 Returns if the user does not have a valid permission to call this method." %}

```
```

{% endtab %}

{% tab title="500 " %}

```
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title=".NET" %}

```csharp
var client = new NorbixClient(apiKey, projectId);
var pushService = new NorbixPushService(client);

var response = await pushService.UpdateDeviceUserRequest(
    new UpdateDeviceUserRequest
    {
        Id = "{DEVICE_ID}",
        UserId = Guid.Parse("{USER_ID}"),
    }
);
```

{% endtab %}

{% tab title="Node" %}

```
```

{% endtab %}

{% tab title="PHP" %}

```php
class NorbixService
{
    protected NorbixPushNotification $norbixPushNotification;

    public function __construct()
    {
        $secretKey = '{YOUR_SECRET_KEY}';
        $projectId = '{YOUR_PROJECT_ID}';

        $client = new NorbixClient($secretKey, $projectId);
        $norbixPushNotification = new NorbixPushNotification($client);
    }
    
    public function updateDeviceUser()
    {
        $responseData = $this->norbixPushNotification->updateDeviceUser([
            'id' => '{DEVICE_ID}',
            'userId' => '{USER_ID}',
        ]);
    }
    
}
```

{% endtab %}
{% endtabs %}
