# My Cloudflare Zones (`cloudflare.zones`)

Lists the zones (domains) your connected Cloudflare account can see, with status, plan and name servers.

Docs: https://primaryapi.com/docs/api-reference/cloudflare/zones

- Endpoint: `POST https://api.primaryapi.com/v1/run/cloudflare.zones`
- Category: Web Scraping · Platform: `cloudflare` · Kind: list · Status: live
- Price: 1 credit per call. Every call costs the same, including calls that were retried automatically.
- Billing unit: per successful call
- Reliability: routed to a healthy upstream and retried automatically when an attempt fails; live 30-day status: `GET https://api.primaryapi.com/v1/status/apis?sku=cloudflare.zones`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `name` | string | no |  | max 253 chars | Only the zone with exactly this domain name, for example "example.com". |
| `status` | enum | no |  | one of: initializing, pending, active, moved | Only zones in this status: active (serving), pending (waiting for the name server change), initializing or moved. |
| `accountId` | string | no |  | pattern: ^[0-9a-f]{32}$ | Only zones of this Cloudflare account (32-character id, as in each zone’s account.id). |
| `limit` | integer | no | 20 | 5–50 | Zones per page (5-50, default 20), ordered by name. |
| `cursor` | string | no |  |  | Opaque pagination cursor: pass the previous response's nextCursor. |
| `connection` | string | no |  | max 200 chars | Which connected account to use when the workspace has several for this provider: the customId you gave it (exact), its connection id ("con_…"), its handle (login, email or @handle) or its name. Optional; prefer the customId or id, which never match two accounts. |

Unknown fields are rejected with `400 invalid_input`. The routing controls `preferLatencyUnderMs` and `maxCredits` may be sent in the same JSON body.

## Output

When `output.found` is `true`, `output.data` has this shape:

| Field | Type | Description |
|---|---|---|
| `zones` | object[] |  |
| `zones[].id` | string | Zone id: pass it as `zone` to the other Cloudflare APIs |
| `zones[].name` | string | Domain name |
| `zones[].status` | string \| null | initializing, pending, active or moved |
| `zones[].paused` | boolean \| null | True when Cloudflare only answers DNS (no proxy, security or performance) |
| `zones[].type` | string \| null | full (DNS hosted on Cloudflare), partial (CNAME setup), secondary or internal |
| `zones[].plan` | object \| null |  |
| `zones[].plan.id` | string \| null |  |
| `zones[].plan.name` | string \| null |  |
| `zones[].plan.legacyId` | string \| null | Short plan id, for example "free" |
| `zones[].account` | object |  |
| `zones[].account.id` | string \| null |  |
| `zones[].account.name` | string \| null |  |
| `zones[].nameServers` | string[] | Cloudflare name servers assigned to the zone |
| `zones[].originalNameServers` | string[] \| null | Name servers before the move to Cloudflare |
| `zones[].originalRegistrar` | string \| null |  |
| `zones[].createdAt` | string \| null |  |
| `zones[].modifiedAt` | string \| null |  |
| `zones[].activatedAt` | string \| null | When the zone became active (ownership proven) |
| `nextCursor` | string \| null |  |

When the thing you asked about does not exist (or a search matches nothing) the call still succeeds: `output.found` is `false`, `output.data` is `null` and `output.reason` says why (`not_found`, `private`, `no_results`, …). Misses are free unless the notes below say misses are billed.

Pagination: pass the previous response’s `nextCursor` as `cursor` to get the next page; `nextCursor: null` means there are no more results.

## Example request

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/cloudflare.zones" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status":"active"}'
```

## Example response

_Values are placeholders that follow the output schema; `credits` is what this call would cost at the usual price._

```json
{
  "output": {
    "found": true,
    "data": {
      "zones": [
        {
          "id": "023e105f4ecef8ad9ca31a8372d0c353",
          "name": "example.com",
          "status": "active",
          "paused": false,
          "type": "full",
          "plan": {
            "id": "023e105f4ecef8ad9ca31a8372d0c353",
            "name": "Example Org",
            "legacyId": "free"
          },
          "account": {
            "id": "01a7362d577a6c3019a474fd6f485823",
            "name": "Example Account Name"
          },
          "nameServers": [
            "bob.ns.cloudflare.com",
            "lola.ns.cloudflare.com"
          ],
          "originalNameServers": [
            "ns1.originaldnshost.com",
            "ns2.originaldnshost.com"
          ],
          "originalRegistrar": "GoDaddy",
          "createdAt": "2014-01-01T05:20:00.123Z",
          "modifiedAt": "2014-01-01T05:20:00.123Z",
          "activatedAt": "2014-01-02T00:01:00.123Z"
        }
      ],
      "nextCursor": null
    }
  },
  "provider": "PrimaryAPI",
  "credits": 1,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z",
  "nextCursor": null
}
```

## Pricing and reliability

- Usual price: 1 credit per call
- Price ceiling: the usual price, even when a call is retried. A quote’s `maxCredits` is the most a given call can cost; the `maxCredits` routing control caps it per call
- Live 30-day status, success rate, uptime and latency: `GET https://api.primaryapi.com/v1/status/apis?sku=cloudflare.zones`

## Errors to handle

`invalid_input`, `unauthorized`, `insufficient_balance`, `key_limit_reached`, `trial_cap_reached`, `forbidden`, `not_found`, `idempotency_conflict`, `rate_limited`, `all_sources_failed`, `service_unavailable`, `timeout`. See https://primaryapi.com/docs/errors.

## Notes

Runs as your connected Cloudflare account and lists the zones in the accounts you shared when connecting. Use a zone’s id or name as `zone` in cloudflare.dns_records, cloudflare.zone_analytics and the DNS and cache APIs. Results are never stored; run the call again to refresh them.

