List spans with filters
## Authentication
- API key: `Authorization: Bearer `
<Note>
For complete filter operators and examples, see the [Filters API Reference](/api-reference/reference/filters-api-reference).
</Note>
Request body:
```json
{
"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
curl -X POST "https://api.respan.ai/api/datasets/{dataset_id}/logs/list/" \
-H "Authorization: Bearer " \
-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):
The response uses the same paginated shape as the GET endpoint: `count`, `next`, `previous`, `results`, and `filters_data`.
```json
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"unique_id": "log_12345",
"dataset_id": "dataset_67890",
"input": "...",
"output": "...",
"metadata": { "user_id": "user123", "session_id": "session456" },
"model": "gpt-4",
"timestamp": "2024-01-15T10:30:00Z",
"annotation_status": "pending",
"scores": []
}
],
"filters_data": {
"model": {...},
"status_code": {...}
}
}
```
Response Fields:
- `count` (integer): Total number of spans matching the filters
- `next` (string|null): URL for the next page of results
- `previous` (string|null): URL for the previous page of results
- `results` (array): Array of span objects matching the filters
- `filters_data` (object): Available filter options for building filter UIs
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)
Authentication
AuthorizationBearer
API key authentication. Get your API key from https://platform.respan.ai/platform/api-keys
Path parameters
dataset_id
Dataset Id
Request
This endpoint expects an object.
Response
Successful response for List spans with filters
filters
page
page_size
Errors
401
Unauthorized Error