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
{
"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
| Field | Type | Description |
|---|---|---|
data[].id | string | Device ID |
data[].name | string | Device display name |
data[].deviceType | string | ios, android, macos, windows, linux, or web |
data[].lastUsedAt | string | ISO 8601 last activity timestamp |
data[].createdAt | string | ISO 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
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
name | string | No | -- | Device display name |
deviceType | string | No | -- | Device type label, such as linux or ios |
deviceToken | string | Yes | Non-empty | Application device identifier used for registration and token-based settings lookup |
expoPushToken | string | No | -- | Expo push token, separate from the device identifier |
osVersion / appVersion | string | No | -- | Optional version metadata |
settings | object | No | -- | Initial settings; defaults to an empty object |
Response
Response Example
{
"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
| Field | Type | Description |
|---|---|---|
data.id | string | Newly assigned device ID |
data.name | string | Device display name |
data.deviceType | string | Device deviceType |
data.deviceToken | string | Push notification token |
data.createdAt | string | ISO 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
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
settings | object | Yes | Non-empty, at most 2048 UTF-8 bytes | Settings patch |
settings.theme | string | No | light, dark, system | Theme preference |
settings.sidebarCollapsed | boolean | No | -- | Sidebar preference |
Response
Response Example
{
"data": {
"settings": {
"theme": "dark",
"sidebarCollapsed": false
}
}
}Response Fields
| Field | Type | Description |
|---|---|---|
data.settings | object | The 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
{
"data": {
"settings": {
"theme": "dark",
"sidebarCollapsed": false
}
}
}Response Fields
| Field | Type | Description |
|---|---|---|
data.settings | object | The 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 Parameter | Description |
|---|---|
deviceId | ID of the device whose settings to retrieve |
Response
Response Example
{
"data": {
"settings": {
"theme": "dark",
"sidebarCollapsed": false
}
}
}Response Fields
| Field | Type | Description |
|---|---|---|
data.settings | object | The 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"