Update a gateway
Updates the configuration of an AI Gateway, such as its caching, rate limiting, spend limits, logging, and authentication settings.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Accepted Permissions (at least one required)
Path Parameters
Body ParametersJSON
Require authentication for gateway access. New gateways must have authentication enabled. Once enabled, authentication cannot be disabled.
Requires customer-provided provider credentials and prevents fallback to Unified Billing.
Lets requests to a model use every provider that serves it. When off, a model uses only the providers it launched with, so a provider added later receives none of its traffic. A request that names providers (the cf-aig-allowed-providers header or routing.allowedProviders) can still use any of them. Model aliases (custom/) are not restricted.
Delay between retry attempts in milliseconds (0-60000)
Maximum number of retry attempts for failed requests (1-5)
Update a gateway
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/ai-gateway/gateways/$ID \
-X PUT \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-d '{
"cache_invalidate_on_update": true,
"cache_ttl": 0,
"collect_logs": true,
"rate_limiting_interval": 0,
"rate_limiting_limit": 0
}'{
"result": {
"id": "my-gateway",
"cache_invalidate_on_update": true,
"cache_ttl": 0,
"collect_logs": true,
"created_at": "2019-12-27T18:11:19.117Z",
"modified_at": "2019-12-27T18:11:19.117Z",
"rate_limiting_interval": 0,
"rate_limiting_limit": 0,
"authentication": true,
"byok_only": true,
"dlp": {
"action": "BLOCK",
"enabled": true,
"profiles": [
"string"
]
},
"fedramp_level": "fedramp-medium",
"fedramp_mode": "prefer",
"guardrails": {
"prompt": {
"P1": "FLAG",
"S1": "FLAG",
"S10": "FLAG",
"S11": "FLAG",
"S12": "FLAG",
"S13": "FLAG",
"S14": "FLAG",
"S2": "FLAG",
"S3": "FLAG",
"S4": "FLAG",
"S5": "FLAG",
"S6": "FLAG",
"S7": "FLAG",
"S8": "FLAG",
"S9": "FLAG"
},
"response": {
"P1": "FLAG",
"S1": "FLAG",
"S10": "FLAG",
"S11": "FLAG",
"S12": "FLAG",
"S13": "FLAG",
"S14": "FLAG",
"S2": "FLAG",
"S3": "FLAG",
"S4": "FLAG",
"S5": "FLAG",
"S6": "FLAG",
"S7": "FLAG",
"S8": "FLAG",
"S9": "FLAG"
}
},
"is_default": true,
"log_classification": true,
"log_management": 10000,
"log_management_strategy": "STOP_INSERTING",
"logpush": true,
"logpush_public_key": "xxxxxxxxxxxxxxxx",
"multiprovider_enabled": true,
"otel": [
{
"headers": {
"foo": "string"
},
"url": "https://example.com",
"authorization": "authorization",
"content_type": "json"
}
],
"rate_limiting_technique": "fixed",
"retry_backoff": "constant",
"retry_delay": 0,
"retry_max_attempts": 1,
"spend_limits": {
"enabled": true,
"rules": [
{
"limit": 1,
"limitType": "cost",
"window": 1,
"id": "x",
"enabled": true,
"metadata": {
"foo": {
"mode": "partition"
}
},
"model": {
"mode": "filter",
"values": [
"string"
]
},
"provider": {
"mode": "filter",
"values": [
"string"
]
},
"technique": "fixed"
}
]
},
"store_id": "store_id",
"stripe": {
"authorization": "authorization",
"usage_events": [
{
"payload": "payload"
}
]
},
"workers_ai_billing_mode": "postpaid",
"zdr": true
},
"success": true
}Returns Examples
{
"result": {
"id": "my-gateway",
"cache_invalidate_on_update": true,
"cache_ttl": 0,
"collect_logs": true,
"created_at": "2019-12-27T18:11:19.117Z",
"modified_at": "2019-12-27T18:11:19.117Z",
"rate_limiting_interval": 0,
"rate_limiting_limit": 0,
"authentication": true,
"byok_only": true,
"dlp": {
"action": "BLOCK",
"enabled": true,
"profiles": [
"string"
]
},
"fedramp_level": "fedramp-medium",
"fedramp_mode": "prefer",
"guardrails": {
"prompt": {
"P1": "FLAG",
"S1": "FLAG",
"S10": "FLAG",
"S11": "FLAG",
"S12": "FLAG",
"S13": "FLAG",
"S14": "FLAG",
"S2": "FLAG",
"S3": "FLAG",
"S4": "FLAG",
"S5": "FLAG",
"S6": "FLAG",
"S7": "FLAG",
"S8": "FLAG",
"S9": "FLAG"
},
"response": {
"P1": "FLAG",
"S1": "FLAG",
"S10": "FLAG",
"S11": "FLAG",
"S12": "FLAG",
"S13": "FLAG",
"S14": "FLAG",
"S2": "FLAG",
"S3": "FLAG",
"S4": "FLAG",
"S5": "FLAG",
"S6": "FLAG",
"S7": "FLAG",
"S8": "FLAG",
"S9": "FLAG"
}
},
"is_default": true,
"log_classification": true,
"log_management": 10000,
"log_management_strategy": "STOP_INSERTING",
"logpush": true,
"logpush_public_key": "xxxxxxxxxxxxxxxx",
"multiprovider_enabled": true,
"otel": [
{
"headers": {
"foo": "string"
},
"url": "https://example.com",
"authorization": "authorization",
"content_type": "json"
}
],
"rate_limiting_technique": "fixed",
"retry_backoff": "constant",
"retry_delay": 0,
"retry_max_attempts": 1,
"spend_limits": {
"enabled": true,
"rules": [
{
"limit": 1,
"limitType": "cost",
"window": 1,
"id": "x",
"enabled": true,
"metadata": {
"foo": {
"mode": "partition"
}
},
"model": {
"mode": "filter",
"values": [
"string"
]
},
"provider": {
"mode": "filter",
"values": [
"string"
]
},
"technique": "fixed"
}
]
},
"store_id": "store_id",
"stripe": {
"authorization": "authorization",
"usage_events": [
{
"payload": "payload"
}
]
},
"workers_ai_billing_mode": "postpaid",
"zdr": true
},
"success": true
}