Skip to content
Start here

List Gateways

client.AIGateway.List(ctx, params) (*V4PagePaginationArray[AIGatewayListResponse], error)
GET/accounts/{account_id}/ai-gateway/gateways

Lists all AI Gateway evaluator types configured for the account.

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 WriteAI Gateway Read
ParametersExpand Collapse
params AIGatewayListParams
AccountID param.Field[string]

Path param

Page param.Field[int64]optional

Query param

minimum1
PerPage param.Field[int64]optional

Query param

maximum100
minimum1
ReturnsExpand Collapse
type AIGatewayListResponse struct{…}
ID string

gateway id

maxLength64
minLength1
CacheInvalidateOnUpdate bool
CacheTTL int64
minimum0
CollectLogs bool
CreatedAt Time
formatdate-time
ModifiedAt Time
formatdate-time
RateLimitingInterval int64
minimum0
RateLimitingLimit int64
minimum0
Authentication booloptional
DLP AIGatewayListResponseDLPoptional
One of the following:
type AIGatewayListResponseDLPObject struct{…}
Action AIGatewayListResponseDLPObjectAction
One of the following:
const AIGatewayListResponseDLPObjectActionBlock AIGatewayListResponseDLPObjectAction = "BLOCK"
const AIGatewayListResponseDLPObjectActionFlag AIGatewayListResponseDLPObjectAction = "FLAG"
Enabled bool
Profiles []string
type AIGatewayListResponseDLPObject struct{…}
Enabled bool
Policies []AIGatewayListResponseDLPObjectPolicy
ID string
Action AIGatewayListResponseDLPObjectPoliciesAction
One of the following:
const AIGatewayListResponseDLPObjectPoliciesActionFlag AIGatewayListResponseDLPObjectPoliciesAction = "FLAG"
const AIGatewayListResponseDLPObjectPoliciesActionBlock AIGatewayListResponseDLPObjectPoliciesAction = "BLOCK"
Check []AIGatewayListResponseDLPObjectPoliciesCheck
One of the following:
const AIGatewayListResponseDLPObjectPoliciesCheckRequest AIGatewayListResponseDLPObjectPoliciesCheck = "REQUEST"
const AIGatewayListResponseDLPObjectPoliciesCheckResponse AIGatewayListResponseDLPObjectPoliciesCheck = "RESPONSE"
Enabled bool
Profiles []string
IsDefault booloptional
LogManagement int64optional
maximum10000000
minimum10000
LogManagementStrategy AIGatewayListResponseLogManagementStrategyoptional
One of the following:
const AIGatewayListResponseLogManagementStrategyStopInserting AIGatewayListResponseLogManagementStrategy = "STOP_INSERTING"
const AIGatewayListResponseLogManagementStrategyDeleteOldest AIGatewayListResponseLogManagementStrategy = "DELETE_OLDEST"
Logpush booloptional
LogpushPublicKey stringoptional
maxLength1024
minLength16
Otel []AIGatewayListResponseOteloptional
Authorization string
Headers map[string, string]
URL string
ContentType AIGatewayListResponseOtelContentTypeoptional
One of the following:
const AIGatewayListResponseOtelContentTypeJson AIGatewayListResponseOtelContentType = "json"
const AIGatewayListResponseOtelContentTypeProtobuf AIGatewayListResponseOtelContentType = "protobuf"
RateLimitingTechnique AIGatewayListResponseRateLimitingTechniqueoptional
One of the following:
const AIGatewayListResponseRateLimitingTechniqueFixed AIGatewayListResponseRateLimitingTechnique = "fixed"
const AIGatewayListResponseRateLimitingTechniqueSliding AIGatewayListResponseRateLimitingTechnique = "sliding"
RetryBackoff AIGatewayListResponseRetryBackoffoptional

Backoff strategy for retry delays

One of the following:
const AIGatewayListResponseRetryBackoffConstant AIGatewayListResponseRetryBackoff = "constant"
const AIGatewayListResponseRetryBackoffLinear AIGatewayListResponseRetryBackoff = "linear"
const AIGatewayListResponseRetryBackoffExponential AIGatewayListResponseRetryBackoff = "exponential"
RetryDelay int64optional

Delay between retry attempts in milliseconds (0-5000)

maximum5000
minimum0
RetryMaxAttempts int64optional

Maximum number of retry attempts for failed requests (1-5)

maximum5
minimum1
StoreID stringoptional
Stripe AIGatewayListResponseStripeoptional
Authorization string
UsageEvents []AIGatewayListResponseStripeUsageEvent
Payload string
WorkersAIBillingMode AIGatewayListResponseWorkersAIBillingModeoptional

Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported.

Zdr booloptional

List Gateways

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/ai_gateway"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.AIGateway.List(context.TODO(), ai_gateway.AIGatewayListParams{
    AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "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,
      "dlp": {
        "action": "BLOCK",
        "enabled": true,
        "profiles": [
          "string"
        ]
      },
      "is_default": true,
      "log_management": 10000,
      "log_management_strategy": "STOP_INSERTING",
      "logpush": true,
      "logpush_public_key": "xxxxxxxxxxxxxxxx",
      "otel": [
        {
          "authorization": "authorization",
          "headers": {
            "foo": "string"
          },
          "url": "url",
          "content_type": "json"
        }
      ],
      "rate_limiting_technique": "fixed",
      "retry_backoff": "constant",
      "retry_delay": 0,
      "retry_max_attempts": 1,
      "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,
      "dlp": {
        "action": "BLOCK",
        "enabled": true,
        "profiles": [
          "string"
        ]
      },
      "is_default": true,
      "log_management": 10000,
      "log_management_strategy": "STOP_INSERTING",
      "logpush": true,
      "logpush_public_key": "xxxxxxxxxxxxxxxx",
      "otel": [
        {
          "authorization": "authorization",
          "headers": {
            "foo": "string"
          },
          "url": "url",
          "content_type": "json"
        }
      ],
      "rate_limiting_technique": "fixed",
      "retry_backoff": "constant",
      "retry_delay": 0,
      "retry_max_attempts": 1,
      "store_id": "store_id",
      "stripe": {
        "authorization": "authorization",
        "usage_events": [
          {
            "payload": "payload"
          }
        ]
      },
      "workers_ai_billing_mode": "postpaid",
      "zdr": true
    }
  ],
  "success": true
}