Skip to content
Start here

Delete Gateway Logs

ai_gateway.logs.delete(strgateway_id, LogDeleteParams**kwargs) -> LogDeleteResponse
DELETE/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs

Delete Gateway Logs

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
AI Gateway Write
ParametersExpand Collapse
account_id: str
gateway_id: str

gateway id

maxLength64
minLength1
filters: Optional[Iterable[Filter]]
key: Literal["id", "created_at", "request_content_type", 20 more]
One of the following:
"id"
"created_at"
"request_content_type"
"response_content_type"
"request_type"
"success"
"cached"
"provider"
"model"
"model_type"
"cost"
"tokens"
"tokens_in"
"tokens_out"
"duration"
"feedback"
"event_id"
"metadata.key"
"metadata.value"
"authentication"
"wholesale"
"compatibilityMode"
"dlp_action"
operator: Literal["eq", "neq", "contains", 2 more]
One of the following:
"eq"
"neq"
"contains"
"lt"
"gt"
value: SequenceNotStr[Union[Optional[str], float, bool]]
One of the following:
Optional[str]
float
bool
limit: Optional[int]
maximum10000
minimum1
order_by: Optional[Literal["created_at", "provider", "model", 8 more]]
One of the following:
"created_at"
"provider"
"model"
"model_type"
"success"
"cached"
"cost"
"tokens_in"
"tokens_out"
"duration"
"feedback"
order_by_direction: Optional[Literal["asc", "desc"]]
One of the following:
"asc"
"desc"
ReturnsExpand Collapse
class LogDeleteResponse:
success: bool

Delete Gateway Logs

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
log = client.ai_gateway.logs.delete(
    gateway_id="my-gateway",
    account_id="0d37909e38d3e99c29fa2cd343ac421a",
)
print(log.success)
{
  "success": true
}
Returns Examples
{
  "success": true
}