Skip to content

Devices ​

GET /devices ​

List all registered devices for the authenticated user.

Authentication: JWT Bearer token required

Request ​

Use a valid Bearer token identifying the caller. Optional limit and offset select an offset page.

Response ​

Response Example ​

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

Response Fields ​

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

Code Example ​

curl "https://api.chainabit.com/api/v1/devices" \
  -H "Authorization: Bearer $TOKEN"

POST /devices ​

Register a new device for the authenticated user.

Authentication: JWT Bearer token required

Request ​

Request Body

FieldTypeRequiredConstraintsDescription
namestringNo--Device display name
deviceTypestringNo--Device type label, such as linux or ios
deviceTokenstringYesNon-emptyApplication device identifier used for registration and token-based settings lookup
expoPushTokenstringNo--Expo push token, separate from the device identifier
osVersion / appVersionstringNo--Optional version metadata
settingsobjectNo--Initial settings; defaults to an empty object

Response ​

Response Example ​

json
{
  "data": {
    "id": "11111111-1111-4111-8111-111111111111",
    "name": "Work Laptop",
    "deviceType": "linux",
    "deviceToken": "fcm-token-abc123",
    "createdAt": "2026-03-17T11:00:00.000Z"
  }
}

Response Fields ​

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

Code Example ​

curl -X POST "https://api.chainabit.com/api/v1/devices" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Work Laptop",
    "deviceType": "linux",
    "deviceToken": "fcm-token-abc123"
  }'

PATCH /devices/settings ​

Update settings for a device you own. Supply exactly one of x-device-token or x-device-id; supplying both is refused.

Authentication: JWT Bearer token required

Request ​

Set exactly one device selector header. A device ID must be an ID returned for your own device.

Request Body

FieldTypeRequiredConstraintsDescription
settingsobjectYesNon-empty, at most 2048 UTF-8 bytesSettings patch
settings.themestringNolight, dark, systemTheme preference
settings.sidebarCollapsedbooleanNo--Sidebar preference

Response ​

Response Example ​

json
{
  "data": {
    "settings": {
      "theme": "dark",
      "sidebarCollapsed": false
    }
  }
}

Response Fields ​

FieldTypeDescription
data.settingsobjectThe device settings, including the supported theme and sidebar preferences

Code Example ​

curl -X PATCH "https://api.chainabit.com/api/v1/devices/settings" \
  -H "Authorization: Bearer $TOKEN" \
  -H "x-device-token: $DEVICE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "settings": { "theme": "dark", "sidebarCollapsed": false }
  }'

GET /devices/settings/by-token ​

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

Authentication: JWT Bearer token required

Request ​

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

Response ​

Response Example ​

json
{
  "data": {
    "settings": {
      "theme": "dark",
      "sidebarCollapsed": false
    }
  }
}

Response Fields ​

FieldTypeDescription
data.settingsobjectThe device settings, including the supported theme and sidebar preferences

Code Example ​

curl "https://api.chainabit.com/api/v1/devices/settings/by-token" \
  -H "Authorization: Bearer $TOKEN" \
  -H "x-device-token: $DEVICE_TOKEN"

GET /devices/:deviceId/settings ​

Get settings for a specific device by its ID.

Authentication: JWT Bearer token required

Request ​

Path ParameterDescription
deviceIdID of the device whose settings to retrieve

Response ​

Response Example ​

json
{
  "data": {
    "settings": {
      "theme": "dark",
      "sidebarCollapsed": false
    }
  }
}

Response Fields ​

FieldTypeDescription
data.settingsobjectThe device settings, including the supported theme and sidebar preferences

Code Example ​

curl "https://api.chainabit.com/api/v1/devices/11111111-1111-4111-8111-111111111111/settings" \
  -H "Authorization: Bearer $TOKEN"

Built with purpose. chainabit.com