# Notifications

User notifications management

## Fetch a list of Notifications

`GET /notifications`

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

Authentication (security requirement alternatives):

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

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

Parameters:

- `all` (query, boolean, optional) - Can only be used by admins or managers to fetch all entities
  Type: boolean

- `userId` (query, integer, optional) - Standard users can use this only with their own _userId_
  Type: integer

- `deviceId` (query, integer, optional) - Standard users can use this only with _deviceId_s, they have access to
  Type: integer

- `groupId` (query, integer, optional) - Standard users can use this only with _groupId_s, they have access to
  Type: integer

- `refresh` (query, boolean, optional)
  Type: boolean

- `limit` (query, integer, optional) - Limit the number of returned results
  Type: integer

- `offset` (query, integer, optional) - Offset for pagination
  Type: integer

- `keyword` (query, string, optional) - Search keyword filter
  Type: string

Responses:

- 200: OK

Content type: application/json

Type: Array<Notification>

Items:
  Reference: [Notification](https://sourcey-traccar.pages.dev/api-reference/models/notification/index.md); Type: Notification

- 401: Unauthorized

## Examples

### cURL

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

### JavaScript

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

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

### Python

```python
import requests

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


## Create a Notification

`POST /notifications`

Authentication (security requirement alternatives):

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

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

Request body: application/json (required)

Type: Notification

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

- `id` (optional)
  Type: integer, int64
  
  Unique identifier for the notification

- `type` (optional)
  Type: string
  
  Notification category such as geofenceEnter or ignitionOn

- `description` (optional)
  Type: string; nullable
  
  User-defined text describing the notification

- `always` (optional)
  Type: boolean
  
  Whether the notification triggers regardless of schedule

- `commandId` (optional)
  Type: integer, int64
  
  Identifier of the command to send when the notification triggers

- `notificators` (optional)
  Type: string
  
  Comma-separated delivery channels (for example, web, mail)

- `calendarId` (optional)
  Type: integer, int64
  
  Calendar identifier restricting when the notification is active

- `attributes` (optional)
  Type: object
  
  Additional custom attributes used by notificators or templates

Responses:

- 200: OK

Content type: application/json

Type: Notification

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

- `id` (optional)
  Type: integer, int64
  
  Unique identifier for the notification

- `type` (optional)
  Type: string
  
  Notification category such as geofenceEnter or ignitionOn

- `description` (optional)
  Type: string; nullable
  
  User-defined text describing the notification

- `always` (optional)
  Type: boolean
  
  Whether the notification triggers regardless of schedule

- `commandId` (optional)
  Type: integer, int64
  
  Identifier of the command to send when the notification triggers

- `notificators` (optional)
  Type: string
  
  Comma-separated delivery channels (for example, web, mail)

- `calendarId` (optional)
  Type: integer, int64
  
  Calendar identifier restricting when the notification is active

- `attributes` (optional)
  Type: object
  
  Additional custom attributes used by notificators or templates

- 400: Bad request

- 401: Unauthorized

## Examples

### cURL

```bash
curl -X POST 'https://demo.traccar.org/api/notifications' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "id": 0,
  "type": "string",
  "description": "string",
  "always": true,
  "commandId": 0,
  "notificators": "string",
  "calendarId": 0,
  "attributes": {}
}'
```

### JavaScript

```javascript
const body = `{
  "id": 0,
  "type": "string",
  "description": "string",
  "always": true,
  "commandId": 0,
  "notificators": "string",
  "calendarId": 0,
  "attributes": {}
}`;

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

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

### Python

```python
import requests

body = '''{
  "id": 0,
  "type": "string",
  "description": "string",
  "always": true,
  "commandId": 0,
  "notificators": "string",
  "calendarId": 0,
  "attributes": {}
}'''

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


## Fetch a Notification

`GET /notifications/{id}`

Authentication (security requirement alternatives):

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

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

Parameters:

- `id` (path, integer, required)
  Type: integer

Responses:

- 200: OK

Content type: application/json

Type: Notification

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

- `id` (optional)
  Type: integer, int64
  
  Unique identifier for the notification

- `type` (optional)
  Type: string
  
  Notification category such as geofenceEnter or ignitionOn

- `description` (optional)
  Type: string; nullable
  
  User-defined text describing the notification

- `always` (optional)
  Type: boolean
  
  Whether the notification triggers regardless of schedule

- `commandId` (optional)
  Type: integer, int64
  
  Identifier of the command to send when the notification triggers

- `notificators` (optional)
  Type: string
  
  Comma-separated delivery channels (for example, web, mail)

- `calendarId` (optional)
  Type: integer, int64
  
  Calendar identifier restricting when the notification is active

- `attributes` (optional)
  Type: object
  
  Additional custom attributes used by notificators or templates

- 401: Unauthorized

- 404: Not found

## Examples

### cURL

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

### JavaScript

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

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

### Python

```python
import requests

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


## Update a Notification

`PUT /notifications/{id}`

Authentication (security requirement alternatives):

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

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

Parameters:

- `id` (path, integer, required)
  Type: integer

Request body: application/json (required)

Type: Notification

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

- `id` (optional)
  Type: integer, int64
  
  Unique identifier for the notification

- `type` (optional)
  Type: string
  
  Notification category such as geofenceEnter or ignitionOn

- `description` (optional)
  Type: string; nullable
  
  User-defined text describing the notification

- `always` (optional)
  Type: boolean
  
  Whether the notification triggers regardless of schedule

