Preview DNS records from a zone file
POST /api/v2/dns-zones/{id}/smartcopy-zonefile
Reads the records in a pasted DNS zone file and compares them with this zone. Nothing in the zone changes. The zone file can be up to 200,000 characters. Rows that are invalid or of an unsupported type are skipped. When no valid record is left, the request fails.
Each record has an annotation: new, duplicate or conflict. Import the records you want with POST /api/v2/dns-zones/{id}/smartcopy. Errors on the input come back as 400 with a pointer to /zoneFile and a code in errors[0].code. An API key limited to certain DNS records gets 403. It needs access to the whole zone.
Authentication: An API key with the scope write:dns. About keys and scopes
Request
Path parameters
idstringrequiredzone_…).Body
zoneFilestringrequiredExample
curl -X POST "https://cloud.hostup.se/api/v2/dns-zones/zone_01hxa3b4c5d6e7f8g9h0j1k2m3/smartcopy-zonefile" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "zoneFile": "$ORIGIN example.com.\n@ 3600 IN A 192.0.2.10\nwww 3600 IN CNAME @" }'Responses
200 The comparison.
{ "records": [ { "type": "A", "name": "@", "value": "192.0.2.10", "ttl": 3600, "annotation": "new" }, { "type": "CNAME", "name": "www", "value": "example.com", "ttl": 3600, "annotation": "duplicate" } ], "domain": "example.com", "existingCount": 8}Response fields
recordsarray of objectannotation.typestringA, AAAA, CNAME, ALIAS, MX, TXT, CAA, SRV, NS, TLSA.namestring@ is the zone root.valuestringttlnumberprioritynumberweightnumberportnumberisCloudflarebooleancloudflareWarningstringrecordSubtypestringSPF, DMARC, DKIM, DOMAINKEY, MS365.annotationstringnew, duplicate, conflict.conflictingValuestringannotation is conflict.parkingPagebooleandomainstring or nullexistingCountintegerErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | The zone file is missing, too large or has no readable records. errors[0].code is missing_zone_file, zone_file_too_large or zone_file_no_records. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | No DNS zone with this ID on the account. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |