# Audit

Audit log access

## Fetch audit log Actions

`GET /audit`

Admin only. Returns Actions performed in the given time window.

Authentication (security requirement alternatives):

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

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

Parameters:

- `from` (query, string, date-time, required) - in ISO 8601 format. eg. `1963-11-22T18:30:00Z`
  Type: string, date-time

- `to` (query, string, date-time, required) - in ISO 8601 format. eg. `1963-11-22T18:30:00Z`
  Type: string, date-time

Responses:

- 200: OK

Content type: application/json

Type: Array<Action>

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

- 401: Unauthorized

## Examples

### cURL

```bash
curl -X GET 'https://demo.traccar.org/api/audit?from=2024-01-15T09%3A30%3A00Z&to=2024-01-15T09%3A30%3A00Z' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE'
```

### JavaScript

```javascript
const response = await fetch('https://demo.traccar.org/api/audit?from=2024-01-15T09%3A30%3A00Z&to=2024-01-15T09%3A30%3A00Z', {
  method: 'GET',
  headers: {
    'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'https://demo.traccar.org/api/audit?from=2024-01-15T09%3A30%3A00Z&to=2024-01-15T09%3A30%3A00Z',
    headers={
        'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
    },
)
print(response.text)
```
