Skip to content

DNS Records API

The DNS Records API allows you to manage DNS records for domains registered with 0.link. Create, update, and delete A, AAAA, CNAME, MX, TXT, and other record types.

Base URL

https://api.0.link/api/domains/{domain_id}/dns/records

Authentication

All DNS API endpoints require authentication. Include your API key in the Authorization header:

bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://api.0.link/api/domains/dom_abc123/dns/records

Endpoints

MethodEndpointDescriptionRequired Scope
GET/domains/{id}/dns/recordsList all DNS recordsREAD
POST/domains/{id}/dns/recordsCreate a DNS recordWRITE
PUT/domains/{id}/dns/records/{record_id}Update a DNS recordWRITE
DELETE/domains/{id}/dns/records/{record_id}Delete a DNS recordWRITE

List DNS Records

Get all DNS records for a domain.

http
GET /api/domains/{id}/dns/records

Example Request

bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://api.0.link/api/domains/dom_abc123/dns/records

Example Response

json
[
  {
    "id": "rec_001",
    "type": "A",
    "name": "@",
    "content": "192.0.2.1",
    "ttl": 3600,
    "priority": null,
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  },
  {
    "id": "rec_002",
    "type": "A",
    "name": "www",
    "content": "192.0.2.1",
    "ttl": 3600,
    "priority": null,
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  },
  {
    "id": "rec_003",
    "type": "MX",
    "name": "@",
    "content": "mail.example.com",
    "ttl": 3600,
    "priority": 10,
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  },
  {
    "id": "rec_004",
    "type": "TXT",
    "name": "@",
    "content": "v=spf1 include:_spf.google.com ~all",
    "ttl": 3600,
    "priority": null,
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  }
]

Create DNS Record

Add a new DNS record to a domain.

http
POST /api/domains/{id}/dns/records

Request Body

json
{
  "type": "A",
  "name": "www",
  "content": "192.0.2.1",
  "ttl": 3600
}

Parameters

ParameterTypeRequiredDescription
typestringYesRecord type (A, AAAA, CNAME, MX, TXT, NS, SRV, CAA)
namestringYesRecord name (use @ for root domain)
contentstringYesRecord value/content
ttlintegerNoTime to live in seconds (default: 3600)
priorityintegerConditionalRequired for MX and SRV records

Example Request

bash
curl -X POST \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "type": "A",
       "name": "www",
       "content": "192.0.2.1",
       "ttl": 3600
     }' \
     https://api.0.link/api/domains/dom_abc123/dns/records

Example Response

json
{
  "id": "rec_005",
  "type": "A",
  "name": "www",
  "content": "192.0.2.1",
  "ttl": 3600,
  "priority": null,
  "created_at": "2026-01-20T10:30:00Z",
  "updated_at": "2026-01-20T10:30:00Z"
}

Update DNS Record

Update an existing DNS record.

http
PUT /api/domains/{id}/dns/records/{record_id}

Request Body

json
{
  "content": "192.0.2.2",
  "ttl": 1800
}

Parameters

ParameterTypeRequiredDescription
typestringNoRecord type
namestringNoRecord name
contentstringNoRecord value/content
ttlintegerNoTime to live in seconds
priorityintegerNoPriority (for MX/SRV records)

Example Request

bash
curl -X PUT \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "content": "192.0.2.2",
       "ttl": 1800
     }' \
     https://api.0.link/api/domains/dom_abc123/dns/records/rec_005

Example Response

json
{
  "id": "rec_005",
  "type": "A",
  "name": "www",
  "content": "192.0.2.2",
  "ttl": 1800,
  "priority": null,
  "created_at": "2026-01-20T10:30:00Z",
  "updated_at": "2026-01-20T11:00:00Z"
}

Delete DNS Record

Remove a DNS record from a domain.

http
DELETE /api/domains/{id}/dns/records/{record_id}

Example Request

bash
curl -X DELETE \
     -H "Authorization: Bearer YOUR_API_KEY" \
     https://api.0.link/api/domains/dom_abc123/dns/records/rec_005

Example Response

json
{
  "id": "rec_005",
  "deleted": true
}

Record Types

A Record

Maps a domain to an IPv4 address.

json
{
  "type": "A",
  "name": "@",
  "content": "192.0.2.1",
  "ttl": 3600
}

AAAA Record

Maps a domain to an IPv6 address.

json
{
  "type": "AAAA",
  "name": "@",
  "content": "2001:db8::1",
  "ttl": 3600
}

CNAME Record

Creates an alias pointing to another domain.

json
{
  "type": "CNAME",
  "name": "www",
  "content": "example.com",
  "ttl": 3600
}

WARNING

CNAME records cannot be created at the root domain (@). Use an A or AAAA record for the root instead.

MX Record

Specifies mail servers for the domain.

json
{
  "type": "MX",
  "name": "@",
  "content": "mail.example.com",
  "ttl": 3600,
  "priority": 10
}

Lower priority values indicate higher preference.

TXT Record

Stores text information, commonly used for SPF, DKIM, and domain verification.

json
{
  "type": "TXT",
  "name": "@",
  "content": "v=spf1 include:_spf.google.com ~all",
  "ttl": 3600
}

NS Record

Delegates a subdomain to different nameservers.

json
{
  "type": "NS",
  "name": "subdomain",
  "content": "ns1.other-provider.com",
  "ttl": 3600
}

SRV Record

Specifies the location of services.

