# Server

Server information

## Fetch Server information

`GET /server`

Authentication: no security requirement declared for this operation.

Responses:

- 200: OK

Content type: application/json

Type: Server

Schema: [Server](https://sourcey-traccar.pages.dev/api-reference/models/server/index.md)

- `id` (optional)
  Type: integer, int64
  
  Unique server configuration identifier

- `registration` (optional)
  Type: boolean
  
  Whether new user registrations are allowed

- `readonly` (optional)
  Type: boolean
  
  When true only administrators can modify server-wide settings

- `deviceReadonly` (optional)
  Type: boolean
  
  Disallow device attribute changes for non-admins

- `limitCommands` (optional)
  Type: boolean
  
  Restrict command execution to supported protocol commands

- `map` (optional)
  Type: string
  
  Default map layer identifier

- `bingKey` (optional)
  Type: string
  
  Bing Maps API key used when Bing is selected as a provider

- `mapUrl` (optional)
  Type: string
  
  Custom tile server URL template if configured

- `poiLayer` (optional)
  Type: string
  
  External point-of-interest layer configuration

- `announcement` (optional)
  Type: string
  
  Message displayed to all users in the web application

- `latitude` (optional)
  Type: number
  
  Default map center latitude

- `longitude` (optional)
  Type: number
  
  Default map center longitude

- `zoom` (optional)
  Type: integer
  
  Default map zoom level

- `version` (optional)
  Type: string
  
  Traccar server version string

- `forceSettings` (optional)
  Type: boolean
  
  Forces users to use the server-wide settings instead of their own

- `coordinateFormat` (optional)
  Type: string
  
  Default coordinate format for displaying positions

- `openIdEnabled` (optional)
  Type: boolean
  
  Indicates whether OpenID authentication is available

- `openIdForce` (optional)
  Type: boolean
  
  Require OpenID authentication for all users when enabled

- `attributes` (optional)
  Type: object
  
  Additional server-level configuration values

- 400: Bad request

## Examples

### cURL

```bash
curl -X GET 'https://demo.traccar.org/api/server'
```

### JavaScript

```javascript
const response = await fetch('https://demo.traccar.org/api/server', {
  method: 'GET',
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get('https://demo.traccar.org/api/server')
print(response.text)
```


## Update Server information

`PUT /server`

Authentication (security requirement alternatives):

```json
[
  {
    "BasicAuth": []
  },
  {
    "ApiKey": []
  }
]
```

- BasicAuth: http (basic)
- ApiKey: http (bearer)

Request body: application/json (required)

Type: Server

Schema: [Server](https://sourcey-traccar.pages.dev/api-reference/models/server/index.md)

- `id` (optional)
  Type: integer, int64
  
  Unique server configuration identifier

- `registration` (optional)
  Type: boolean
  
  Whether new user registrations are allowed

- `readonly` (optional)
  Type: boolean
  
  When true only administrators can modify server-wide settings

- `deviceReadonly` (optional)
  Type: boolean
  
  Disallow device attribute changes for non-admins

- `limitCommands` (optional)
  Type: boolean
  
  Restrict command execution to supported protocol commands

- `map` (optional)
  Type: string
  
  Default map layer identifier

- `bingKey` (optional)
  Type: string
  
  Bing Maps API key used when Bing is selected as a provider

- `mapUrl` (optional)
  Type: string
  
  Custom tile server URL template if configured

- `poiLayer` (optional)
  Type: string
  
  External point-of-interest layer configuration

- `announcement` (optional)
  Type: string
  
  Message displayed to all users in the web application

- `latitude` (optional)
  Type: number
  
  Default map center latitude

- `longitude` (optional)
  Type: number
  
  Default map center longitude

- `zoom` (optional)
  Type: integer
  
  Default map zoom level

- `version` (optional)
  Type: string
  
  Traccar server version string

- `forceSettings` (optional)
  Type: boolean
  
  Forces users to use the server-wide settings instead of their own

- `coordinateFormat` (optional)
  Type: string
  
  Default coordinate format for displaying positions

- `openIdEnabled` (optional)
  Type: boolean
  
  Indicates whether OpenID authentication is available

- `openIdForce` (optional)
  Type: boolean
  
  Require OpenID authentication for all users when enabled

- `attributes` (optional)
  Type: object
  
  Additional server-level configuration values

Responses:

- 200: OK

Content type: application/json

Type: Server

Schema: [Server](https://sourcey-traccar.pages.dev/api-reference/models/server/index.md)

- `id` (optional)
  Type: integer, int64
  
  Unique server configuration identifier

- `registration` (optional)
  Type: boolean
  
  Whether new user registrations are allowed

- `readonly` (optional)
  Type: boolean
  
  When true only administrators can modify server-wide settings

- `deviceReadonly` (optional)
  Type: boolean
  
  Disallow device attribute changes for non-admins

- `limitCommands` (optional)
  Type: boolean
  
  Restrict command execution to supported protocol commands

- `map` (optional)
  Type: string
  
  Default map layer identifier

- `bingKey` (optional)
  Type: string
  
  Bing Maps API key used when Bing is selected as a provider

- `mapUrl` (optional)
  Type: string
  
  Custom tile server URL template if configured

- `poiLayer` (optional)
  Type: string
  
  External point-of-interest layer configuration

- `announcement` (optional)
  Type: string
  
  Message displayed to all users in the web application

- `latitude` (optional)
  Type: number
  
  Default map center latitude

- `longitude` (optional)
  Type: number
  
  Default map center longitude

- `zoom` (optional)
  Type: integer
  
  Default map zoom level

- `version` (optional)
  Type: string
  
  Traccar server version string

- `forceSettings` (optional)
  Type: boolean
  
  Forces users to use the server-wide settings instead of their own

- `coordinateFormat` (optional)
  Type: string
  
  Default coordinate format for displaying positions

- `openIdEnabled` (optional)
  Type: boolean
  
  Indicates whether OpenID authentication is available

- `openIdForce` (optional)
  Type: boolean
  
  Require OpenID authentication for all users when enabled

- `attributes` (optional)
  Type: object
  
  Additional server-level configuration values

- 400: Bad request

- 401: Unauthorized

## Examples

### cURL

```bash
curl -X PUT 'https://demo.traccar.org/api/server' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "id": 0,
  "registration": true,
  "readonly": true,
  "deviceReadonly": true,
  "limitCommands": true,
  "map": "string",
  "bingKey": "string",
  "mapUrl": "string",
  "poiLayer": "string",
  "announcement": "string",
  "latitude": 0,
  "longitude": 0,
  "zoom": 0,
  "version": "string",
  "forceSettings": true,
  "coordinateFormat": "string",
  "openIdEnabled": true,
  "openIdForce": true,
  "attributes": {}
}'
```

### JavaScript

```javascript
const body = `{
  "id": 0,
  "registration": true,
  "readonly": true,
  "deviceReadonly": true,
  "limitCommands": true,
  "map": "string",
  "bingKey": "string",
  "mapUrl": "string",
  "poiLayer": "string",
  "announcement": "string",
  "latitude": 0,
  "longitude": 0,
  "zoom": 0,
  "version": "string",
  "forceSettings": true,
  "coordinateFormat": "string",
  "openIdEnabled": true,
  "openIdForce": true,
  "attributes": {}
}`;

const response = await fetch('https://demo.traccar.org/api/server', {
  method: 'PUT',
  headers: {
    'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "id": 0,
  "registration": true,
  "readonly": true,
  "deviceReadonly": true,
  "limitCommands": true,
  "map": "string",
  "bingKey": "string",
  "mapUrl": "string",
  "poiLayer": "string",
  "announcement": "string",
  "latitude": 0,
  "longitude": 0,
  "zoom": 0,
  "version": "string",
  "forceSettings": true,
  "coordinateFormat": "string",
  "openIdEnabled": true,
  "openIdForce": true,
  "attributes": {}
}'''

response = requests.put(
    'https://demo.traccar.org/api/server',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Reverse geocode coordinates

`GET /server/geocode`

Authentication (security requirement alternatives):

```json
[
  {
    "BasicAuth": []
  },
  {
    "ApiKey": []
  }
]
```

- BasicAuth: http (basic)
- ApiKey: http (bearer)

Parameters:

- `latitude` (query, number, double, required)
  Type: number, double

- `longitude` (query, number, double, required)
  Type: number, double

Responses:

- 200: OK

Content type: text/plain

Type: string

- 401: Unauthorized

- 500: Reverse geocoding is not enabled

## Examples

### cURL

```bash
curl -X GET 'https://demo.traccar.org/api/server/geocode?latitude=0&longitude=0' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE'
```

### JavaScript

```javascript
const response = await fetch('https://demo.traccar.org/api/server/geocode?latitude=0&longitude=0', {
  method: 'GET',
  headers: {
    'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://demo.traccar.org/api/server/geocode?latitude=0&longitude=0',
    headers={
        'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
    },
)
print(response.text)
```


## Fetch available timezones

`GET /server/timezones`

Authentication (security requirement alternatives):

```json
[
  {
    "BasicAuth": []
  },
  {
    "ApiKey": []
  }
]
```

- BasicAuth: http (basic)
- ApiKey: http (bearer)

Responses:

- 200: OK

Content type: application/json

Type: Array<string>

Items:
  Type: string

- 401: Unauthorized

## Examples

### cURL

```bash
curl -X GET 'https://demo.traccar.org/api/server/timezones' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE'
```

### JavaScript

```javascript
const response = await fetch('https://demo.traccar.org/api/server/timezones', {
  method: 'GET',
  headers: {
    'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://demo.traccar.org/api/server/timezones',
    headers={
        'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
    },
)
print(response.text)
```


## Upload a server file

`POST /server/file/{path}`

Authentication (security requirement alternatives):

```json
[
  {
    "BasicAuth": []
  },
  {
    "ApiKey": []
  }
]
```

- BasicAuth: http (basic)
- ApiKey: http (bearer)

Parameters:

- `path` (path, string, required)
  Type: string

Request body: application/octet-stream (required)

Type: string, binary

Responses:

- 200: OK

- 400: Bad request

## Examples

### cURL

```bash
curl -X POST 'https://demo.traccar.org/api/server/file/string' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE'
```

### JavaScript

```javascript
const response = await fetch('https://demo.traccar.org/api/server/file/string', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.post(
    'https://demo.traccar.org/api/server/file/string',
    headers={
        'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
    },
)
print(response.text)
```


## Trigger garbage collection

`GET /server/gc`

Authentication (security requirement alternatives):

```json
[
  {
    "BasicAuth": []
  },
  {
    "ApiKey": []
  }
]
```

- BasicAuth: http (basic)
- ApiKey: http (bearer)

Responses:

- 200: OK

- 401: Unauthorized

## Examples

### cURL

```bash
curl -X GET 'https://demo.traccar.org/api/server/gc' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE'
```

### JavaScript

```javascript
const response = await fetch('https://demo.traccar.org/api/server/gc', {
  method: 'GET',
  headers: {
    'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://demo.traccar.org/api/server/gc',
    headers={
        'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
    },
)
print(response.text)
```


## Fetch cache diagnostics

`GET /server/cache`

Authentication (security requirement alternatives):

```json
[
  {
    "BasicAuth": []
  },
  {
    "ApiKey": []
  }
]
```

- BasicAuth: http (basic)
- ApiKey: http (bearer)

Responses:

- 200: OK

Content type: text/plain

Type: string

- 401: Unauthorized

## Examples

### cURL

```bash
curl -X GET 'https://demo.traccar.org/api/server/cache' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE'
```

### JavaScript

```javascript
const response = await fetch('https://demo.traccar.org/api/server/cache', {
  method: 'GET',
  headers: {
    'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://demo.traccar.org/api/server/cache',
    headers={
        'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
    },
)
print(response.text)
```


## Reboot the server process

`POST /server/reboot`

Authentication (security requirement alternatives):

```json
[
  {
    "BasicAuth": []
  },
  {
    "ApiKey": []
  }
]
```

- BasicAuth: http (basic)
- ApiKey: http (bearer)

Responses:

- 200: OK

- 400: Bad request

- 401: Unauthorized

## Examples

### cURL

```bash
curl -X POST 'https://demo.traccar.org/api/server/reboot' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE'
```

### JavaScript

```javascript
const response = await fetch('https://demo.traccar.org/api/server/reboot', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.post(
    'https://demo.traccar.org/api/server/reboot',
    headers={
        'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
    },
)
print(response.text)
```
