{
"swagger": "2.0",
"info": {
"version": "3.7",
"title": "traccar"
},
"host": "traccar.org",
"basePath": "/api",
"schemes": [
"http"
],
"paths": {
"/commands": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Command"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/Command"
}
}
}
}
},
"/devices": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "all",
"in": "query",
"required": true,
"type": "boolean"
},
{
"name": "userId",
"in": "query",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Device"
}
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Device"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/Device"
}
}
}
}
},
"/devices/{id}": {
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "integer"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Device"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/Device"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "integer"
}
],
"responses": {
"204": {
"description": "No Content",
"headers": {}
}
}
}
},
"/devices/geofences": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/DeviceGeofence"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/DeviceGeofence"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/DeviceGeofence"
}
}
],
"responses": {
"204": {
"description": "No Content",
"headers": {}
}
}
}
},
"/groups": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "all",
"in": "query",
"required": true,
"type": "boolean"
},
{
"name": "userId",
"in": "query",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Group"
}
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Group"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/Group"
}
}
}
}
},
"/groups/{id}": {
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "integer"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Group"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/Group"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "integer"
}
],
"responses": {
"204": {
"description": "No Content",
"headers": {}
}
}
}
},
"/groups/geofences": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GroupGeofence"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/GroupGeofence"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GroupGeofence"
}
}
],
"responses": {
"204": {
"description": "No Content",
"headers": {}
}
}
}
},
"/permissions/devices": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/DevicePermission"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/DevicePermission"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/DevicePermission"
}
}
],
"responses": {
"204": {
"description": "No Content",
"headers": {}
}
}
}
},
"/permissions/groups": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GroupPermission"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/GroupPermission"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GroupPermission"
}
}
],
"responses": {
"204": {
"description": "No Content",
"headers": {}
}
}
}
},
"/permissions/geofences": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GeofencePermission"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/GeofencePermission"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GeofencePermission"
}
}
],
"responses": {
"204": {
"description": "No Content",
"headers": {}
}
}
}
},
"/positions": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "deviceId",
"in": "query",
"description": "deviceId is optional, but requires the from and to parameters when used",
"required": false,
"type": "integer"
},
{
"name": "from",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "to",
"in": "query",
"required": false,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Position"
}
}
}
}
}
},
"/server": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/Server"
}
}
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Server"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/Server"
}
}
}
}
},
"/session": {
"get": {
"consumes": [
"application/x-www-form-urlencoded"
],
"produces": [
"application/json"
],
"parameters": [],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/User"
}
},
"404": {
"description": "Not Found",
"headers": {}
}
}
},
"post": {
"consumes": [
"application/x-www-form-urlencoded"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "email",
"in": "formData",
"required": true,
"type": "string"
},
{
"name": "password",
"in": "formData",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/User"
}
},
"401": {
"description": "Unauthorized",
"headers": {}
}
}
},
"delete": {
"consumes": [
"application/x-www-form-urlencoded"
],
"produces": [
"application/json"
],
"parameters": [],
"responses": {
"204": {
"description": "No Content",
"headers": {}
}
}
}
},
"/users": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Position"
}
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/User"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/User"
}
}
}
}
},
"/users/{id}": {
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "integer"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/User"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/User"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "integer"
}
],
"responses": {
"204": {
"description": "No Content",
"headers": {}
}
}
}
},
"/users/notifications": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "all",
"in": "query",
"required": true,
"type": "boolean"
},
{
"name": "userId",
"in": "query",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Notification"
}
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Notification"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/Notification"
}
}
}
}
},
"/commandtypes": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "deviceId",
"in": "query",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/CommandType"
}
}
}
}
}
},
"/geofences": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "all",
"in": "query",
"required": true,
"type": "boolean"
},
{
"name": "userId",
"in": "query",
"required": true,
"type": "integer"
},
{
"name": "groupId",
"in": "query",
"required": true,
"type": "integer"
},
{
"name": "deviceId",
"in": "query",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Geofence"
}
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Geofence"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/Geofence"
}
}
}
}
},
"/geofences/{id}": {
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "integer"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Geofence"
}
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/Geofence"
}
}
}
},
"delete": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "integer"
}
],
"responses": {
"204": {
"description": "No Content",
"headers": {}
}
}
}
},
"/events": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "deviceId",
"in": "query",
"required": true,
"type": "integer"
},
{
"name": "type",
"in": "query",
"required": true,
"type": "string"
},
{
"name": "interval",
"in": "query",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Event"
}
}
}
}
}
},
"/events/{id}": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "OK",
"headers": {},
"schema": {
"$ref": "#/definitions/Event"
}
}
}
}
}
},
"definitions": {
"Position": {
"properties": {
"id": {
"type": "integer"
},
"deviceId": {
"type": "integer"
},
"protocol": {
"type": "string"
},
"deviceTime": {
"type": "string"
},
"fixTime": {
"type": "string"
},
"outdated": {
"type": "boolean"
},
"valid": {
"type": "boolean"
},
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
},
"altitude": {
"type": "number"
},
"speed": {
"type": "number"
},
"course": {
"type": "number"
},
"address": {
"type": "string"
},
"attributes": {}
}
},
"User": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"readonly": {
"type": "boolean"
},
"admin": {
"type": "boolean"
},
"map": {
"type": "string"
},
"language": {
"type": "string"
},
"distanceUnit": {
"type": "string"
},
"speedUnit": {
"type": "string"
},
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
},
"zoom": {
"type": "integer"
},
"password": {
"type": "string"
},
"twelveHourFormat": {
"type": "boolean"
},
"attributes": {}
}
},
"Server": {
"properties": {
"id": {
"type": "integer"
},
"registration": {
"type": "boolean"
},
"readonly": {
"type": "boolean"
},
"map": {
"type": "string"
},
"bingKey": {
"type": "string"
},
"mapUrl": {
"type": "string"
},
"distanceUnit": {
"type": "string"
},
"speedUnit": {
"type": "string"
},
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
},
"zoom": {
"type": "integer"
},
"twelveHourFormat": {
"type": "boolean"
},
"attributes": {}
}
},
"Command": {
"properties": {
"deviceId": {
"type": "integer"
},
"type": {
"type": "string"
},
"attributes": {}
}
},
"Device": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"uniqueId": {
"type": "string"
},
"status": {
"type": "string"
},
"lastUpdate": {
"type": "string"
},
"positionId": {
"type": "integer"
},
"groupId": {
"type": "integer"
},
"geofenceIds": {},
"attributes": {}
}
},
"Group": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"groupId": {
"type": "integer"
},
"attributes": {}
}
},
"DevicePermission": {
"properties": {
"userId": {
"type": "integer"
},
"deviceId": {
"type": "integer"
}
}
},
"GroupPermission": {
"properties": {
"userId": {
"type": "integer"
},
"groupId": {
"type": "integer"
}
}
},
"GeofencePermission": {
"properties": {
"userId": {
"type": "integer"
},
"geofenceId": {
"type": "integer"
}
}
},
"GroupGeofence": {
"properties": {
"groupId": {
"type": "integer"
},
"geofenceId": {
"type": "integer"
}
}
},
"DeviceGeofence": {
"properties": {
"deviceId": {
"type": "integer"
},
"geofenceId": {
"type": "integer"
}
}
},
"CommandType": {
"properties": {
"type": {
"type": "string"
}
}
},
"Geofence": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"area": {
"type": "string"
},
"attributes": {}
}
},
"Notification": {
"properties": {
"id": {
"type": "integer"
},
"type": {
"type": "string"
},
"userId": {
"type": "integer"
},
"attributes": {}
}
},
"Event": {
"properties": {
"id": {
"type": "integer"
},
"type": {
"type": "string"
},
"serverTime": {
"type": "string"
},
"deviceId": {
"type": "integer"
},
"positionId": {
"type": "integer"
},
"geofenceId": {
"type": "integer"
},
"attributes": {}
}
}
}
}