Appearance
Search & Export
Search log entries with full-text queries and filters, or export results as CSV or JSON files.
Base URL: https://app.krafter.dev/api/v1
Search Logs
Search and filter log entries across a project.
GET /logs/searchRequired scope: logs:read
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | The project to search in. |
q | string | No | Full-text search query against the message field. |
level | string | No | Filter by log level: debug, info, warn, error, or fatal. |
stream | string | No | Filter by stream name. |
from | string | No | Start of time range (ISO 8601). Defaults to now - 1 hour when omitted. |
to | string | No | End of time range (ISO 8601). Defaults to now when omitted. |
limit | integer | No | Maximum number of entries to return. Default 100; capped at 1000 — values above 1000 are silently clamped. |
Example Request
bash
curl "https://app.krafter.dev/api/v1/logs/search?project_id=a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d&level=error&from=2025-01-15T00:00:00Z&to=2025-01-16T00:00:00Z&limit=50" \
-H "Authorization: Bearer kr_live_abc123def456"Example Response
json
{
"data": [
{
"timestamp": "2025-01-15T14:23:01Z",
"level": "error",
"stream": "backend",
"service": "api-server",
"message": "Failed to connect to database",
"trace_id": "tr_abc123",
"span_id": "sp_001",
"metadata": {
"host": "db-primary.internal",
"port": 5432,
"retry_count": 3
}
},
{
"timestamp": "2025-01-15T14:23:05Z",
"level": "error",
"stream": "backend",
"service": "api-server",
"message": "Connection pool exhausted",
"trace_id": "tr_def456",
"span_id": "sp_002",
"metadata": {
"pool_size": 20,
"active_connections": 20
}
}
]
}Combining Filters
You can combine multiple filters. All filters are AND-ed together:
bash
# Errors in the "auth" stream from the last hour
curl "https://app.krafter.dev/api/v1/logs/search?project_id=a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d&level=error&stream=auth&from=2025-01-15T13:00:00Z" \
-H "Authorization: Bearer kr_live_abc123def456"bash
# Full-text search for "timeout" across all levels
curl "https://app.krafter.dev/api/v1/logs/search?project_id=a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d&q=timeout" \
-H "Authorization: Bearer kr_live_abc123def456"Export Logs
Export log entries as a downloadable CSV or JSON file. Supports the same filters as the search endpoint. Maximum 10,000 entries per export.
GET /logs/exportRequired scope: logs:read
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | Yes | The project to export from. |
format | string | Yes | Export format: csv or json. |
q | string | No | Full-text search query against the message field. |
level | string | No | Filter by log level: debug, info, warn, error, or fatal. |
stream | string | No | Filter by stream name. |
from | string | No | Start of time range (ISO 8601). Defaults to now - 1 hour when omitted. |
to | string | No | End of time range (ISO 8601). Defaults to now when omitted. |
limit | integer | No | Currently ignored — every export pulls up to 10,000 entries regardless of the value supplied. Use a tighter from/to window to control the result size. |
Example Request -- CSV
bash
curl "https://app.krafter.dev/api/v1/logs/export?project_id=a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d&format=csv&level=error&from=2025-01-15T00:00:00Z" \
-H "Authorization: Bearer kr_live_abc123def456" \
-o errors.csvExample Request -- JSON
bash
curl "https://app.krafter.dev/api/v1/logs/export?project_id=a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d&format=json&stream=backend&limit=5000" \
-H "Authorization: Bearer kr_live_abc123def456" \
-o backend-logs.jsonTIP
Use the from and to parameters to narrow the time range and keep export sizes manageable. The 10,000 entry limit applies after all filters.