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
{
"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
| Field | Type | Description |
|---|---|---|
data[].id | string | Device ID |
data[].name | string | Device display name |
data[].platform | string | ios, android, macos, windows, linux, or web |
data[].lastActiveAt | 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"const response = await fetch(`${BASE_URL}/devices`, {
headers: {
"Authorization": `Bearer ${TOKEN}`
}
});
const data = await response.json();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
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
name | string | Yes | -- | Device display name |
platform | string | Yes | ios, android, macos, windows, linux, web | Device platform |
deviceToken | string | No | -- | Push notification token (e.g., FCM token) |
Response
Response Example
{
"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
| Field | Type | Description |
|---|---|---|
data.id | string | Newly assigned device ID |
data.name | string | Device display name |
data.platform | string | Device platform |
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",
"platform": "linux",
"deviceToken": "fcm-token-abc123"
}'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();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
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
pushNotifications | boolean | No | -- | Enable push notifications |
soundEnabled | boolean | No | -- | Enable sound for notifications |
Response
Response Example
{
"data": {
"deviceId": "dev-9012-ijkl",
"pushNotifications": true,
"soundEnabled": false,
"updatedAt": "2026-03-17T11:05:00.000Z"
},
"meta": null,
"error": null
}Response Fields
| Field | Type | Description |
|---|---|---|
data.deviceId | string | Associated device ID |
data.pushNotifications | boolean | Push notifications enabled |
data.soundEnabled | boolean | Notification sound enabled |
Code Example
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
}'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();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
{
"data": {
"deviceId": "dev-9012-ijkl",
"pushNotifications": true,
"soundEnabled": false
},
"meta": null,
"error": null
}Response Fields
| Field | Type | Description |
|---|---|---|
data.deviceId | string | Associated device ID |
data.pushNotifications | boolean | Push notifications enabled |
data.soundEnabled | boolean | Notification sound enabled |
Code Example
curl "https://api.chainabit.com/api/v1/devices/settings/by-token" \
-H "Authorization: Bearer $TOKEN" \
-H "x-device-token: fcm-token-abc123"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();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 Parameter | Description |
|---|---|
deviceId | ID of the device whose settings to retrieve |
Response
Response Example
{
"data": {
"deviceId": "dev-9012-ijkl",
"pushNotifications": true,
"soundEnabled": false
},
"meta": null,
"error": null
}Response Fields
| Field | Type | Description |
|---|---|---|
data.deviceId | string | Associated device ID |
data.pushNotifications | boolean | Push notifications enabled |
data.soundEnabled | boolean | Notification sound enabled |
Code Example
curl "https://api.chainabit.com/api/v1/devices/dev-9012-ijkl/settings" \
-H "Authorization: Bearer $TOKEN"const response = await fetch(`${BASE_URL}/devices/dev-9012-ijkl/settings`, {
headers: {
"Authorization": `Bearer ${TOKEN}`
}
});
const data = await response.json();import requests
response = requests.get(
f"{BASE_URL}/devices/dev-9012-ijkl/settings",
headers={"Authorization": f"Bearer {TOKEN}"}
)
data = response.json()