Cloudflare Domains API

Attach and detach custom domains to Worker scripts.

Operations 4

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}/workers/domains List custom domains on Workers · Cloudflare List Worker Domains #
Ask an LLM
“Which custom domains are attached to my Worker scripts?”
“Can I see every hostname that serves a Worker directly?”
Tell an agent
List the custom domains attached to Workers in account {account}.
Show all Worker custom domains I've set up.
PUT /accounts/{account_id}/workers/domains Attach a custom domain to a Worker · Cloudflare Attach Custom Domain #
Ask an LLM
“How do I serve a Worker on my own custom domain?”
“Can I attach a hostname to a Worker script instead of using a route?”
Tell an agent
Attach a custom domain to a Worker in account {account}.
Hook up a new custom domain to my Worker script.
DELETE /accounts/{account_id}/workers/domains/{domain_id} Detach Worker Domain #
GET /accounts/{account_id}/workers/domains/{domain_id} Get Worker Domain #

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

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-domains-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-domains-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Cloudflare Domains API
  version: '1.0'
  description: 'Operations tagged Domains across 2 of this provider''s published API definitions: cloudflare-workers-openapi.yml, cloudflare-openapi.json. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.cloudflare.com/client/v4
  description: Cloudflare API v4 Production Server
tags:
- name: Domains
  description: Attach and detach custom domains to Worker scripts.
paths:
  /accounts/{account_id}/workers/domains:
    get:
      operationId: listDomains
      summary: Cloudflare List Worker Domains
      description: Retrieve all custom domains attached to Worker scripts.
      tags:
      - Domains
      parameters:
      - $ref: '#/components/parameters/AccountId'
      responses:
        '200':
          description: List of Worker domains.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
      security:
      - bearerAuth: []
    put:
      operationId: attachDomain
      summary: Cloudflare Attach Custom Domain
      description: Attach a custom domain to a Worker script.
      tags:
      - Domains
      parameters:
      - $ref: '#/components/parameters/AccountId'
      responses:
        '200':
          description: Domain attached successfully.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
      security:
      - bearerAuth: []
    servers:
    - url: https://api.cloudflare.com/client/v4
      description: Cloudflare API v4 Production Server
  /accounts/{account_id}/workers/domains/{domain_id}:
    delete:
      operationId: workers.domains.delete
      summary: Detach Worker Domain
      description: Detaches a domain from a Worker. Both the Worker and all of its previews are no longer routable using this domain.
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/workers_identifier'
      - name: domain_id
        in: path
        required: true
        schema:
          description: ID of the domain.
          type: string
          example: dbe10b4bc17c295377eabd600e1787fd
      responses:
        '200':
          description: Detach domain response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/workers_api-response-common'
        4XX:
          description: Detach domain failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/workers_api-response-common-failure'
      security:
      - api_token: []
      - api_email: []
        api_key: []
      tags:
      - Domains
      x-api-token-group:
      - Workers Scripts Write
      x-fern-audiences:
      - sdk
      x-fern-availability: generally-available
      x-fern-sdk-group-name: workers.domains
      x-fern-sdk-method-name: delete
      x-forge-require-confirmation: This will stop routing traffic on this domain to the Worker.
    get:
      operationId: workers.domains.get
      summary: Get Worker Domain
      description: Gets information about a Worker domain.
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/workers_identifier'
      - name: domain_id
        in: path
        required: true
        schema:
          description: ID of the domain.
          type: string
          example: dbe10b4bc17c295377eabd600e1787fd
      responses:
        '200':
          description: Get domain response.
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/workers_api-response-common'
                - properties:
                    result:
                      $ref: '#/components/schemas/workers_Domain'
                  required:
                  - result
                  type: object
        4XX:
          description: Get domain failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/workers_api-response-common-failure'
      security:
      - api_token: []
      - api_email: []
        api_key: []
      tags:
      - Domains
      x-api-token-group:
      - Workers Scripts Write
      - Workers Scripts Read
      x-fern-audiences:
      - sdk
      x-fern-availability: generally-available
      x-fern-sdk-group-name: workers.domains
      x-fern-sdk-method-name: get
    servers:
    - description: Client API
      url: https://api.cloudflare.com/client/v4
