Skip to main content

Get uplink packets from the database

Returns device uplink packets stored in the server database for the given period. Use this command to get data for a past period — for example, if realtime_data messages were lost when the connection dropped or were received by another subscribed connection.

The response arrives as two get_data_resp messages with the same operation_id: first status: 1 — the request is accepted, then status: 3 — the data.

Request and response: get_data_req → get_data_resp (two messages).
Access: a low access level token sees the devices of its application and of applications that granted it access; a high access level token sees all devices of the owner.

Request​

Fields not marked as required may be omitted.

FieldTypeDescription
cmdstringget_data_req
operation_idstringAny string; the server returns it in the response to match the request and the response
date_fromstringRequired. Period start, inclusive. Format YYYY-MM-DD HH:MM:SS+HHMM
date_tostringRequired. Period end, exclusive. Same format
devEuistringDevice DevEUI, 16 hex characters. Without it — all accessible devices
appIdstringApplication identifier (APP_ID); returns data only for the devices of this application
limituint32How many packets to return. Default 10; the server reduces a value above 500 to 500
descendingbooltrue — newest first. Default false: oldest first
{
"cmd": "get_data_req",
"operation_id": "abc",
"devEui": "7950D20CBBB77561",
"date_from": "2026-10-07 00:00:00+0500",
"date_to": "2026-10-08 00:00:00+0500",
"limit": 100
}

Response​

The first message acknowledges the request:

{
"cmd": "get_data_resp",
"operation_id": "abc",
"status": 1
}

The second one carries the data:

FieldTypeDescription
cmdstringget_data_resp
operation_idstringValue from the request
statusuint81 — request accepted, 3 — data, 2 — error
dataCountuint32Number of packets in the list
dataListarrayPackets; their fields are in the table below
error_code, error_textuint8, stringOnly on error, see below

Packet fields in dataList:

FieldTypeDescription
iduint64Database record number
devEui, devAddrstringThe device
appIdstringIdentifier of the device's application (APP_ID)
timestringReception time, UTC
fportuint8Application port
datastringPayload in hex
sizeuint16Packet size, bytes
fcntuint32Device uplink counter
mtypeuint8LoRaWAN message type: 2 — unconfirmed, 4 — confirmed
adrboolThe device has ADR enabled
ackboolThe server does not fill this field
foptsstringMAC commands in the packet header, hex
datruint8Data rate index (DR)
freqfloatFrequency, MHz
rssiint16Signal strength, dBm
lsnrfloatSignal-to-noise ratio, dB
gatewayEuistringThe gateway the packet was recorded from
gateway_availableobjectAll gateways that received the packet: gateway EUI → string [SNR, RSSI]
packet_loss_ratefloatDevice packet loss estimated by the server, %
output_ack, output_ack_timebool, stringObsolete fields; the server does not populate them
{
"cmd": "get_data_resp",
"operation_id": "abc",
"status": 3,
"dataCount": 1,
"dataList": [
{
"id": 4671384,
"devEui": "7950D20CBBB77561",
"devAddr": "7950D20C",
"appId": "77179F01",
"time": "2026-10-07 13:06:22+0000",
"fport": 2,
"data": "7713F800020F010AA78D0014360100150B0000",
"size": 32,
"fcnt": 7525,
"mtype": 2,
"adr": true,
"ack": false,
"fopts": "",
"datr": 4,
"freq": 865.1,
"rssi": -100,
"lsnr": 6.2,
"gatewayEui": "0000B827EB76A75F",
"gateway_available": {
"0000B827EB76A75F": "[6.2, -100]"
},
"packet_loss_rate": 0,
"output_ack": false,
"output_ack_time": null
}
]
}

Errors​

error_codeerror_textWhat happened
3Invalid date rangedate_from or date_to is missing
1Date parse errorA date could not be parsed

On error a single message with status: 2 arrives, without the acknowledgement.

Good to know​

  • Specify the time zone in dates (+0500, +0000). Times in the response are UTC.
  • No more than 500 packets per request. For a long period, request the data in parts: start the next request from the time of the last received packet — it arrives again, so drop it by id.
  • The server does not use the devAddr request field for filtering — filter by devEui.
  • The result contains only uplinks. Frames sent to devices are returned by get_downlink_data_req.

See also​