Any notes
Query parameters
Start time in ISO 8601 format. Defaults to 1 hour ago.
Example
Example
Page number for pagination.
Number of items per page. Maximum is 1000.
Field to sort by. Prefix with
- for descending order.Options
Options
id/-id: Sort by IDcost/-cost: Sort by costlatency/-latency: Sort by latencytimestamp/-timestamp: Sort by timestamp
Path parameters
The unique identifier of the resource to retrieve.
Request body
Core fields
Universal input field for the span. Structure depends on
log_type:- Chat: JSON string of messages array or messages array directly
- Embedding: Text string or array of strings
- Workflow/Task: Any JSON-serializable structure
Example for chat
Example for chat
Example for embedding
Example for embedding
Universal output field for the span. Structure depends on
log_type.Example for chat
Example for chat
Type of span being logged. Determines how
input and output are parsed.Supported types:"chat"- Chat completion requests (default)"embedding"- Embedding generation"workflow"or"agent"- Workflow execution"task"or"tool"- Task execution"function"- Function call"custom"- Custom span type
Default behavior
Default behavior
If not specified, defaults to
"chat". For complete specifications of each type, see log types.The model used for the inference. Optional but recommended for chat/completion/embedding types.
Example
Example
Telemetry
Cost of the inference in US dollars. If not provided, will be calculated automatically based on model pricing.
Total request latency in seconds.
Previously called
generation_time. Both field names are supported for backward compatibility.Time to first token (TTFT) in seconds. Useful for streaming responses and voice AI applications.
Metadata
Custom metadata properties for analytics and filtering.
Example
Example
An identifier for the customer that invoked this request. Helps with visualizing user activities.
Example
Example
A unique identifier for the conversation thread. Useful for multi-turn conversations.
Same functionality as
metadata, but indexed for faster querying.Example
Example
Workflow & tracing
Unique identifier for the trace. Used to link multiple spans together in distributed tracing.
Name of the workflow this span belongs to.
Name of this specific span/task within the workflow.
Body parameters
The filters to be applied to the logs.
If you want to filter your custom properties, add
metadata__ prefix. For example, to filter my_custom_property, use metadata__my_custom_property.Example
Example
Comparison operator for filtering. Default is
"" (equal).Supported operators
Supported operators
""(empty string): Equal"lt": Less than"lte": Less than or equal"gt": Greater than"gte": Greater than or equal"contains": Contains substring"icontains": Case-insensitive contains"startswith": Starts with"endswith": Ends with"in": Value in array"not": Not equal"isnull": Check if field is null
Advanced parameters
Tool calls and function calling
Controls which (if any) tool is called by the model. Can be
"none", "auto", or an object specifying a specific tool.Example
Example
Error handling and status
The HTTP status code for the request. Default is 200 (success).
Supported status codes
Supported status codes
All valid HTTP status codes are supported:
200, 201, 400, 401, 403, 404, 429, 500, 502, 503, 504, etc.Error message if the request failed. Default is empty string.
Any warnings that occurred during the request.
API controls
Control the behavior of the Keywords AI logging API.
Properties
Properties
If
false, the server immediately returns initialization status without waiting for log completion.Example
Example
Response fields
Each log in the response includes:Universal fields (All Span Types)
input(string): JSON-serialized representation of the span’s input dataoutput(string): JSON-serialized representation of the span’s output datalog_type(string): Type of span ("chat","embedding","workflow", etc.)
Legacy compatibility
Forlog_type="chat", "completion", "text", or "response":prompt_messages(array): Full input messages array (extracted frominput)completion_message(object): Full output message object (extracted fromoutput)
log_type. See log types for details.Identifiers
id(string): Unique identifier for the logorganization_id(string): Organization’s unique IDcustomer_identifier(string): Customer identifierthread_identifier(string): Thread identifier
Telemetry
cost(float): Cost in USDlatency(float): Request latency in secondsprompt_tokens(integer): Input tokenscompletion_tokens(integer): Output tokenstotal_request_tokens(integer): Total tokenstime_to_first_token(float): TTFT in secondstokens_per_second(float): Generation speed
Status
status(string): Request status ("success","error")status_code(integer): HTTP status codeerror_message(string): Error message if failed