> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keywordsai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# List logs with filters

## Authentication

* API key: `Authorization: Bearer <API key>`

<Note>
  For complete filter operators and examples, see the [Filters API Reference](/api-endpoints/reference/filters_api_reference).
</Note>

Request body:

```json theme={"system"}
{
  "filters": {
    "model": "gpt-4",
    "metadata.user_id": "user123",
    "created_at": {
      "gte": "2024-01-01T00:00:00Z",
      "lte": "2024-01-31T23:59:59Z"
    }
  },
  "page": 1,
  "page_size": 50
}
```

Request example:

```bash theme={"system"}
curl -X POST "https://api.keywordsai.co/api/datasets/{dataset_id}/logs/list/" \
  -H "Authorization: Bearer <API key>" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": {
      "model": "gpt-4",
      "metadata.user_id": "user123",
      "created_at": {
        "gte": "2024-01-01T00:00:00Z",
        "lte": "2024-01-31T23:59:59Z"
      }
    },
    "page": 1,
    "page_size": 50
  }'
```

Response (200 OK):

```json theme={"system"}
{
  "logs": [
    {
      "id": "log_12345",
      "dataset_id": "dataset_67890",
      "messages": [
        {
          "role": "user",
          "content": "What is the capital of France?"
        },
        {
          "role": "assistant",
          "content": "The capital of France is Paris."
        }
      ],
      "model": "gpt-4",
      "parameters": {
        "temperature": 0.7,
        "max_tokens": 150
      },
      "metadata": {
        "user_id": "user123",
        "session_id": "session456"
      },
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:00Z"
    }
  ],
  "total": 1,
  "page": 1,
  "page_size": 50,
  "total_pages": 1
}
```

Response Fields:

* `logs`: Array of log objects matching the filters
* `total`: Total number of logs matching the filters
* `page`: Current page number
* `page_size`: Number of logs per page
* `total_pages`: Total number of pages

Errors:

* 401 Unauthorized — Missing/invalid authentication
* 404 Not Found — Dataset not found or not in your organization

Notes:

* Supports complex filtering with nested metadata fields
* Date filters support `gte` (greater than or equal) and `lte` (less than or equal)
