Devices and tracking

Commands

Sending commands to devices and stored command management

Fetch a list of Saved Commands

GET
https://demo.traccar.org/api/commands

Without params, it returns a list of Saved Commands the user has access to

Parameters

allbooleanquery

Can only be used by admins or managers to fetch all entities

userIdintegerquery

Standard users can use this only with their own userId

deviceIdintegerquery

Standard users can use this only with _deviceId_s, they have access to

groupIdintegerquery

Standard users can use this only with _groupId_s, they have access to

refreshbooleanquery
limitintegerquery

Limit the number of returned results

offsetintegerquery

Offset for pagination

keywordstringquery

Search keyword filter

Response

OK

Response fields application/json
Show child attributes
idinteger<int64>

Unique saved command identifier

deviceIdinteger<int64>

Target device identifier when the command is bound to one device

descriptionstring

User friendly label displayed in the UI

typestring

Command type as defined by the device protocol

textChannelboolean

Whether to send the command using the SMS channel

attributesobject

Additional parameters required by the command type

401Unauthorized

Unauthorized

Authorization

BasicAuthhttp (basic)
ApiKeyhttp (bearer)

Create a Saved Command

POST
https://demo.traccar.org/api/commands

Body

application/json
idinteger<int64>

Unique saved command identifier

deviceIdinteger<int64>

Target device identifier when the command is bound to one device

descriptionstring

User friendly label displayed in the UI

typestring

Command type as defined by the device protocol

textChannelboolean

Whether to send the command using the SMS channel

attributesobject

Additional parameters required by the command type

Response

200OKCommand

OK

Response fields application/json
idinteger<int64>

Unique saved command identifier

deviceIdinteger<int64>

Target device identifier when the command is bound to one device

descriptionstring

User friendly label displayed in the UI

typestring

Command type as defined by the device protocol

textChannelboolean

Whether to send the command using the SMS channel

attributesobject

Additional parameters required by the command type

400Bad Request

Bad request

401Unauthorized

Unauthorized

Authorization

BasicAuthhttp (basic)
ApiKeyhttp (bearer)

Fetch a Saved Command

GET
https://demo.traccar.org/api/commands/{id}

Parameters

idintegerrequiredpath

Response

200OKCommand

OK

Response fields application/json
idinteger<int64>

Unique saved command identifier

deviceIdinteger<int64>

Target device identifier when the command is bound to one device

descriptionstring

User friendly label displayed in the UI

typestring

Command type as defined by the device protocol

textChannelboolean

Whether to send the command using the SMS channel

attributesobject

Additional parameters required by the command type

401Unauthorized

Unauthorized

404Not Found

Not found

Authorization

BasicAuthhttp (basic)
ApiKeyhttp (bearer)

Update a Saved Command

PUT
https://demo.traccar.org/api/commands/{id}

Body

application/json
idinteger<int64>

Unique saved command identifier

deviceIdinteger<int64>

Target device identifier when the command is bound to one device

descriptionstring

User friendly label displayed in the UI

typestring

Command type as defined by the device protocol

textChannelboolean

Whether to send the command using the SMS channel

attributesobject

Additional parameters required by the command type

Parameters

idintegerrequiredpath

Response

200OKCommand

OK

Response fields application/json
idinteger<int64>

Unique saved command identifier

deviceIdinteger<int64>

Target device identifier when the command is bound to one device

descriptionstring

User friendly label displayed in the UI

typestring

Command type as defined by the device protocol

textChannelboolean

Whether to send the command using the SMS channel

attributesobject

Additional parameters required by the command type

400Bad Request

Bad request

401Unauthorized

Unauthorized

Authorization

BasicAuthhttp (basic)
ApiKeyhttp (bearer)

Delete a Saved Command

DELETE
https://demo.traccar.org/api/commands/{id}

Parameters

idintegerrequiredpath

Response

204No Content

No Content

401Unauthorized

Unauthorized

Authorization

BasicAuthhttp (basic)
ApiKeyhttp (bearer)

Fetch a list of Saved Commands supported by Device at the moment

GET
https://demo.traccar.org/api/commands/send

Return a list of saved commands linked to Device and its groups, filtered by current Device protocol support

Parameters

deviceIdintegerrequiredquery

Standard users can use this only with _deviceId_s, they have access to

Response

OK

Response fields application/json
Show child attributes
idinteger<int64>

Unique saved command identifier

deviceIdinteger<int64>

Target device identifier when the command is bound to one device

descriptionstring

User friendly label displayed in the UI

typestring

Command type as defined by the device protocol

textChannelboolean

Whether to send the command using the SMS channel

attributesobject

Additional parameters required by the command type

400Bad Request

Could happen when the user doesn't have permission for the device

Authorization

BasicAuthhttp (basic)
ApiKeyhttp (bearer)

Dispatch commands to device

POST
https://demo.traccar.org/api/commands/send

Dispatch a new command or Saved Command if body.id set

Body

application/json
idinteger<int64>

Unique saved command identifier

deviceIdinteger<int64>

Target device identifier when the command is bound to one device

descriptionstring

User friendly label displayed in the UI

typestring

Command type as defined by the device protocol

textChannelboolean

Whether to send the command using the SMS channel

attributesobject

Additional parameters required by the command type

Parameters

groupIdintegerquery

Send the command to all devices in the group

Response

200OKCommand

Command sent

Response fields application/json
idinteger<int64>

Unique saved command identifier

deviceIdinteger<int64>

Target device identifier when the command is bound to one device

descriptionstring

User friendly label displayed in the UI

typestring

Command type as defined by the device protocol

textChannelboolean

Whether to send the command using the SMS channel

attributesobject

Additional parameters required by the command type

202AcceptedQueuedCommand | Array<QueuedCommand>

Command queued

Response fields application/json
Any of
idinteger<int64>

Identifier of the queued command job

deviceIdinteger<int64>

Device identifier the queued command will be delivered to

typestring

Command type that will be executed

textChannelboolean

Indicates whether the queued command uses SMS delivery

attributesobject

Stored parameters for the queued command

Show child attributes
idinteger<int64>

Identifier of the queued command job

deviceIdinteger<int64>

Device identifier the queued command will be delivered to

typestring

Command type that will be executed

textChannelboolean

Indicates whether the queued command uses SMS delivery

attributesobject

Stored parameters for the queued command

400Bad Request

Could happen when the user doesn't have permission or an incorrect command type for the device

Authorization

BasicAuthhttp (basic)
ApiKeyhttp (bearer)

Fetch a list of available Commands for the Device or all possible Commands if Device ommited

GET
https://demo.traccar.org/api/commands/types

Parameters

deviceIdintegerquery

Internal device identifier. Only works if device has already reported some locations

textChannelbooleanquery

When true return SMS commands. If not specified or false return data commands

Response

OK

Response fields application/json
Show child attributes
typestring

Command type identifier

400Bad Request

Could happen when trying to fetch from a device the user does not have permission

Authorization

BasicAuthhttp (basic)
ApiKeyhttp (bearer)