Skip to main content
GET
https://api.keywordsai.co
/
api
/
request-logs
/
{unique_id}
Retrieve log
curl --request GET \
  --url https://api.keywordsai.co/api/request-logs/{unique_id} \
  --header 'Authorization: Bearer <token>'
The Get Log endpoint allows you to retrieve complete information about a specific log by its unique ID, including:
  • Full input/output content (input and output fields)
  • Type-specific fields extracted based on log_type
  • Credit and budget check results (limit_info)
  • Evaluation scores
  • Complete request/response metadata

Response fields

Each log in the response includes:

Universal fields (All Span Types)

  • input (string): JSON-serialized representation of the span’s input data
  • output (string): JSON-serialized representation of the span’s output data
  • log_type (string): Type of span ("chat", "embedding", "workflow", etc.)

Legacy compatibility

For log_type="chat", "completion", "text", or "response":
  • prompt_messages (array): Full input messages array (extracted from input)
  • completion_message (object): Full output message object (extracted from output)
For other span types (embedding, workflow, etc.), type-specific fields are extracted based on the log_type. See log types for details.
You should first get the log list, and based on the unique_id in the list, retrieve the specific log. Learn more about the log list endpoint.

Credit and Budget Information

Every log includes credit and budget check information in the keywordsai_params.limit_info field (available in the detail endpoint only).

What is limit_info?

When you make an LLM request, Keywords AI checks:
  1. Organization Credits: Your organization’s remaining credit balance
  2. Customer Budgets: Per-customer spending limits (if configured)
The limit_info object shows the results of these checks.

Structure

{
  "limit_info": {
    "is_allowed": true,
    "limits": [
      {
        "name": "org_credits",
        "current_value": 29.99,
        "new_value": 29.98,
        "limit_value": 0.0,
        "is_within_limit": true
      },
      {
        "name": "customer_budget",
        "current_value": 8.50,
        "new_value": 8.49,
        "limit_value": 10.0,
        "is_within_limit": true
      }
    ]
  }
}

Fields Explained

  • is_allowed: Whether the request was allowed to proceed (all limits passed)
  • limits: Array of individual limit check results
    • name: Type of limit - "org_credits" or "customer_budget"
    • current_value: Balance before this request (USD)
    • new_value: Balance after this request (USD)
    • limit_value: Minimum required balance (USD)
    • is_within_limit: Whether this specific check passed

Use Cases

  • Monitor spending: Track credit usage per request
  • Debug rejections: Understand why a request was blocked
  • Customer analytics: Analyze per-customer spending patterns
  • Budget alerts: Build custom alerts when approaching limits
{
  "is_allowed": true,
  "limits": [
    {
      "name": "org_credits",
      "current_value": 50.00,
      "new_value": 49.98,
      "limit_value": 0.0,
      "is_within_limit": true
    }
  ]
}
Request succeeded. Organization had 50incredits,nowhas50 in credits, now has 49.98 after this $0.02 request.
{
  "is_allowed": false,
  "limits": [
    {
      "name": "customer_budget",
      "current_value": 9.99,
      "new_value": 9.99,
      "limit_value": 10.0,
      "is_within_limit": false
    }
  ]
}
Request blocked. Customer has used 9.99oftheir9.99 of their 10 budget, not enough for this request.

Path parameters

unique_id
string
required
The unique ID of the log to get.
import requests

url = "https://api.keywordsai.co/api/request-logs/{{unique_id}}/"

payload = ""
headers = {
  'Authorization': 'Bearer {{your_api_key}}'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)