json
{
  "type": "SRV",
  "name": "_sip._tcp",
  "content": "sipserver.example.com",
  "ttl": 3600,
  "priority": 10,
  "weight": 60,
  "port": 5060
}

CAA Record

Specifies which certificate authorities can issue certificates for the domain.

json
{
  "type": "CAA",
  "name": "@",
  "content": "0 issue \"letsencrypt.org\"",
  "ttl": 3600
}

Common DNS Configurations

Basic Website Setup

bash
# Root domain A record
curl -X POST -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"type": "A", "name": "@", "content": "192.0.2.1", "ttl": 3600}' \
     https://api.0.link/api/domains/dom_abc123/dns/records

# WWW subdomain
curl -X POST -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"type": "CNAME", "name": "www", "content": "example.com", "ttl": 3600}' \
     https://api.0.link/api/domains/dom_abc123/dns/records

Google Workspace Email

bash
# MX records for Gmail
curl -X POST -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"type": "MX", "name": "@", "content": "aspmx.l.google.com", "ttl": 3600, "priority": 1}' \
     https://api.0.link/api/domains/dom_abc123/dns/records

curl -X POST -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"type": "MX", "name": "@", "content": "alt1.aspmx.l.google.com", "ttl": 3600, "priority": 5}' \
     https://api.0.link/api/domains/dom_abc123/dns/records

# SPF record
curl -X POST -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"type": "TXT", "name": "@", "content": "v=spf1 include:_spf.google.com ~all", "ttl": 3600}' \
     https://api.0.link/api/domains/dom_abc123/dns/records

Domain Verification

bash
# TXT record for domain verification (e.g., Google Search Console)
curl -X POST -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"type": "TXT", "name": "@", "content": "google-site-verification=abc123xyz", "ttl": 3600}' \
     https://api.0.link/api/domains/dom_abc123/dns/records

Error Responses

Record Not Found

json
{
  "error": {
    "code": "RECORD_NOT_FOUND",
    "message": "The specified DNS record was not found"
  }
}

Invalid Record Type

json
{
  "error": {
    "code": "INVALID_RECORD_TYPE",
    "message": "Invalid DNS record type",
    "details": "Supported types: A, AAAA, CNAME, MX, TXT, NS, SRV, CAA"
  }
}

Invalid Record Content

json
{
  "error": {
    "code": "INVALID_RECORD_CONTENT",
    "message": "Invalid record content for type A",
    "details": "Expected a valid IPv4 address"
  }
}

CNAME at Root

json
{
  "error": {
    "code": "CNAME_AT_ROOT",
    "message": "CNAME records cannot be created at the root domain"
  }
}

Missing Priority

json
{
  "error": {
    "code": "MISSING_PRIORITY",
    "message": "MX records require a priority value"
  }
}

Code Examples

JavaScript

javascript
const DOMAIN_ID = 'dom_abc123';
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.0.link/api';

// List all DNS records
const records = await fetch(
  `${BASE_URL}/domains/${DOMAIN_ID}/dns/records`,
  {
    headers: { 'Authorization': `Bearer ${API_KEY}` }
  }
).then(res => res.json());

// Create an A record
const newRecord = await fetch(
  `${BASE_URL}/domains/${DOMAIN_ID}/dns/records`,
  {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      type: 'A',
      name: 'api',
      content: '192.0.2.100',
      ttl: 3600
    })
  }
).then(res => res.json());

// Update a record
await fetch(
  `${BASE_URL}/domains/${DOMAIN_ID}/dns/records/rec_005`,
  {
    method: 'PUT',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      content: '192.0.2.101'
    })
  }
);

// Delete a record
await fetch(
  `${BASE_URL}/domains/${DOMAIN_ID}/dns/records/rec_005`,
  {
    method: 'DELETE',
    headers: { 'Authorization': `Bearer ${API_KEY}` }
  }
);

Python

python
import requests

DOMAIN_ID = 'dom_abc123'
API_KEY = 'YOUR_API_KEY'
BASE_URL = 'https://api.0.link/api'

headers = {
    'Authorization': f'Bearer {API_KEY}',
    'Content-Type': 'application/json'
}

# List all DNS records
records = requests.get(
    f'{BASE_URL}/domains/{DOMAIN_ID}/dns/records',
    headers=headers
).json()

# Create an A record
new_record = requests.post(
    f'{BASE_URL}/domains/{DOMAIN_ID}/dns/records',
    headers=headers,
    json={
        'type': 'A',
        'name': 'api',
        'content': '192.0.2.100',
        'ttl': 3600
    }
).json()

# Update a record
requests.put(
    f'{BASE_URL}/domains/{DOMAIN_ID}/dns/records/rec_005',
    headers=headers,
    json={
        'content': '192.0.2.101'
    }
)

# Delete a record
requests.delete(
    f'{BASE_URL}/domains/{DOMAIN_ID}/dns/records/rec_005',
    headers=headers
)

TTL Guidelines

Use CaseRecommended TTLNotes
Static content86400 (24h)Rarely changing records
Standard3600 (1h)Default for most records
Dynamic content300 (5m)Frequently changing records
Migration60 (1m)During DNS transitions

TIP

Lower TTL values allow faster propagation of changes but increase DNS query load. Use longer TTLs for stable records.


DNS Propagation

After creating or updating DNS records, changes may take time to propagate across the internet:

  • 0.link nameservers: Changes take effect within seconds
  • Global propagation: Typically 1-24 hours depending on TTL values and ISP caching

You can check propagation status using tools like:


Next Steps