Skip to main content
POST
/
api
/
traces
/
ingest
/
[
  {
    "id": "log_id_123",
    "trace_unique_id": "trace_abc123",
    "span_unique_id": "span_xyz789",
    "span_name": "workflow_name",
    "span_parent_id": null,
    "span_workflow_name": "my_workflow",
    "input": {},
    "output": {},
    "timestamp": "2024-01-15T10:30:00Z",
    "start_time": "2024-01-15T10:29:50Z",
    "model": "gpt-4",
    "status": "success"
  }
]
{
  "success": true,
  "ingested_count": 1
}
Ingest trace data as logs. This endpoint allows you to convert trace data into log format for storage and analysis.

Authentication

All endpoints require API key authentication:
Authorization: Bearer YOUR_API_KEY

Request Body

The request body should be an array of log objects. Each log object should contain trace and span information.
[
  {
    "id": "log_id_123",
    "trace_unique_id": "trace_abc123",
    "span_unique_id": "span_xyz789",
    "span_name": "workflow_name",
    "span_parent_id": null,
    "span_workflow_name": "my_workflow",
    "input": {},
    "output": {},
    "timestamp": "2024-01-15T10:30:00Z",
    "start_time": "2024-01-15T10:29:50Z",
    "model": "gpt-4",
    "status": "success"
  }
]

Examples

import requests

url = "https://api.keywordsai.co/api/traces/ingest/"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

logs = [
    {
        "id": "log_id_123",
        "trace_unique_id": "trace_abc123",
        "span_unique_id": "span_xyz789",
        "span_name": "workflow_name",
        "input": {},
        "output": {},
        "timestamp": "2024-01-15T10:30:00Z"
    }
]

response = requests.post(url, headers=headers, json=logs)
print(response.json())

Response

{
  "success": true,
  "ingested_count": 1
}