#Commands
Commands let you define reusable commands for a tracker and execute them on demand. Two command types are supported:
- Hardware — sends a protocol-level command string directly to the device (e.g. to reboot firmware or toggle a relay).
- HTTP — sends an HTTP POST request with a JSON body to any URL, optionally embedding live device attributes in the payload.
Commands are stored per tracker and can be executed at any time from the Commands block in the platform UI.
Commands is designed for manual, on-demand actions targeting a single tracker. For automated, rule-based command sending across multiple devices, use IoT Logic with the Device action or Webhook nodes.
#Object structure
Each command has a common set of fields. The config object differs by type.
{
"id": 19,
"name": "Reboot",
"type": "hardware",
"config": {
"command": "cpureset",
"reliable": true
}
}id- int. Unique command ID. Assigned by the server on creation. Read-only.name- string. Human-readable label shown in the Commands block (e.g."engine_stop").type- string. Always"hardware"for this variant.config- object. Hardware command configuration.command- string. The exact protocol-level command string sent to the device (e.g."RELAY,1#"). Valid values are device-specific — refer to your device manufacturer's documentation. Can include a single<>placeholder; see Dynamic command values.reliable- boolean. Iftrue, the platform requests delivery confirmation (acknowledgement) from the device before marking the command as successfully sent.
{
"id": 20,
"name": "Notify Slack",
"type": "http",
"config": {
"url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXX",
"headers": [
{
"key": "Authorization",
"value": "Bearer <TOKEN>"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": "{\"text\": \"Device {{device_id}}: speed {{speed}} km/h at {{latitude}}, {{longitude}}\"}"
}
}id- int. Unique command ID. Assigned by the server on creation. Read-only.name- string. Human-readable label shown in the Commands block (e.g."webhook_action").type- string. Always"http"for this variant.config- object. HTTP command configuration.url- string. The full endpoint URL that will receive the HTTP POST request.headers- array of objects. HTTP request headers to include. Can be empty.key- string. Header name (e.g."Authorization").value- string. Header value (e.g."Bearer <TOKEN>").
body- string. The JSON payload sent in the POST request body. Use{{attribute_name}}placeholders to embed live device data — they are replaced with current values at execution time. Can include a single<>placeholder; see Dynamic command values.
Hardware command strings are device-specific. Always refer to your device manufacturer's documentation for valid values. Sending an incorrect command string may have unintended effects on the device.
#Dynamic command values
A hardware command's command string, or an HTTP command's body, can include a single <> placeholder instead of a fixed value. At execution time, the caller supplies the substitution value in the param field of execute, and Mertrack replaces <> with that value before sending.
- A command's
configcan contain at most one<>placeholder.createandupdatereject a command with more than one. executerequiresparamwhen the command'sconfigcontains<>, and rejectsparamwhen it doesn't. Either mismatch returns error 7.paramaccepts up to 500 characters.
#API actions
API base path: /tracker/command.
All API calls require authentication. Pass your API key or user session hash as the hash parameter in the request body, as a query string parameter, or in the Authorization: NVX <value> header. API keys are recommended for integrations — they don't expire and can be managed independently. See Authentication for details.
#create Not available
Creates a new command for a tracker.
Required sub-user rights: tracker_update.
#Parameters
| name | description | type | format |
|---|---|---|---|
| hash | API key or user session hash. | string | "your_api_key" |
| tracker_id | ID of the tracker to create the command for. | int | 70074765 |
| command | Command object without id. See object structure. |
object | See examples |
#Examples
curl -X POST 'https://api.mergroup.be/tracker/command/create' \
-H 'Content-Type: application/json' \
-d '{
"hash": "your_api_key",
"tracker_id": 70074765,
"command": {
"name": "engine_stop",
"type": "hardware",
"config": {
"command": "RELAY,1#",
"reliable": true
}
}
}'curl -X POST 'https://api.mergroup.be/tracker/command/create' \
-H 'Content-Type: application/json' \
-d '{
"hash": "your_api_key",
"tracker_id": 70074765,
"command": {
"name": "webhook_action",
"type": "http",
"config": {
"url": "https://example.com/webhook",
"headers": [
{
"key": "Authorization",
"value": "Bearer <TOKEN>"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": "{\"tracker_id\": {{device_id}}, \"action\": \"execute_output_control\"}"
}
}
}'#Response
Returns the server-assigned id of the created command.
{
"success": true,
"id": 19
}success- boolean. Alwaystruefor successful responses.id- int. ID of the newly created command.
#Errors
- 7 - Invalid parameters – if required fields are missing or malformed.
- 201 - Not found in the database – if no tracker with the given
tracker_idbelongs to the current user.
#update Not available
Updates an existing command. The full object including id must be provided.
Required sub-user rights: tracker_update.
#Parameters
| name | description | type | format |
|---|---|---|---|
| hash | API key or user session hash. | string | "your_api_key" |
| tracker_id | ID of the tracker that owns the command. | int | 70074765 |
| command | Updated command object including id. See object structure. |
object | See example |
#Examples
curl -X POST 'https://api.mergroup.be/tracker/command/update' \
-H 'Content-Type: application/json' \
-d '{
"hash": "your_api_key",
"tracker_id": 70074765,
"command": {
"id": 2,
"name": "engine_stop_updated",
"type": "hardware",
"config": {
"command": "RELAY,0#",
"reliable": true
}
}
}'#Response
{
"success": true
}success- boolean. Alwaystruefor successful responses.
#Errors
- 7 - Invalid parameters – if required fields are missing or malformed.
- 201 - Not found in the database – if the command or tracker does not exist.
#execute Not available
Executes a command immediately. For hardware commands, the command string is sent to the device. For HTTP commands, an HTTP POST request is dispatched to the configured URL with the current device attribute values substituted into the body.
If the command's config contains a dynamic value placeholder (<>), pass the substitution value in param.
Required sub-user rights: tracker_update.
#Parameters
| name | description | type | format |
|---|---|---|---|
| hash | API key or user session hash. | string | "your_api_key" |
| tracker_id | ID of the tracker that owns the command. | int | 70074765 |
| command_id | ID of the command to execute. | int | 3 |
| param | Optional. Value that replaces the <> placeholder in the command. Required if the command contains a placeholder, and rejected otherwise. Up to 500 characters. |
string | "1" |
#Examples
curl -X POST 'https://api.mergroup.be/tracker/command/execute' \
-H 'Content-Type: application/json' \
-d '{
"hash": "your_api_key",
"tracker_id": 70074765,
"command_id": 3
}'curl -X POST 'https://api.mergroup.be/tracker/command/execute' \
-H 'Content-Type: application/json' \
-d '{
"hash": "your_api_key",
"tracker_id": 70074765,
"command_id": 3,
"param": "1"
}'#Response
{
"success": true
}success- boolean. Alwaystruefor successful responses.
#Errors
- 7 - Invalid parameters – if required fields are missing or malformed, if the command's
configcontains<>andparamis missing, or ifparamis provided for a command without a placeholder. - 201 - Not found in the database – if the command or tracker does not exist.
#delete Not available
Deletes a command.
Required sub-user rights: tracker_update.
#Parameters
| name | description | type | format |
|---|---|---|---|
| hash | API key or user session hash. | string | "your_api_key" |
| tracker_id | ID of the tracker that owns the command. | int | 70074765 |
| command_id | ID of the command to delete. | int | 5 |
#Examples
curl -X POST 'https://api.mergroup.be/tracker/command/delete' \
-H 'Content-Type: application/json' \
-d '{
"hash": "your_api_key",
"tracker_id": 70074765,
"command_id": 5
}'#Response
{
"success": true
}success- boolean. Alwaystruefor successful responses.
#Errors
- 7 - Invalid parameters – if required fields are missing or malformed.
- 201 - Not found in the database – if the command or tracker does not exist.
#Batch operations
API path: /tracker/batch_get_commands.
#batch_get_commands Not available
Returns all commands for the specified trackers, grouped by tracker ID. If trackers is omitted or empty, returns commands for all trackers accessible to the current user.
Required sub-user rights: tracker_update.
#Parameters
| name | description | type | format |
|---|---|---|---|
| hash | API key or user session hash. | string | "your_api_key" |
| trackers | Optional. List of tracker IDs to retrieve commands for. If omitted, all accessible trackers are included. | int array | [70074765, 70074766] |
#Examples
curl -X POST 'https://api.mergroup.be/tracker/batch_get_commands' \
-H 'Content-Type: application/json' \
-d '{
"hash": "your_api_key",
"trackers": [70074765]
}'curl -X POST 'https://api.mergroup.be/tracker/batch_get_commands' \
-H 'Content-Type: application/json' \
-d '{
"hash": "your_api_key"
}'#Response
Returns a result object whose keys are tracker IDs (as strings) and values are arrays of command objects for that tracker. Trackers with no configured commands return an empty array.
{
"result": {
"3234961": [
{
"id": 19,
"name": "Reboot",
"type": "hardware",
"config": {
"command": "cpureset",
"reliable": true
}
},
{
"id": 20,
"name": "Notify Slack",
"type": "http",
"config": {
"url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"headers": [],
"body": "{\n \"text\": \"Device {{device_id}}: speed {{speed}} km/h at {{latitude}}, {{longitude}}\"\n}"
}
}
],
"3490965": [],
"3302273": []
},
"success": true
}success- boolean. Alwaystruefor successful responses.result- object. Keys are tracker IDs (string). Values are arrays of command objects. See object structure.
#Errors
- 7 - Invalid parameters – if the
trackersarray contains invalid values.