3.1 KiB
3.1 KiB
Mobile Integration Spec (Stage 1)
Base URL
- Processor endpoints are mounted under
/api/v1/mobile.
Headers
- Optional:
x-flow-idfor end-to-end trace correlation. - Required for ping/sync endpoints:
x-device-idwith a previously registeredexternalDeviceId.
Endpoints
Register Device
- Method:
POST - Path:
/api/v1/mobile/register - Auth: none (trusted private network assumption)
Payload:
{
"externalDeviceId": "android-1234",
"name": "Pixel 8 Pro",
"manufacturer": "Google",
"model": "Pixel 8 Pro",
"androidVersion": "15"
}
Ping Device
- Method:
PUT - Path:
/api/v1/mobile/ping - Required header:
x-device-id
Payload:
{
"pingAt": "2026-03-01T10:15:00.000Z"
}
Sync SMS
- Method:
PUT - Path:
/api/v1/mobile/sms/sync - Required header:
x-device-id
Payload:
{
"messages": [
{
"externalMessageId": "msg-1",
"sender": "+358401111111",
"recipient": "+358402222222",
"body": "Hello from device",
"sentAt": "2026-03-01T10:10:00.000Z",
"receivedAt": "2026-03-01T10:10:01.000Z",
"rawPayload": {
"threadId": "7"
}
}
]
}
Sync Media Assets
- Method:
PUT - Path:
/api/v1/mobile/media/sync - Required header:
x-device-id - Content-Type:
multipart/form-data
Upload contract:
- One request uploads one raw media file.
- Multipart field
fileis required (binary). - Optional multipart metadata fields:
externalMediaIdmimeTypefilenamecapturedAt(ISO date string)sizeBytes(number)hashmetadata(JSON object string)
- Optional metadata headers (alternative to multipart fields):
x-media-external-idx-media-mime-typex-media-filenamex-media-captured-atx-media-size-bytesx-media-hashx-media-metadata(JSON object string)
Response Contract
Success:
{
"data": {},
"error": null
}
Failure:
{
"data": null,
"error": {
"flowId": "uuid",
"code": "VALIDATION_ERROR",
"message": "Human message",
"description": "Actionable description",
"detail": "Technical detail"
}
}
Admin Query Contract
- Pagination:
page: 1-based integerpageSize: integer
- Sorting:
sortBy: operation-specificsortOrder:ascordesc
- Paginated response payload:
data: rowstotal: full row countpage,pageSize,totalPages
Dedup Rules
- Device:
- Upsert on unique
externalDeviceId.
- Upsert on unique
- SMS:
- Dedup key #1:
(deviceId, externalMessageId)when provided. - Dedup key #2 fallback:
(deviceId, dedupHash)where dedup hash is SHA-256 of(deviceId + sentAt + sender + body).
- Dedup key #1:
- Media:
- Raw file is uploaded first and persisted in
file. - Then one
mobile_media_assetrow is created referencing uploadedfileId. - Dedup key:
(deviceId, externalMediaId)when provided.
- Raw file is uploaded first and persisted in
Operator Checklist
- Register a device.
- Send ping with
x-device-idand verify dashboardlastPingAtupdates. - Sync SMS and verify device detail
SMStab updates (polling every 5s). - Sync media and verify device detail
Media Assetstab displays rows.