Log list
The Logs List endpoint allows you to get the past logs with specified filters.
GET params
You can add these params to the URL params. For example:
"https://api.keywordsai.co/api/request-logs/?page=1&sort_by=-id&is_test=false&all_envs=false&fetch_filters=false&page_size=1"
The field to sort by. Default is -id
(same as sort by -timestamp
, but with better performance).
-
is for descending order, if not provided, it will be in ascending order.
Whether to include logs from all environments. is_test
parameter will override this parameter.
Options: true
, false
.
Whether the log is a test call or not. This parameter will override the all_envs
parameter.
Options: true
, false
.
Whether to retrieve the available filtering options. Enabling this could slow down the response time.
Options: true
, false
.
The number of logs to return per page. Maximum is 1000.
The page number of the current logs.
POST params
You can add these params to the body:
url = "https://api.keywordsai.co/api/request-logs/"
headers = {
"Authorization": f"Api-Key {YOUR_KEYWORDS_AI_API_KEY}",
}
data = {
"filters": {
"cost": {
"operator": "gt",
"value": [0.01]
},
}
}
response = requests.post(url, headers=headers, json=data)
The filters be applied to the logs. For available options in the response body, use the fetch_filters
parameter.
Default is "" (equal).