> ## 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.

# Add logs to dataset

Add existing logs from your log history to a dataset based on filter criteria.

**Note:** This endpoint also supports the legacy endpoint `POST /evaluations/datasets/{dataset_id}/logs/` for backward compatibility.

## Authentication

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

Request body:

* start\_time (string, required, ISO 8601)
* end\_time (string, required, ISO 8601)
* filters (object, optional; key name is `filters`)
* sampling\_percentage (integer, optional, default 100)

Request example:

```json theme={"system"}
{
  "start_time": "2025-07-01T00:00:00Z",
  "end_time": "2025-07-31T23:59:59Z",
  "filters": { "status_code": { "operator": "eq", "value": 200 } },
  "sampling_percentage": 40
}
```

Response (200 OK):

```json theme={"system"}
{ "message": "Logs are being added to dataset in the background" }
```

Errors:

* 400 Bad Request — invalid/missing `start_time`/`end_time`, or exceeds plan limit
* 404 Not Found — dataset not found or not in your organization
