---
title: "Add a DNS zone and records"
description: "Host a zone on ns1/ns2.gyrodns.net and manage record sets from code."
url: https://www.gyrohosting.com/developers/en/howto/dns-record.html
language: en
openapi: https://www.gyrohosting.com/developers/openapi.json
api_version: 2.30.0
---

# Add a DNS zone and records

Host a zone on ns1/ns2.gyrodns.net and manage record sets from code.

**curl**

```bash
curl -s -X POST https://www.gyrohosting.com/api/v1/client/cloud/dns/789/zones -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" -d '{"name":"example.com"}'
curl -s -X PUT https://www.gyrohosting.com/api/v1/client/cloud/dns/789/zones/example.com/records -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" -d '{"name":"www","type":"A","ttl":300,"records":["203.0.113.10"]}'
```

**CLI**

```bash
gyro dns zone create 789 --name example.com
gyro dns rrset set 789 example.com --name www --type A --ttl 300 --records 203.0.113.10
```

**Terraform**

```hcl
resource "gyro_dns_zone" "example" {
  service_id = 789          # Gyro DNS service
  name       = "example.com"
}
resource "gyro_dns_record" "www" {
  service_id = gyro_dns_zone.example.service_id
  zone       = gyro_dns_zone.example.name
  name       = "www"
  type       = "A"
  ttl        = 300
  records    = ["203.0.113.10"]
}
```

A record set is all values of one name + type; `PUT` replaces it. Point the domain to `ns1.gyrodns.net` / `ns2.gyrodns.net` (or add the verification TXT record) to activate the zone. No CNAME at the apex: use `ALIAS`. Let's Encrypt wildcard certificates: create an ACME key (`POST /cloud/dns/{id}/acme-keys`) that can only write `_acme-challenge`.