components:
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      description: The unique identifier of the Cloudflare account.
      schema:
        type: string
  schemas:
    workers_api-response-common-failure:
      type: object
      properties:
        errors:
          example:
          - code: 7003
            message: No route for the URI
          allOf:
          - $ref: '#/components/schemas/workers_messages'
          minLength: 1
        messages:
          example: []
          allOf:
          - $ref: '#/components/schemas/workers_messages'
        result:
          type:
          - object
          - 'null'
          enum:
          - null
        success:
          description: Whether the API call was successful.
          type: boolean
          example: false
          enum:
          - false
      required:
      - success
      - errors
      - messages
      - result
    workers_api-response-common:
      type: object
      properties:
        errors:
          $ref: '#/components/schemas/workers_messages'
        messages:
          $ref: '#/components/schemas/workers_messages'
        success:
          description: Whether the API call was successful.
          type: boolean
          example: true
          enum:
          - true
      required:
      - success
      - errors
      - messages
    workers_Domain:
      type: object
      properties:
        cert_id:
          description: ID of the TLS certificate issued for the domain.
          type: string
          format: uuid
          example: 9fdf92c8-64c2-4a3d-b1af-e15304961145
          readOnly: true
          x-auditable: true
        environment:
          description: Worker environment associated with the domain.
          type: string
          example: production
          deprecated: true
          readOnly: true
          x-auditable: true
        hostname:
          description: Hostname of the domain. Can be either the zone apex or a subdomain of the zone. Requests to this hostname will be routed to the configured Worker.
          type: string
          example: app.example.com
          x-auditable: true
        id:
          description: Immutable ID of the domain.
          type: string
          example: dbe10b4bc17c295377eabd600e1787fd
          readOnly: true
          x-auditable: true
        service:
          description: Name of the Worker associated with the domain. Requests to the configured hostname will be routed to this Worker.
          type: string
          example: my-worker
          x-auditable: true
        zone_id:
          description: ID of the zone containing the domain hostname.
          type: string
          example: 593c9c94de529bbbfaac7c53ced0447d
          x-auditable: true
          x-stainless-terraform-configurability: computed_optional
        zone_name:
          description: Name of the zone containing the domain hostname.
          type: string
          example: example.com
          x-auditable: true
          x-stainless-terraform-configurability: computed_optional
      required:
      - id
      - cert_id
      - environment
      - zone_id
      - zone_name
      - hostname
      - service
    workers_identifier:
      description: Identifier.
      type: string
      example: 023e105f4ecef8ad9ca31a8372d0c353
      maxLength: 32
      x-auditable: true
    workers_messages:
      type: array
      items:
        properties:
          code:
            type: integer
            minimum: 1000
          documentation_url:
            type: string
          message:
            type: string
          source:
            type: object
            properties:
              pointer:
                type: string
        required:
        - code
        - message
        type: object
        uniqueItems: true
      example: []
    workers_api-response-collection:
      type: object
      allOf:
      - $ref: '#/components/schemas/workers_api-response-common'
      - properties:
          result_info:
            type: object
            properties:
              count:
                description: Total number of results for the requested service.
                type: number
                example: 1
              page:
                description: Current page within paginated list of results.
                type: number
                example: 1
              per_page:
                description: Number of results per page of results.
                type: number
                example: 20
              total_count:
                description: Total results available without any search parameters.
                type: number
                example: 2000
              total_pages:
                description: The number of total pages in the entire result set.
                type: number
                example: 100
        type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API token authentication with Workers permissions.
    api_email:
      in: header
      name: X-Auth-Email
      type: apiKey
    api_key:
      in: header
      name: X-Auth-Key
      type: apiKey
    api_token:
      scheme: bearer
      type: http
    user_service_key:
      in: header
      name: X-Auth-User-Service-Key
      type: apiKey
x-refined-from:
- cloudflare-workers-openapi.yml
- cloudflare-openapi.json
x-provenance:
  method: harvested
  publisher: Cloudflare
  source: https://developers.cloudflare.com/openapi.json
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)