# List logs

> Source: https://truto.one/docs/api-reference/admin/logs/list/

`GET /log`

Resource: **Logs**

## Query parameters

- **`log_type`** _(string, required)_
  The type of logs you want to filter by.
  Allowed: `unified_proxy_api`, `rapid_bridge`, `webhook`, `mcp`
- **`created_at`** _(object)_
  The date-time range to filter the logs by.
- **`limit`** _(number)_
  The number of logs to return. Default is 100.
- **`next_cursor`** _(string)_
  The cursor to get the next set of logs.
- **`log_type_filter`** _(object)_
  The filters to apply to fetch only specific logs.

## Response body

- **`result`** _(array<object>)_
  The list of logs.
  - **`_id`** _(string)_
    Unique identifier for the log.
  - **`timestamp`** _(string)_
    The timestamp when the log was created.
  - **`metadata`** _(object)_
    The metadata for the log.
    - **`duration`** _(number)_
      The duration of the request in milliseconds from the time the request was received to the time the response was sent from Truto.
    - **`fetch_duration`** _(number)_
      The time it took to get the data from the remote API in milliseconds.
    - **`message`** _(string)_
      The message for the log.
    - **`method`** _(string)_
      The Truto method that was called.
    - **`resource`** _(string)_
      The Truto resource that was called.
    - **`request_type`** _(string)_
      The type of request for which the logs are generated.
      Allowed: `proxy`, `unified`
    - **`environment_id`** _(string)_
      The ID of the environment for which the logs are generated.
- **`next_cursor`** _(string)_
  The cursor to get the next set of logs

## Code examples

### curl

```bash
curl -X GET 'https://api.truto.one/log' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const response = await fetch('https://api.truto.one/log', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/log"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```

### Truto TS SDK

```typescript
import Truto from '@truto/truto-ts-sdk';

const truto = new Truto({
  token: '<your_api_token>',
});

for await (const item of truto.log.list()) {
  console.log(item);
}
```

### Truto Python SDK

```python
import asyncio
from truto_python_sdk import TrutoApi

truto_api = TrutoApi(token="<your_api_token>")

async def main():
    async for item in truto_api.logs.list():
        print(item)

asyncio.run(main())
```
