Skip to main content
POST
/
api
/
datasets
/
{dataset_id}
/
logs
/
list
/
List logs with filters
curl --request POST \
  --url https://api.keywordsai.co/api/datasets/{dataset_id}/logs/list/ \
  --header 'Authorization: Bearer <token>'

Authentication

  • API key: Authorization: Bearer <API key>
Request body:
{
  "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:
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):
{
  "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)
I