Skip to main content
GET
/
api
/
v2
/
experiments
/
{experiment_id}
/
logs
/
{
  "filters": [
    {
      "field": "status",
      "operator": "=",
      "value": "completed"
    },
    {
      "field": "comparison_key",
      "operator": "in",
      "value": ["key1", "key2"]
    }
  ]
}
{
  "message": "Exporting experiment logs. Check your email for the download link."
}
Exports experiment logs to CSV/Excel format. The export is processed asynchronously and a download link is sent to your email.

Authentication

  • API key: Authorization: Bearer <API key>

Path Parameters

experiment_id
string
required
The ID of the experiment to export logs from.

Query Parameters

export
string
required
Set to 1 or true to trigger export.
page
integer
Page number (default: 1).
page_size
integer
Number of results per page (default: 100).
sort_by
string
Sort field (e.g., “-cost”, “-start_time”, “name”).
start_time
string
Filter start time (ISO format).
end_time
string
Filter end time (ISO format).

POST Request Body (Optional)

For advanced filtering, you can send a POST request with filters in the body:
{
  "filters": [
    {
      "field": "status",
      "operator": "=",
      "value": "completed"
    },
    {
      "field": "comparison_key",
      "operator": "in",
      "value": ["key1", "key2"]
    }
  ]
}

Examples

import requests

experiment_id = "experiment_id_123"
url = f"https://api.keywordsai.co/api/v2/experiments/{experiment_id}/logs/"
headers = {
    "Authorization": "Bearer YOUR_API_KEY"
}

# GET request with export parameter
params = {
    "export": "1",
    "start_time": "2025-01-01T00:00:00Z",
    "end_time": "2025-01-31T23:59:59Z"
}
response = requests.get(url, headers=headers, params=params)
print(response.json())

Response

{
  "message": "Exporting experiment logs. Check your email for the download link."
}
Export Features:
  • Supports all filtering options (query params and POST body filters)
  • Includes all trace data: input, output, metrics, metadata
  • Async processing for large datasets
  • Email notification with download link
  • CSV and Excel format options
Notes:
  • Export is processed asynchronously
  • You will receive an email with the download link when the export is ready
  • Large datasets may take several minutes to process
  • All standard filtering parameters are supported