# Add a Site to Cloudflare (`cloudflare.create_zone`)

Adds a domain to one of your Cloudflare accounts as a new zone and returns the Cloudflare name servers to set at your registrar.

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

- Endpoint: `POST https://api.primaryapi.com/v1/run/cloudflare.create_zone`
- Category: Web Scraping · Platform: `cloudflare` · Kind: lookup · 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.create_zone`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `name` | string | yes |  | max 254 chars | The domain to add, for example "example.com" (usually the registered domain, not a subdomain). |
| `account` | string | no |  | pattern: ^[0-9a-f]{32}$ | The Cloudflare account to add it to (its 32-character id from cloudflare.accounts). Optional when the connection can see exactly one account. |
| `type` | enum | no | "full" | one of: full, partial | full (default): Cloudflare hosts the DNS, and you point the domain’s name servers at Cloudflare. partial: a CNAME setup that keeps DNS elsewhere (Business and Enterprise plans). |
| `jump_start` | boolean | no | false |  | true = ask Cloudflare to scan the domain’s current DNS records and copy them in. Default false. |
| `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 |
|---|---|---|
| `id` | string | Zone id: pass it as `zone` to the other Cloudflare APIs |
| `name` | string | Domain name |
| `status` | string \| null | initializing, pending, active or moved |
| `paused` | boolean \| null | True when Cloudflare only answers DNS (no proxy, security or performance) |
| `type` | string \| null | full (DNS hosted on Cloudflare), partial (CNAME setup), secondary or internal |
| `plan` | object \| null |  |
| `plan.id` | string \| null |  |
| `plan.name` | string \| null |  |
| `plan.legacyId` | string \| null | Short plan id, for example "free" |
| `account` | object |  |
| `account.id` | string \| null |  |
| `account.name` | string \| null |  |
| `nameServers` | string[] | Cloudflare name servers assigned to the zone |
| `originalNameServers` | string[] \| null | Name servers before the move to Cloudflare |
| `originalRegistrar` | string \| null |  |
| `createdAt` | string \| null |  |
| `modifiedAt` | string \| null |  |
| `activatedAt` | string \| null | When the zone became active (ownership proven) |
| `nextStep` | string \| null | What to do to activate the zone, for example which name servers to set at the registrar |

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.

## Example request

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/cloudflare.create_zone" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"example.com","account":"01a7362d577a6c3019a474fd6f485823"}'
```

## 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": {
      "id": "023e105f4ecef8ad9ca31a8372d0c353",
      "name": "example.com",
      "status": "pending",
      "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": null,
      "nextStep": "At the domain’s registrar, replace its name servers with bob.ns.cloudflare.com and lola.ns.cloudflare.com. Cloudflare activates the zone once it sees them."
    }
  },
  "provider": "PrimaryAPI",
  "credits": 1,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z"
}
```

## 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.create_zone`

## 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 needs the "Add and remove sites" permission. It changes your Cloudflare account right away: confirm the domain and the account with the person first. Leave out `account` when the connection sees one account; with several, pass one from cloudflare.accounts. A domain that is already a zone in the account answers invalid_input (Cloudflare error 1061): find it with cloudflare.zones. The new zone starts as pending: it becomes active once the domain’s name servers point at the ones returned in nameServers. Repeating the call with the same Idempotency-Key and input returns the first result instead of adding the zone again.

