Skip to content
Start here

Get domains

client.pages.projects.domains.list(stringprojectName, DomainListParams { account_id } params, RequestOptionsoptions?): SinglePage<DomainListResponse { id, certificate_authority, created_on, 6 more } >
GET/accounts/{account_id}/pages/projects/{project_name}/domains

Fetch a list of all domains associated with a Pages project.

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)
Pages ReadPages Write
ParametersExpand Collapse
projectName: string

Name of the project.

params: DomainListParams { account_id }
account_id: string

Identifier.

maxLength32
ReturnsExpand Collapse
DomainListResponse { id, certificate_authority, created_on, 6 more }
id: string
certificate_authority: "google" | "lets_encrypt"
One of the following:
"google"
"lets_encrypt"
created_on: string
domain_id: string
name: string

The domain name.

status: "initializing" | "pending" | "active" | 3 more
One of the following:
"initializing"
"pending"
"active"
"deactivated"
"blocked"
"error"
validation_data: ValidationData { method, status, error_message, 2 more }
method: "http" | "txt"
One of the following:
"http"
"txt"
status: "initializing" | "pending" | "active" | 2 more
One of the following:
"initializing"
"pending"
"active"
"deactivated"
"error"
error_message?: string
txt_name?: string
txt_value?: string
verification_data: VerificationData { status, error_message }
status: "pending" | "active" | "deactivated" | 2 more
One of the following:
"pending"
"active"
"deactivated"
"blocked"
"error"
error_message?: string
zone_tag: string

Get domains

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const domainListResponse of client.pages.projects.domains.list('this-is-my-project-01', {
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
})) {
  console.log(domainListResponse.id);
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "id": "id",
      "certificate_authority": "lets_encrypt",
      "created_on": "created_on",
      "domain_id": "domain_id",
      "name": "this-is-my-domain-01.com",
      "status": "initializing",
      "validation_data": {
        "method": "http",
        "status": "initializing",
        "error_message": "error_message",
        "txt_name": "txt_name",
        "txt_value": "txt_value"
      },
      "verification_data": {
        "status": "pending",
        "error_message": "error_message"
      },
      "zone_tag": "zone_tag"
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "id": "id",
      "certificate_authority": "lets_encrypt",
      "created_on": "created_on",
      "domain_id": "domain_id",
      "name": "this-is-my-domain-01.com",
      "status": "initializing",
      "validation_data": {
        "method": "http",
        "status": "initializing",
        "error_message": "error_message",
        "txt_name": "txt_name",
        "txt_value": "txt_value"
      },
      "verification_data": {
        "status": "pending",
        "error_message": "error_message"
      },
      "zone_tag": "zone_tag"
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}