Skip to Content
APISimulation and messages

Simulation and messages

Set SERVER and BASE as shown in Connection and first request before running these commands.

Paths below are relative to $BASE. One simulation may run or remain paused per backend, across all profiles and clients. At least one active device or gateway is required. Use speed 1 when a bridge or Real gateway participates. Include gatewayBridge in the start body to use an external bridge; saving its configuration alone is not a substitute for this start parameter in an HTTP client.

MethodPathRequest / result
POST/simulation/startStart: {"speed":1,"seed":42,"gatewayBridge":{"enabled":true,"address":"127.0.0.1","port":17800}} → snapshot. Omit gatewayBridge for an internal-only run; seed is optional.
POST/simulation/speed{"speed":2} → snapshot; external transports require 1.
POST/simulation/pausePause → snapshot.
POST/simulation/resumeResume → snapshot.
POST/simulation/stopStop → snapshot.
GET/simulation/snapshotRead {state,metrics,devices,gateways}.
POST/simulation/uplinks{"deviceID":"DEVICE_UUID"} → 202 {id}. Uses the configured payload and protocol; OTAA may first perform a join.
POST/simulation/downlinksBase64 bytes and optional LoRaWAN flags → 202 {id}.
POST/simulation/mac-commands{"deviceID":"DEVICE_UUID","command":{"type":"dev-status-req"}} → 202 {id}.
GET/simulation/metricsPrometheus metrics as text, not JSON.

Control a run

GET /api/simulation/activity is global: inspect it before starting a run to find whether another profile owns the active simulation. Control calls and snapshots return the simulation state, not a delivery acknowledgement.

curl -fsS "$SERVER/api/simulation/activity" curl -fsS "$BASE/simulation/start" -H 'Content-Type: application/json' -d '{"speed":1,"seed":42}' curl -fsS "$BASE/simulation/snapshot" curl -fsS -X POST "$BASE/simulation/pause" curl -fsS -X POST "$BASE/simulation/resume" curl -fsS -X POST "$BASE/simulation/stop"

Send traffic

Queue traffic while the simulation is running or paused; paused traffic is processed after resuming. A manual uplink can be rejected if that device already has a protocol transaction in progress. The message examples below require an active run; restart it if you used the stop command above.

The downlink payload is always Base64 in HTTP JSON, even if your data is UTF-8. fPort is 1–223 for application LoRaWAN data; omit dataRate for automatic selection. Optional flags are confirmed, ack, fPending; macCommands can carry a list of MAC commands. Delivery depends on device class, session, coverage and receive windows. For Raw LoRa, configure the device accordingly before starting; do not wrap raw bytes in a LoRaWAN application payload.

curl -fsS "$BASE/simulation/uplinks" -H 'Content-Type: application/json' \ -d '{"deviceID":"DEVICE_UUID"}' curl -fsS "$BASE/simulation/downlinks" -H 'Content-Type: application/json' \ -d '{"deviceID":"DEVICE_UUID","payload":"SGVsbG8=","fPort":10}' curl -fsS "$BASE/simulation/mac-commands" -H 'Content-Type: application/json' \ -d '{"deviceID":"DEVICE_UUID","command":{"type":"dev-status-req"}}'

MAC commands

MAC command names and parameter keys are listed below. Supply the fields required by the command; regional validation still applies. Frequencies are Hz, delaySeconds is seconds and deviceTimeMilliseconds is a Unix timestamp in milliseconds. Not every optional parameter is relevant to every command.

command.typeRequest / result
link-check-ansmargin, gatewayCount
link-adr-reqdataRate, txPower, nbTrans, channelMask, channelMaskControl
duty-cycle-reqmaxDutyCycleExponent
rx-param-setup-reqdataRate, frequency, rx1DataRateOffset
dev-status-req—
new-channel-reqchannelIndex, frequency, minimumDataRate, maximumDataRate
rx-timing-setup-reqdelaySeconds
tx-param-setup-requplinkDwellTime, downlinkDwellTime, maximumEIRP
dl-channel-reqchannelIndex, frequency
device-time-ansdeviceTimeMilliseconds
ping-slot-info-anspingSlotPeriodicity
ping-slot-channel-reqfrequency, dataRate
beacon-freq-reqfrequency
Last updated on