Upload device log entries (device)
POST
/device/logs
const url = 'https://localhost:8080/api/v1/device/logs';const options = { method: 'POST', headers: { 'X-Device-ID': 'example', 'X-Device-Key': 'example', 'Content-Type': 'application/json' }, body: '{"dropped":0,"entries":[{"boot_count":12,"level":"debug","message":"reconnect failed: timeout","tag":"wifi","ts":1793700000,"uptime_ms":183000}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://localhost:8080/api/v1/device/logs \ --header 'Content-Type: application/json' \ --header 'X-Device-ID: example' \ --header 'X-Device-Key: example' \ --data '{ "dropped": 0, "entries": [ { "boot_count": 12, "level": "debug", "message": "reconnect failed: timeout", "tag": "wifi", "ts": 1793700000, "uptime_ms": 183000 } ] }'Stores up to 50 important log entries (warnings, errors, boot, WiFi, OTA events) from the calling device. Limited to 20 uploads per device per hour.
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”X-Device-ID
required
string
Public device id (dev_…)
X-Device-Key
required
string
Secret device key (sk_…)
Request Body
Section titled “Request Body”Log batch
Media typeapplication/json
object
dropped
Dropped counts entries the device discarded because its buffer was full.
integer
Example
0entries
Array<object>
object
boot_count
required
integer
Example
12level
required
string
Example
warnmessage
required
string
Example
reconnect failed: timeouttag
string
Example
wifits
Ts is the device’s Unix time in seconds, omitted until its clock is synced.
integer
Example
1793700000uptime_ms
required
integer
Example
183000Responses
Section titled “Responses”Created
Media typeapplication/json
object
data
object
accepted
integer
Example
{ "data": { "accepted": 12 }}Unauthorized
Media typeapplication/json
object
detail
string
errors
Array<object>
object
code
string
detail
string
in
string
name
string
instance
string
status
integer
title
string
type
string
Example
{ "detail": "One or more request values are invalid.", "errors": [ { "code": "required", "detail": "name is required", "in": "body", "name": "name" } ], "instance": "/api/v1/devices", "status": 422, "title": "Request validation failed", "type": "https://docs.air-iq.net/reference/errors/#validation-error"}Request Entity Too Large
Media typeapplication/json
object
detail
string
errors
Array<object>
object
code
string
detail
string
in
string
name
string
instance
string
status
integer
title
string
type
string
Example
{ "detail": "One or more request values are invalid.", "errors": [ { "code": "required", "detail": "name is required", "in": "body", "name": "name" } ], "instance": "/api/v1/devices", "status": 422, "title": "Request validation failed", "type": "https://docs.air-iq.net/reference/errors/#validation-error"}Unsupported Media Type
Media typeapplication/json
object
detail
string
errors
Array<object>
object
code
string
detail
string
in
string
name
string
instance
string
status
integer
title
string
type
string
Example
{ "detail": "One or more request values are invalid.", "errors": [ { "code": "required", "detail": "name is required", "in": "body", "name": "name" } ], "instance": "/api/v1/devices", "status": 422, "title": "Request validation failed", "type": "https://docs.air-iq.net/reference/errors/#validation-error"}Unprocessable Entity
Media typeapplication/json
object
detail
string
errors
Array<object>
object
code
string
detail
string
in
string
name
string
instance
string
status
integer
title
string
type
string
Example
{ "detail": "One or more request values are invalid.", "errors": [ { "code": "required", "detail": "name is required", "in": "body", "name": "name" } ], "instance": "/api/v1/devices", "status": 422, "title": "Request validation failed", "type": "https://docs.air-iq.net/reference/errors/#validation-error"}Too Many Requests
Media typeapplication/json
object
detail
string
errors
Array<object>
object
code
string
detail
string
in
string
name
string
instance
string
status
integer
title
string
type
string
Example
{ "detail": "One or more request values are invalid.", "errors": [ { "code": "required", "detail": "name is required", "in": "body", "name": "name" } ], "instance": "/api/v1/devices", "status": 422, "title": "Request validation failed", "type": "https://docs.air-iq.net/reference/errors/#validation-error"}Internal Server Error
Media typeapplication/json
object
detail
string
errors
Array<object>
object
code
string
detail
string
in
string
name
string
instance
string
status
integer
title
string
type
string
Example
{ "detail": "One or more request values are invalid.", "errors": [ { "code": "required", "detail": "name is required", "in": "body", "name": "name" } ], "instance": "/api/v1/devices", "status": 422, "title": "Request validation failed", "type": "https://docs.air-iq.net/reference/errors/#validation-error"}