# Delete a Cloudflare DNS Record (`cloudflare.delete_dns_record`)

Permanently deletes one DNS record from one of your Cloudflare zones and returns what was deleted.

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

- Endpoint: `POST https://api.primaryapi.com/v1/run/cloudflare.delete_dns_record`
- 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.delete_dns_record`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `zone` | string | yes |  | max 253 chars | The zone (domain) on Cloudflare: its domain name, for example "example.com", or its 32-character zone id from cloudflare.zones. |
| `recordId` | string | yes |  | pattern: ^[0-9a-f]{32}$ | The DNS record id (32 characters), as returned by cloudflare.dns_records. |
| `name` | string | no |  | max 255 chars | Safety check (recommended): the record’s name ("@", "www" or "www.example.com"). The record is deleted only if its name matches. |
| `type` | enum | no |  | one of: A, AAAA, CAA, CERT, CNAME, DNSKEY, DS, HTTPS, LOC, MX, NAPTR, NS, OPENPGPKEY, PTR, SMIMEA, SRV, SSHFP, SVCB, TLSA, TXT, URI | Safety check: the record’s type, for example "A". The record is deleted only if its type matches. |
| `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 |
|---|---|---|
| `zoneId` | string | Cloudflare zone id |
| `zone` | string | The zone’s domain name |
| `deleted` | true |  |
| `record` | object | The record that was deleted (create it again with these values to undo) |
| `record.id` | string | DNS record id (use it to update or delete the record) |
| `record.type` | string | A, AAAA, CNAME, MX, TXT, NS, CAA, SRV … |
| `record.name` | string | Full record name, in Punycode |
| `record.content` | string \| null | The value; for CAA and SRV a formatted summary of `data` |
| `record.proxied` | boolean | Traffic goes through Cloudflare (orange cloud) |
| `record.proxiable` | boolean \| null | Whether the record can be proxied |
| `record.ttl` | integer | Seconds; 1 = automatic |
| `record.priority` | integer \| null | MX (and URI) preference |
| `record.data` | object \| null | The parts of CAA, SRV and other structured records |
| `record.comment` | string \| null |  |
| `record.tags` | string[] |  |
| `record.createdAt` | string \| null |  |
| `record.modifiedAt` | 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.

## Example request

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/cloudflare.delete_dns_record" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"zone":"example.com","recordId":"372e67954025e0ba6aaa6d586b9e0b59","name":"www","type":"A"}'
```

## 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": {
      "zoneId": "023e105f4ecef8ad9ca31a8372d0c353",
      "zone": "example.com",
      "deleted": true,
      "record": {
        "id": "372e67954025e0ba6aaa6d586b9e0b59",
        "type": "A",
        "name": "www.example.com",
        "content": "198.51.100.4",
        "proxied": true,
        "proxiable": true,
        "ttl": 1,
        "priority": null,
        "data": null,
        "comment": "Web server",
        "tags": [],
        "createdAt": "2014-01-01T05:20:00.123Z",
        "modifiedAt": "2014-01-01T05:20:00.123Z"
      }
    }
  },
  "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.delete_dns_record`

## 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 "Manage DNS" permission. Deleting a record can take a site, email or verification offline. Pass `name` (and `type`) as a safety check: when they do not match the record, nothing is deleted and the call answers found: false with reason record_mismatch. This changes the live configuration of your Cloudflare zone right away: there is no undo, no preview and no automatic retry. A call that times out may still have gone through, so read the current state (cloudflare.dns_records) before trying again. An Idempotency-Key does not protect it: results of private APIs are never stored, so a repeated key runs the change again. A record id that does not exist in the zone is a miss (found: false, reason record_not_found).

