Skip to main content
PATCH
https://api.keywordsai.co
/
api
/
request-logs
/
batch-update
import requests

url = "https://api.keywordsai.co/api/request-logs/batch-update/"
api_key = "YOUR_KEY" # Replace with your actual Keywords AI API key
data = {
    "logs": [
        {   "unique_id": "xxxxxx",
            "metadata": {
                "metadata_key": "updated_value"
            },
            "note": "updated note"
        }
        # other logs to update
    ]
}
headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}

response = requests.patch(url, headers=headers, json=data)
print(response.json())
You may want to update logs to add more information or correct the existing information. In order to protect the integrity of the logs, you can only update specific fields.

Updatable fields

The following fields can be updated:
  • metadata - Custom metadata properties
  • note - Log notes
  • positive_feedback - User feedback indicator
  • custom_identifier - Custom identifier

Core log data is immutable

Fields like input, output, log_type, model, usage, cost, latency, and other telemetry fields cannot be modified to maintain data integrity.For log_type specifications, see log types.

Body parameters

unique_id
string
You can get a log’s unique_id from the Logs list endpoint. Then pass this unique_id to update the log.
{
    "unique_id": "xxxxxx"
}
metadata
dict
You can update the log’s metadata with this parameter.
{
  "metadata": {
    "metadata_key": "updated_value"
  }
}
note
string
You can also update a log’s note
{
    "note": "updated note"
}
positive_feedback
boolean
Update the log’s positive_feedback field.
{
    "positive_feedback": true
}
import requests

url = "https://api.keywordsai.co/api/request-logs/batch-update/"
api_key = "YOUR_KEY" # Replace with your actual Keywords AI API key
data = {
    "logs": [
        {   "unique_id": "xxxxxx",
            "metadata": {
                "metadata_key": "updated_value"
            },
            "note": "updated note"
        }
        # other logs to update
    ]
}
headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}

response = requests.patch(url, headers=headers, json=data)
print(response.json())