https://easycms.fi/public_api/register_device/ — binds one Inventory Manager API credential (one API token row, or the legacy inventory pair) to one app installation. After enrollment, that credential only works from the enrolled device: every other API call must then carry the X-Device-ID and X-Device-Token headers. Credentials that are never enrolled keep working exactly as before — device binding is opt-in per credential, and only this endpoint can claim a credential (ordinary API endpoints never auto-enroll).
Once, during account setup — after the user entered the account API credentials and before the first normal API call. Store the returned device_token in OS secure storage next to the credential; also generate and persist a random installation UUID (device_id) the first time the app runs and keep sending the SAME value forever.
POST only, Content-Type: application/json, HTTPS only.
Authentication — exactly the fields the app already sends for every API call (see API Credentials):
username, token, account (no header, no password)Authorization1 header + username, password, accountEnrollment fields:
| Parameter | Type | Description |
|---|---|---|
device_id |
string, required | The installation UUID (or device MAC): 12–64 hex characters, with or without :/- separators. Generated once per installation, persisted securely, never changed |
device_name |
string, optional | Human-readable label, max 100 chars (shown to the account administrator) |
platform |
string, optional | One of android, ios, macos, windows, linux, web, unknown |
app_version |
string, optional | App version label, max 40 chars |
Header (optional): Idempotency-Key: <random UUID> — persist it for this enrollment attempt. If the response is lost, a retry with the same key and the same body re-serves the original response including the one-time device token for 24 hours. A reused key with a changed body is rejected (409 idempotency_key_conflict).
First enrollment — 201 Created:
{
"ok": true,
"status": "registered",
"device": {
"device_id": "6aa5a978-89bd-49f7-9a8d-21e446c58e71",
"device_name": "Front counter iPad",
"platform": "ios",
"app_version": "1.0.7+10",
"bound_at": "2026-11-11T09:30:00Z"
},
"device_token": "<64-char opaque token — shown ONCE, store it securely>"
}
device.device_id echoes the device_id you sent verbatim (separators and case preserved) — compare it directly against your persisted installation id. Internally the CMS stores a canonical form (lowercased, separators stripped), so any separator/case variant of the same id resolves to the same binding.
Retry from the same device with the valid device token (X-Device-Token header) — 200 OK: status: "already_registered", the binding is NOT rotated and the raw token is never returned again.
Error codes:
| HTTP | Code | Meaning |
|---|---|---|
400 |
invalid_device_request |
Not POST, not HTTPS, invalid device_id, invalid platform, or conflicting auth fields (token mode + Authorization1 header) |
403 |
device_token_invalid |
Same device_id but the device token is missing/wrong — re-enrollment is not a recovery mechanism; ask an administrator to release the binding |
409 |
credential_bound_to_another_device |
A different installation already holds this credential. Ask an administrator to release it first (Settings → APIs → Inventory Manager app → Clear device binding) |
409 |
idempotency_key_conflict |
The Idempotency-Key was reused with a different request body |
429 |
rate_limited |
Too many enrollment attempts (20 / 5 min / account) |
404 family |
UN-AUTHORIZED ... |
The account credential itself failed — the API's standard auth error family |
The 409 response never reveals which device holds the binding.
Attach BOTH headers to every request to any other public_api endpoint (reads, writes, verify_user, picking — all of them):
X-Device-ID: 6aa5a97889bd49f79a8d21e446c58e71
X-Device-Token: <the opaque device token from registration>
Rules the server enforces:
UN-AUTHORIZED - this token is used by another device, please request a new token! — one message, never disclosing the bound device.device_id is an identifier, not proof of hardware identity — a copied UUID plus the device token can still impersonate the installation. This binding prevents ordinary reuse of a leaked API token on another device.