Cloudflare Gateways API

Create, list, update, and delete AI Gateway instances.

Operations 5

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /accounts/{account_id}/ai-gateway/gateways List AI Gateways · Cloudflare List Ai Gateways #
Ask an LLM
“Which AI Gateways have I set up in Cloudflare?”
“Can I get a list of all my AI Gateway instances?”
Tell an agent
List all AI Gateways in account {account}.
Show me every AI Gateway instance I have.
POST /accounts/{account_id}/ai-gateway/gateways Create an AI Gateway · Cloudflare Create Ai Gateway #
Ask an LLM
“How do I set up a new AI Gateway in front of my model calls?”
“Can I turn on response caching with a TTL when creating a gateway?”
Tell an agent
Create an AI Gateway named {name} with caching for {cache_ttl} seconds.
In account {account}, create AI Gateway {name} limited to {rate_limiting_limit} requests per {rate_limiting_interval} seconds.
GET /accounts/{account_id}/ai-gateway/gateways/{gateway_id} Get an AI Gateway's configuration · Cloudflare Get Ai Gateway #
Ask an LLM
“What caching and rate-limit settings does one of my AI Gateways use?”
“Can I check whether logging is enabled on a specific gateway?”
Tell an agent
Get the configuration of AI Gateway {gateway}.
Show AI Gateway {gateway} in account {account}.
PUT /accounts/{account_id}/ai-gateway/gateways/{gateway_id} Update an AI Gateway's settings · Cloudflare Update Ai Gateway #
Ask an LLM
“How do I change the cache TTL on an existing AI Gateway?”
“Can I switch off request logging on a gateway I already created?”
Tell an agent
Update AI Gateway {gateway} to cache responses for {cache_ttl} seconds.
Set the logging on existing gateway {gateway} named {name} in account {account} to {log_enabled}.
DELETE /accounts/{account_id}/ai-gateway/gateways/{gateway_id} Delete an AI Gateway · Cloudflare Delete Ai Gateway #
Ask an LLM
“How do I delete an AI Gateway I no longer need?”
“Can I permanently remove one AI Gateway instance from my account?”
Tell an agent destructive · confirm first
Delete AI Gateway {gateway}.
Remove AI Gateway {gateway} from account {account}.

Documentation

📖
Documentation
https://developers.cloudflare.com/api/
📖
GettingStarted
https://developers.cloudflare.com/fundamentals/api/get-started/
📖
Authentication
https://developers.cloudflare.com/fundamentals/api/get-started/create-token/
📖
RateLimits
https://developers.cloudflare.com/fundamentals/api/reference/limits/
📖
Documentation
https://developers.cloudflare.com/api/operations/accounts-list-accounts
📖
APIReference
https://developers.cloudflare.com/api/resources/accounts/
📖
APIReference
https://developers.cloudflare.com/ssl/
📖
Documentation
https://developers.cloudflare.com/api/operations/ip-access-rules-for-a-user-list-ip-access-rules
📖
Documentation
https://developers.cloudflare.com/api/operations/user'-s-account-memberships-list-memberships
📖
Documentation
https://developers.cloudflare.com/api/operations/radar-get-search-global
📖
APIReference
https://developers.cloudflare.com/radar/
📖
GettingStarted
https://developers.cloudflare.com/radar/get-started/
📖
Documentation
https://developers.cloudflare.com/api/operations/user-user-details
📖
APIReference
https://developers.cloudflare.com/api/resources/user/
📖
Documentation
https://developers.cloudflare.com/api/operations/zones-get
📖
APIReference
https://developers.cloudflare.com/api/resources/zones/
📖
Documentation
https://developers.cloudflare.com/dns/
📖
APIReference
https://developers.cloudflare.com/api/resources/dns/
📖
Documentation
https://developers.cloudflare.com/workers/
📖
APIReference
https://developers.cloudflare.com/api/resources/workers/
📖
GettingStarted
https://developers.cloudflare.com/workers/get-started/
📖
Documentation
https://developers.cloudflare.com/workers-ai/
📖
GettingStarted
https://developers.cloudflare.com/workers-ai/get-started/rest-api/
📖
APIReference
https://developers.cloudflare.com/workers-ai/configuration/open-ai-compatibility/
📖
APIReference
https://developers.cloudflare.com/workers-ai/models/
📖
Documentation
https://developers.cloudflare.com/ai-gateway/
📖
APIReference
https://developers.cloudflare.com/ai-gateway/usage/providers/
📖
GettingStarted
https://developers.cloudflare.com/ai-gateway/get-started/
📖
Documentation
https://developers.cloudflare.com/r2/
📖
APIReference
https://developers.cloudflare.com/r2/api/s3/api/
📖
GettingStarted
https://developers.cloudflare.com/r2/get-started/
📖
Documentation
https://developers.cloudflare.com/d1/
📖
APIReference
https://developers.cloudflare.com/api/resources/d1/
📖
GettingStarted
https://developers.cloudflare.com/d1/get-started/
📖
Documentation
https://developers.cloudflare.com/kv/
📖
APIReference
https://developers.cloudflare.com/api/resources/kv/
📖
GettingStarted
https://developers.cloudflare.com/kv/get-started/
📖
Documentation
https://developers.cloudflare.com/queues/
📖
APIReference
https://developers.cloudflare.com/api/resources/queues/
📖
GettingStarted
https://developers.cloudflare.com/queues/get-started/
📖
Documentation
https://developers.cloudflare.com/durable-objects/
📖
GettingStarted
https://developers.cloudflare.com/durable-objects/get-started/
📖
APIReference
https://developers.cloudflare.com/durable-objects/api/
📖
Documentation
https://developers.cloudflare.com/vectorize/
📖
GettingStarted
https://developers.cloudflare.com/vectorize/get-started/intro/
📖
APIReference
https://developers.cloudflare.com/vectorize/reference/client-api/
📖
Documentation
https://developers.cloudflare.com/pages/
📖
APIReference
https://developers.cloudflare.com/pages/configuration/api/
📖
GettingStarted
https://developers.cloudflare.com/pages/get-started/
📖
Documentation
https://developers.cloudflare.com/stream/
📖
GettingStarted
https://developers.cloudflare.com/stream/get-started/
📖
APIReference
https://developers.cloudflare.com/api/resources/stream/
📖
Documentation
https://developers.cloudflare.com/images/
📖
GettingStarted
https://developers.cloudflare.com/images/get-started/
📖
APIReference
https://developers.cloudflare.com/api/resources/images/
📖
Documentation
https://developers.cloudflare.com/turnstile/
📖
GettingStarted
https://developers.cloudflare.com/turnstile/get-started/
📖
APIReference
https://developers.cloudflare.com/api/resources/turnstile/
📖
Documentation
https://developers.cloudflare.com/logs/
📖
APIReference
https://developers.cloudflare.com/api/resources/logpush/
📖
GettingStarted
https://developers.cloudflare.com/logs/get-started/
📖
Documentation
https://developers.cloudflare.com/hyperdrive/
📖
APIReference
https://developers.cloudflare.com/api/resources/hyperdrive/
📖
GettingStarted
https://developers.cloudflare.com/hyperdrive/get-started/

