Skip to content

Devices

GET /devices

List all registered devices for the authenticated user.

Authentication: JWT Bearer token required Rate limit: --

Request

No path or query parameters. Requires a valid Bearer token identifying the caller.

Response

Response Example

json
{
  "data": [
    {
      "id": "dev-1234-abcd",
      "name": "MacBook Pro",
      "platform": "macos",
      "lastActiveAt": "2026-03-17T10:30:00.000Z",
      "createdAt": "2026-01-15T08:00:00.000Z"
    },
    {
      "id": "dev-5678-efgh",
      "name": "iPhone 15",
      "platform": "ios",
      "lastActiveAt": "2026-03-16T22:15:00.000Z",
      "createdAt": "2026-02-01T12:00:00.000Z"
    }
  ],
  "meta": {
    "total": 2
  },
  "error": null
}

Response Fields

FieldTypeDescription
data[].idstringDevice ID
data[].namestringDevice display name
data[].platformstringios, android, macos, windows, linux, or web
data[].lastActiveAtstringISO 8601 last activity timestamp
data[].createdAtstringISO 8601 creation timestamp

Code Example

bash
curl "https://api.chainabit.com/api/v1/devices" \
  -H "Authorization: Bearer $TOKEN"
javascript
const response = await fetch(`${BASE_URL}/devices`, {
  headers: {
    "Authorization": `Bearer ${TOKEN}`
  }
});
const data = await response.json();
python
import requests

response = requests.get(
    f"{BASE_URL}/devices",
    headers={"Authorization": f"Bearer {TOKEN}"}
)
data = response.json()

POST /devices

Register a new device for the authenticated user.

Authentication: JWT Bearer token required Rate limit: --

Request

Request Body

FieldTypeRequiredConstraintsDescription
namestringYes--Device display name
platformstringYesios, android, macos, windows, linux, webDevice platform
deviceTokenstringNo--Push notification token

Response

Response Example

json
{
  "data": {
    "id": "dev-9012-ijkl",
    "name": "Work Laptop",
    "platform": "linux",
    "deviceToken": "fcm-token-abc123",
    "createdAt": "2026-03-17T11:00:00.000Z"
  },
  "meta": null,
  "error": null
}

Response Fields

FieldTypeDescription
data.idstringNewly assigned device ID
data.namestringDevice display name
data.platformstringDevice platform
data.deviceTokenstringPush notification token
data.createdAtstringISO 8601 creation timestamp

Code Example

bash
curl -X POST "https://api.chainabit.com/api/v1/devices" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Work Laptop",
    "platform": "linux",
    "deviceToken": "fcm-token-abc123"
  }'
javascript
const response = await fetch(`${BASE_URL}/devices`, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${TOKEN}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    name: "Work Laptop",
    platform: "linux",
    deviceToken: "fcm-token-abc123"
  })
});
const data = await response.json();
python
import requests

response = requests.post(
    f"{BASE_URL}/devices",
    headers={
        "Authorization": f"Bearer {TOKEN}",
        "Content-Type": "application/json"
    },
    json={
        "name": "Work Laptop",
        "platform": "linux",
        "deviceToken": "fcm-token-abc123"
    }
)
data = response.json()

PATCH /devices/settings

Update settings for a device identified by either the x-device-token or x-device-id header.

Authentication: JWT Bearer token required Rate limit: --

Request

The target device is identified by either the x-device-token or x-device-id header.

Request Body

FieldTypeRequiredConstraintsDescription
pushNotificationsbooleanNo--Enable push notifications
soundEnabledbooleanNo--Enable sound for notifications

Response

Response Example

json
{
  "data": {
    "deviceId": "dev-9012-ijkl",
    "pushNotifications": true,
    "soundEnabled": false,
    "updatedAt": "2026-03-17T11:05:00.000Z"
  },
  "meta": null,
  "error": null
}

Response Fields

FieldTypeDescription
data.deviceIdstringAssociated device ID
data.pushNotificationsbooleanPush notifications enabled
data.soundEnabledbooleanNotification sound enabled

Code Example

bash
curl -X PATCH "https://api.chainabit.com/api/v1/devices/settings" \
  -H "Authorization: Bearer $TOKEN" \
  -H "x-device-token: fcm-token-abc123" \
  -H "Content-Type: application/json" \
  -d '{
    "pushNotifications": true,
    "soundEnabled": false
  }'
javascript
const response = await fetch(`${BASE_URL}/devices/settings`, {
  method: "PATCH",
  headers: {
    "Authorization": `Bearer ${TOKEN}`,
    "x-device-token": "fcm-token-abc123",
    // OR: "x-device-id": "dev-9012-ijkl"
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    pushNotifications: true,
    soundEnabled: false
  })
});
const data = await response.json();
python
import requests

response = requests.patch(
    f"{BASE_URL}/devices/settings",
    headers={
        "Authorization": f"Bearer {TOKEN}",
        "x-device-token": "fcm-token-abc123",
        # OR: "x-device-id": "dev-9012-ijkl"
        "Content-Type": "application/json"
    },
    json={
        "pushNotifications": True,
        "soundEnabled": False
    }
)
data = response.json()

GET /devices/settings/by-token

Get device settings for the device identified by the x-device-token header.

Authentication: JWT Bearer token required Rate limit: --

Request

Requires the x-device-token header identifying the device.

Response

Response Example

json
{
  "data": {
    "deviceId": "dev-9012-ijkl",
    "pushNotifications": true,
    "soundEnabled": false
  },
  "meta": null,
  "error": null
}

Response Fields

FieldTypeDescription
data.deviceIdstringAssociated device ID
data.pushNotificationsbooleanPush notifications enabled
data.soundEnabledbooleanNotification sound enabled

Code Example

bash
curl "https://api.chainabit.com/api/v1/devices/settings/by-token" \
  -H "Authorization: Bearer $TOKEN" \
  -H "x-device-token: fcm-token-abc123"
javascript
const response = await fetch(`${BASE_URL}/devices/settings/by-token`, {
  headers: {
    "Authorization": `Bearer ${TOKEN}`,
    "x-device-token": "fcm-token-abc123"
  }
});
const data = await response.json();
python
import requests

response = requests.get(
    f"{BASE_URL}/devices/settings/by-token",
    headers={
        "Authorization": f"Bearer {TOKEN}",
        "x-device-token": "fcm-token-abc123"
    }
)
data = response.json()

GET /devices/:deviceId/settings

Get settings for a specific device by its ID.

Authentication: JWT Bearer token required Rate limit: --

Request

Path ParameterDescription
deviceIdID of the device whose settings to retrieve

Response

Response Example

json
{
  "data": {
    "deviceId": "dev-9012-ijkl",
    "pushNotifications": true,
    "soundEnabled": false
  },
  "meta": null,
  "error": null
}

Response Fields

FieldTypeDescription
data.deviceIdstringAssociated device ID
data.pushNotificationsbooleanPush notifications enabled
data.soundEnabledbooleanNotification sound enabled

Code Example

bash
curl "https://api.chainabit.com/api/v1/devices/dev-9012-ijkl/settings" \
  -H "Authorization: Bearer $TOKEN"
javascript
const response = await fetch(`${BASE_URL}/devices/dev-9012-ijkl/settings`, {
  headers: {
    "Authorization": `Bearer ${TOKEN}`
  }
});
const data = await response.json();
python
import requests

response = requests.get(
    f"{BASE_URL}/devices/dev-9012-ijkl/settings",
    headers={"Authorization": f"Bearer {TOKEN}"}
)
data = response.json()

Built with purpose.