- `commandId` (optional)
  Type: integer, int64
  
  Identifier of the command to send when the notification triggers

- `notificators` (optional)
  Type: string
  
  Comma-separated delivery channels (for example, web, mail)

- `calendarId` (optional)
  Type: integer, int64
  
  Calendar identifier restricting when the notification is active

- `attributes` (optional)
  Type: object
  
  Additional custom attributes used by notificators or templates

Responses:

- 200: OK

Content type: application/json

Type: Notification

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

- `id` (optional)
  Type: integer, int64
  
  Unique identifier for the notification

- `type` (optional)
  Type: string
  
  Notification category such as geofenceEnter or ignitionOn

- `description` (optional)
  Type: string; nullable
  
  User-defined text describing the notification

- `always` (optional)
  Type: boolean
  
  Whether the notification triggers regardless of schedule

- `commandId` (optional)
  Type: integer, int64
  
  Identifier of the command to send when the notification triggers

- `notificators` (optional)
  Type: string
  
  Comma-separated delivery channels (for example, web, mail)

- `calendarId` (optional)
  Type: integer, int64
  
  Calendar identifier restricting when the notification is active

- `attributes` (optional)
  Type: object
  
  Additional custom attributes used by notificators or templates

- 400: Bad request

- 401: Unauthorized

## Examples

### cURL

```bash
curl -X PUT 'https://demo.traccar.org/api/notifications/0' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "id": 0,
  "type": "string",
  "description": "string",
  "always": true,
  "commandId": 0,
  "notificators": "string",
  "calendarId": 0,
  "attributes": {}
}'
```

### JavaScript

```javascript
const body = `{
  "id": 0,
  "type": "string",
  "description": "string",
  "always": true,
  "commandId": 0,
  "notificators": "string",
  "calendarId": 0,
  "attributes": {}
}`;

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

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

### Python

```python
import requests

body = '''{
  "id": 0,
  "type": "string",
  "description": "string",
  "always": true,
  "commandId": 0,
  "notificators": "string",
  "calendarId": 0,
  "attributes": {}
}'''

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


## Delete a Notification

`DELETE /notifications/{id}`

Authentication (security requirement alternatives):

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

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

Parameters:

- `id` (path, integer, required)
  Type: integer

Responses:

- 204: No Content

- 401: Unauthorized

## Examples

### cURL

```bash
curl -X DELETE 'https://demo.traccar.org/api/notifications/0' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE'
```

### JavaScript

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

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

### Python

```python
import requests

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


## Fetch a list of available Notification types

`GET /notifications/types`

Authentication (security requirement alternatives):

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

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

Responses:

- 200: OK

Content type: application/json

Type: Array<NotificationType>

Items:
  Reference: [NotificationType](https://sourcey-traccar.pages.dev/api-reference/models/notificationtype/index.md); Type: NotificationType

- 401: Unauthorized

## Examples

### cURL

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

### JavaScript

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

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

### Python

```python
import requests

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


## Fetch a list of available Notificators

`GET /notifications/notificators`

Authentication (security requirement alternatives):

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

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

Parameters:

- `announcement` (query, boolean, optional) - When `true`, exclude notificators that cannot deliver announcements
  Type: boolean

Responses:

- 200: OK

Content type: application/json

Type: Array<NotificationType>

Items:
  Reference: [NotificationType](https://sourcey-traccar.pages.dev/api-reference/models/notificationtype/index.md); Type: NotificationType

- 401: Unauthorized

## Examples

### cURL

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

### JavaScript

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

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

### Python

```python
import requests

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


## Send test notification to current user via Email and SMS

`POST /notifications/test`

Authentication (security requirement alternatives):

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

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

Responses:

- 204: Successful sending

- 400: Could happen if sending has failed

## Examples

### cURL

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

### JavaScript

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

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

### Python

```python
import requests

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


## Send a test notification to the current User using the specified notificator

`POST /notifications/test/{notificator}`

Authentication (security requirement alternatives):

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

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

Parameters:

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

Responses:

- 204: Successful sending

- 400: Could happen if sending has failed

## Examples

### cURL

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

### JavaScript

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

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

### Python

```python
import requests

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


## Send a custom notification to selected users using the specified notificator

`POST /notifications/send/{notificator}`

Authentication (security requirement alternatives):

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

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

Parameters:

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

- `userId` (query, Array<integer>, optional) - Optional list of user ids to send the notification to; if omitted, sends to all permitted users
  Type: Array<integer>
  
  Items:
    Type: integer, int64

Request body: application/json (required)

Type: NotificationMessage

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

- `subject` (optional)
  Type: string
  
  Subject or title of the notification

- `digest` (optional)
  Type: string
  
  Short summary shown in compact contexts; defaults to the body when omitted

- `body` (required)
  Type: string
  
  Full notification text

- `priority` (optional)
  Type: boolean
  
  Whether the message should be treated as high priority

Responses:

- 204: Successful sending

- 400: Could happen if sending has failed

## Examples

### cURL

```bash
curl -X POST 'https://demo.traccar.org/api/notifications/send/string' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "subject": "string",
  "digest": "string",
  "body": "string",
  "priority": true
}'
```

### JavaScript

```javascript
const body = `{
  "subject": "string",
  "digest": "string",
  "body": "string",
  "priority": true
}`;

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

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

### Python

```python
import requests

body = '''{
  "subject": "string",
  "digest": "string",
  "body": "string",
  "priority": true
}'''

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