Specifications

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/cloudflare:cloudflare-gateways-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

cloudflare-gateways-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Cloudflare AI Gateway Gateways API
  description: Cloudflare AI Gateway provides visibility and control over AI applications with analytics, logging, caching, rate limiting, request retries, and model fallback. It supports multiple AI providers including OpenAI, Anthropic, and Google Gemini through a unified interface. The API allows developers to create and manage gateways, configure providers, and access logs and analytics.
  version: '4.0'
  contact:
    name: Cloudflare Support
    url: https://support.cloudflare.com/
  termsOfService: https://www.cloudflare.com/terms/
servers:
- url: https://api.cloudflare.com/client/v4
  description: Cloudflare API v4 Production Server
security:
- bearerAuth: []
tags:
- name: Gateways
  description: Create, list, update, and delete AI Gateway instances.
paths:
  /accounts/{account_id}/ai-gateway/gateways:
    get:
      operationId: listAiGateways
      summary: Cloudflare List Ai Gateways
      description: Returns all AI Gateway instances for the account.
      tags:
      - Gateways
      parameters:
      - $ref: '#/components/parameters/AccountId'
      responses:
        '200':
          description: List of AI Gateway instances.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayListResponse'
              examples:
                Listaigateways200Example:
                  summary: Default listAiGateways 200 response
                  x-microcks-default: true
                  value:
                    result:
                    - id: abc123
                      name: Example Title
                      slug: example_value
                      cache_enabled: true
                      cache_ttl: 10
                      rate_limiting_enabled: true
                      rate_limiting_limit: 10
                      rate_limiting_interval: 10
                      log_enabled: true
                      created_at: '2026-01-15T10:30:00Z'
                      modified_at: '2026-01-15T10:30:00Z'
                    success: true
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      operationId: createAiGateway
      summary: Cloudflare Create Ai Gateway
      description: Create a new AI Gateway instance with the specified configuration for caching, rate limiting, and provider settings.
      tags:
      - Gateways
      parameters:
      - $ref: '#/components/parameters/AccountId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GatewayInput'
            examples:
              CreateaigatewayRequestExample:
                summary: Default createAiGateway request
                x-microcks-default: true
                value:
                  name: Example Title
                  cache_enabled: true
                  cache_ttl: 10
                  rate_limiting_enabled: true
                  rate_limiting_limit: 10
                  rate_limiting_interval: 10
                  log_enabled: true
      responses:
        '200':
          description: Gateway created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayResponse'
              examples:
                Createaigateway200Example:
                  summary: Default createAiGateway 200 response
                  x-microcks-default: true
                  value:
                    result:
                      id: abc123
                      name: Example Title
                      slug: example_value
                      cache_enabled: true
                      cache_ttl: 10
                      rate_limiting_enabled: true
                      rate_limiting_limit: 10
                      rate_limiting_interval: 10
                      log_enabled: true
                      created_at: '2026-01-15T10:30:00Z'
                      modified_at: '2026-01-15T10:30:00Z'
                    success: true
                    errors:
                    - {}
                    messages:
                    - {}
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/ai-gateway/gateways/{gateway_id}:
    get:
      operationId: getAiGateway
      summary: Cloudflare Get Ai Gateway
      description: Retrieve details of a specific AI Gateway instance.
      tags:
      - Gateways
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/GatewayId'
      responses:
        '200':
          description: Gateway details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayResponse'
              examples:
                Getaigateway200Example:
                  summary: Default getAiGateway 200 response
                  x-microcks-default: true
                  value:
                    result:
                      id: abc123
                      name: Example Title
                      slug: example_value
                      cache_enabled: true
                      cache_ttl: 10
                      rate_limiting_enabled: true
                      rate_limiting_limit: 10
                      rate_limiting_interval: 10
                      log_enabled: true
                      created_at: '2026-01-15T10:30:00Z'
                      modified_at: '2026-01-15T10:30:00Z'
                    success: true
                    errors:
                    - {}
                    messages:
                    - {}
        '401':
          description: Unauthorized.
        '404':
          description: Gateway not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    put:
      operationId: updateAiGateway
      summary: Cloudflare Update Ai Gateway
      description: Update the configuration of an AI Gateway instance.
      tags:
      - Gateways
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/GatewayId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GatewayInput'
            examples:
              UpdateaigatewayRequestExample:
                summary: Default updateAiGateway request
                x-microcks-default: true
                value:
                  name: Example Title
                  cache_enabled: true
                  cache_ttl: 10
                  rate_limiting_enabled: true
                  rate_limiting_limit: 10
                  rate_limiting_interval: 10
                  log_enabled: true
      responses:
        '200':
          description: Gateway updated successfully.
        '401':
          description: Unauthorized.
        '404':
          description: Gateway not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      operationId: deleteAiGateway
      summary: Cloudflare Delete Ai Gateway
      description: Delete an AI Gateway instance.
      tags:
      - Gateways
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/GatewayId'
      responses:
        '200':
          description: Gateway deleted successfully.
        '401':
          description: Unauthorized.
        '404':
          description: Gateway not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    GatewayListResponse:
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/Gateway'
          example: []
        success:
          type: boolean
          example: true
    Gateway:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the gateway.
          example: abc123
        name:
          type: string
          description: The name of the gateway.
          example: Example Title
        slug:
          type: string
          description: URL-friendly slug for the gateway.
          example: example_value
        cache_enabled:
          type: boolean
          description: Whether response caching is enabled.
          example: true
        cache_ttl:
          type: integer
          description: Cache time-to-live in seconds.
          example: 10
        rate_limiting_enabled:
          type: boolean
          description: Whether rate limiting is enabled.
          example: true
        rate_limiting_limit:
          type: integer
          description: Maximum requests per rate limiting interval.
          example: 10
        rate_limiting_interval:
          type: integer
          description: Rate limiting interval in seconds.
          example: 10
        log_enabled:
          type: boolean
          description: Whether logging is enabled.
          example: true
        created_at:
          type: string
          format: date-time
          description: When the gateway was created.
          example: '2026-01-15T10:30:00Z'
        modified_at:
          type: string
          format: date-time
          description: When the gateway was last modified.
          example: '2026-01-15T10:30:00Z'
    GatewayResponse:
      type: object
      properties:
        result:
          $ref: '#/components/schemas/Gateway'
        success:
          type: boolean
          example: true
        errors:
          type: array
          items:
            type: object
          example: []
        messages:
          type: array
          items:
            type: object
          example: []
    GatewayInput:
      type: object
      required:
      - name
      properties:
        name:
          type: string
          description: The name of the gateway.
          example: Example Title
        cache_enabled:
          type: boolean
          description: Enable response caching.
          example: true
        cache_ttl:
          type: integer
          description: Cache TTL in seconds.
          example: 10
        rate_limiting_enabled:
          type: boolean
          description: Enable rate limiting.
          example: true
        rate_limiting_limit:
          type: integer
          description: Rate limit threshold.
          example: 10
        rate_limiting_interval:
          type: integer
          description: Rate limiting interval in seconds.
          example: 10
        log_enabled:
          type: boolean
          description: Enable request logging.
          example: true
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      description: The unique identifier of the Cloudflare account.
      schema:
        type: string
    GatewayId:
      name: gateway_id
      in: path
      required: true
      description: The unique identifier of the AI Gateway.
      schema:
        type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API token with AI Gateway permissions.
externalDocs:
  description: Cloudflare AI Gateway Documentation
  url: https://developers.cloudflare.com/ai-gateway/