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/recordsAuthentication
All DNS API endpoints require authentication. Include your API key in the Authorization header:
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.0.link/api/domains/dom_abc123/dns/recordsEndpoints
| Method | Endpoint | Description | Required Scope |
|---|---|---|---|
| GET | /domains/{id}/dns/records | List all DNS records | READ |
| POST | /domains/{id}/dns/records | Create a DNS record | WRITE |
| PUT | /domains/{id}/dns/records/{record_id} | Update a DNS record | WRITE |
| DELETE | /domains/{id}/dns/records/{record_id} | Delete a DNS record | WRITE |
List DNS Records
Get all DNS records for a domain.
GET /api/domains/{id}/dns/recordsExample Request
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.0.link/api/domains/dom_abc123/dns/recordsExample Response
[
{
"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.
POST /api/domains/{id}/dns/recordsRequest Body
{
"type": "A",
"name": "www",
"content": "192.0.2.1",
"ttl": 3600
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Record type (A, AAAA, CNAME, MX, TXT, NS, SRV, CAA) |
name | string | Yes | Record name (use @ for root domain) |
content | string | Yes | Record value/content |
ttl | integer | No | Time to live in seconds (default: 3600) |
priority | integer | Conditional | Required for MX and SRV records |
Example Request
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/recordsExample Response
{
"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.
PUT /api/domains/{id}/dns/records/{record_id}Request Body
{
"content": "192.0.2.2",
"ttl": 1800
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | No | Record type |
name | string | No | Record name |
content | string | No | Record value/content |
ttl | integer | No | Time to live in seconds |
priority | integer | No | Priority (for MX/SRV records) |
Example Request
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_005Example Response
{
"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.
DELETE /api/domains/{id}/dns/records/{record_id}Example Request
curl -X DELETE \
-H "Authorization: Bearer YOUR_API_KEY" \
https://api.0.link/api/domains/dom_abc123/dns/records/rec_005Example Response
{
"id": "rec_005",
"deleted": true
}Record Types
A Record
Maps a domain to an IPv4 address.
{
"type": "A",
"name": "@",
"content": "192.0.2.1",
"ttl": 3600
}AAAA Record
Maps a domain to an IPv6 address.
{
"type": "AAAA",
"name": "@",
"content": "2001:db8::1",
"ttl": 3600
}CNAME Record
Creates an alias pointing to another domain.
{
"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.
{
"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.
{
"type": "TXT",
"name": "@",
"content": "v=spf1 include:_spf.google.com ~all",
"ttl": 3600
}NS Record
Delegates a subdomain to different nameservers.
{
"type": "NS",
"name": "subdomain",
"content": "ns1.other-provider.com",
"ttl": 3600
}SRV Record
Specifies the location of services.
{
"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.
{
"type": "CAA",
"name": "@",
"content": "0 issue \"letsencrypt.org\"",
"ttl": 3600
}Common DNS Configurations
Basic Website Setup
# 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/recordsGoogle Workspace Email
# 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/recordsDomain Verification
# 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/recordsError Responses
Record Not Found
{
"error": {
"code": "RECORD_NOT_FOUND",
"message": "The specified DNS record was not found"
}
}Invalid Record Type
{
"error": {
"code": "INVALID_RECORD_TYPE",
"message": "Invalid DNS record type",
"details": "Supported types: A, AAAA, CNAME, MX, TXT, NS, SRV, CAA"
}
}Invalid Record Content
{
"error": {
"code": "INVALID_RECORD_CONTENT",
"message": "Invalid record content for type A",
"details": "Expected a valid IPv4 address"
}
}CNAME at Root
{
"error": {
"code": "CNAME_AT_ROOT",
"message": "CNAME records cannot be created at the root domain"
}
}Missing Priority
{
"error": {
"code": "MISSING_PRIORITY",
"message": "MX records require a priority value"
}
}Code Examples
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
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 Case | Recommended TTL | Notes |
|---|---|---|
| Static content | 86400 (24h) | Rarely changing records |
| Standard | 3600 (1h) | Default for most records |
| Dynamic content | 300 (5m) | Frequently changing records |
| Migration | 60 (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
- Domains API - Manage domain registration
- Authentication Guide - Learn about API authentication
- Rate Limiting - Understand API rate limits