API Docs

This documentation describes the LoRa Server REST API. This allows the developer to accomplish things that can be done in the Web UI programmatically.

Base Endpoint

https://app.loralink.io/api

Authentication

First you'll need to make sure you get a token. This can be created at Server Settings > Access Tokens.

Once you have your token you can set the Authorization header in your request to your token value.

This endpoint is used to create downlinks to send to a device. You can do this on the Web UI on the device page.

Endpoint: /downlink

Method: POST

Required Params:

NameTypeRequiredAllowed
dev_euiStringyesN/A
typeStringyesCustomPayload, DutyCycleReq, NewChannelReq, RXParamSetupReq, LinkADRReq, DevStatusReq, RXTimingSetupReq
confirmedBooleannoN/A
rx_windowStringnorx1, rx2
paramsObjectyesN/A

The confirmed param defaults to false which sends a unconfirmed message.

The rx_window param defaults to rx1 which sends a message on the first receive window.

The params for each type are described below.

Example body:

{
	"downlink": {
		"dev_eui": "00000000000000B6",
		"type": "CustomPayload",
		"params": {
			"payload": "DEADBEEF",
			"port": 1
		}
	}
}

CustomPayload

This type is used for sending a custom payload to the device and specifying the port.

params:

NameTypeAllowed
payloadStringN/A
portIntegerN/A

Example request body:

{
	"downlink": {
		"dev_eui": "00000000000000B6",
		"type": "CustomPayload",
		"params": {
			"payload": "DEADBEEF",
			"port": 1
		}
	}
}

DutyCycleReq

This type is for sending a DutyCycleReq Mac Command down to the device.

params:

NameTypeAllowed
max_d_cycleIntegerNumbers 0 - 15

Example request body:

{
	"downlink": {
		"dev_eui": "00000000000000B6",
		"type": "DutyCycleReq",
		"params": {
			"max_d_cycle": 1
		}
	}
}

NewChannelReq

This type is for sending a NewChannelReq Mac Command down to the device.

params:

NameTypeAllowed
ch_indexIntegerNumbers 0 - 72
freqIntegerN/A
max_drIntegerNumbers 8 - 13
min_drIntegerNumbers 8 - 13

Example request body:

{
	"downlink": {
		"dev_eui": "00000000000000B6",
		"type": "NewChannelReq",
		"params": {
			"ch_index": 15,
			"freq": 0,
			"max_dr": 10,
			"min_dr": 8
		}
	}
}

RXParamSetupReq

This type is for sending a RXParamSetupReq Mac Command down to the device.

params:

NameTypeAllowed
rx1_offsetIntegerNumbers 0 - 3
rx2_datarateIntegerNumbers 8 - 13
frequencyIntegerN/A

Example request body:

{
	"downlink": {
		"dev_eui": "00000000000000B6",
		"type": "RXParamSetupReq",
		"params": {
			"rx1_offset": 0,
			"rx2_datarate": 8,
			"frequency": 0
		}
	}
}

LinkADRReq

This type is for sending a LinkADRReq Mac Command down to the device.

params:

NameTypeAllowed
data_rateIntegerNumbers 0 - 4
tx_powerIntegerNumbers 0 - 10
ch_mask_cntlIntegerNumbers 0 - 4, 6, 7
nb_transIntegerNumbers 0 - 15
ch_maskIntegerObject

data_rate:

ValueDescription
0DR0
1DR1
2DR2
3DR3
4DR4

tx_power:

ValueDescription
030 dBm
128 dBm
226 dBm
324 dBm
422 dBm
520 dBm
618 dBm
716 dBm
814 dBm
912 dBm
1010 dBm

ch_mask_cntl:

ValueDescription
0channels 0 - 15
1channels 16 - 31
2channels 32 - 47
3channels 48 - 63
4channels 64 - 71
6All 125kHz ON only applies to 64 - 71
7All 125kHz OFF only applies to 64 - 71

ch_mask object:

{
  "0": true,
  "1": false,
  "2": false,
  "3": false,
  "4": false,
  "5": false,
  "6": false,
  "7": false,
  "8": false,
  "9": false,
  "10": false,
  "11": false,
  "12": false,
  "13": false,
  "14": false,
  "15": false
}

Each number is used to set the channel to turn on or off in regards to the ch_mask_cntl.

Example request body:

{
	"downlink": {
		"dev_eui": "00000000000000B6",
		"type": "LinkADRReq",
		"params": {
			"data_rate": 0,
			"tx_power": 0,
			"ch_mask_cntl": 0,
      "nb_trans": 0,
      "ch_mask": {
                    "0": true,
                    "1": false,
                    "2": false,
                    "3": false,
                    "4": false,
                    "5": false,
                    "6": false,
                    "7": false,
                    "8": false,
                    "9": false,
                    "10": false,
                    "11": false,
                    "12": false,
                    "13": false,
                    "14": false,
                    "15": false
                  }
		}
	}
}

DevStatusReq

This type is for sending a DevStatusReq Mac Command down to the device.

Because this Mac Command doesn't have any params the params field in the request body must be set to {}.

Example request body:

{
	"downlink": {
		"dev_eui": "00000000000000B6",
		"type": "DevStatusReq",
		"params": {}
	}
}

RXTimingSetupReq

This type is for sending a RXTimingSetupReq Mac Command down to the device.

params:

NameTypeAllowed
delIntegerNumbers 0 - 15

Example request body:

{
	"downlink": {
		"dev_eui": "00000000000000B6",
		"type": "RXTimingSetupReq",
		"params": {
      "del": 0
    }
	}
}