Domains API
The Domains API allows you to register, manage, and configure domain names through 0.link. This includes domain registration, nameserver configuration, contact management, and domain lifecycle operations.
Base URL
https://api.0.link/api/domainsAuthentication
All Domains API endpoints require authentication. Include your API key in the Authorization header:
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.0.link/api/domainsEndpoints
| Method | Endpoint | Description | Required Scope |
|---|---|---|---|
| GET | /domains | List all domains | READ |
| POST | /domains | Register a new domain | WRITE |
| GET | /domains/{id} | Get domain by ID | READ |
| GET | /domains/by-name/{name} | Get domain by name | READ |
| POST | /domains/search | Search available domains | READ |
| POST | /domains/quote | Get pricing for domains | READ |
| PUT | /domains/{id}/nameservers | Update nameservers | WRITE |
| PUT | /domains/{id}/contacts | Update contacts | WRITE |
| PUT | /domains/{id}/autorenew | Update auto-renew setting | WRITE |
| PUT | /domains/{id}/transfer-lock | Update transfer lock | WRITE |
| POST | /domains/{id}/auth-code | Generate auth code | WRITE |
| POST | /domains/{id}/renew | Renew domain | WRITE |
List Domains
Get a list of all domains in your account.
GET /api/domainsExample Request
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.0.link/api/domainsExample Response
[
{
"id": "dom_abc123",
"name": "example.com",
"status": "active",
"expires_at": "2026-01-15T00:00:00Z",
"auto_renew": true,
"transfer_locked": true,
"nameservers": [
"ns1.0.link",
"ns2.0.link"
],
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": "dom_def456",
"name": "mysite.io",
"status": "active",
"expires_at": "2025-06-20T00:00:00Z",
"auto_renew": false,
"transfer_locked": true,
"nameservers": [
"ns1.0.link",
"ns2.0.link"
],
"created_at": "2024-06-20T14:00:00Z"
}
]Register Domain
Register a new domain name.
POST /api/domainsRequest Body
{
"name": "example.com",
"years": 1,
"contacts": {
"registrant": {
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"phone": "+1.5551234567",
"address": {
"street": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94102",
"country": "US"
}
}
},
"nameservers": [
"ns1.0.link",
"ns2.0.link"
],
"auto_renew": true
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Domain name to register |
years | integer | No | Registration period (1-10, default: 1) |
contacts | object | Yes | Contact information |
contacts.registrant | object | Yes | Registrant contact details |
nameservers | array | No | Custom nameservers (default: 0.link nameservers) |
auto_renew | boolean | No | Enable auto-renewal (default: true) |
Example Request
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "example.com",
"years": 1,
"contacts": {
"registrant": {
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"phone": "+1.5551234567",
"address": {
"street": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94102",
"country": "US"
}
}
}
}' \
https://api.0.link/api/domainsExample Response
{
"id": "dom_xyz789",
"name": "example.com",
"status": "pending",
"expires_at": "2027-01-20T00:00:00Z",
"auto_renew": true,
"transfer_locked": true,
"nameservers": [
"ns1.0.link",
"ns2.0.link"
],
"contacts": {
"registrant": {
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]"
}
},
"created_at": "2026-01-20T10:30:00Z"
}Get Domain by ID
Retrieve details for a specific domain by its ID.
GET /api/domains/{id}Example Request
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.0.link/api/domains/dom_abc123Example Response
{
"id": "dom_abc123",
"name": "example.com",
"status": "active",
"expires_at": "2026-01-15T00:00:00Z",
"auto_renew": true,
"transfer_locked": true,
"nameservers": [
"ns1.0.link",
"ns2.0.link"
],
"contacts": {
"registrant": {
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"phone": "+1.5551234567",
"organization": "Example Inc",
"address": {
"street": "123 Main St",
"city": "San Francisco",
"state": "CA",
"postal_code": "94102",
"country": "US"
}
}
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-06-01T08:00:00Z"
}Get Domain by Name
Retrieve details for a specific domain by its name.
GET /api/domains/by-name/{name}Example Request
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.0.link/api/domains/by-name/example.comExample Response
Same as Get Domain by ID.
Search Domains
Search for available domain names.
POST /api/domains/searchRequest Body
{
"query": "example",
"tlds": ["com", "io", "net", "org"]
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Domain name to search (without TLD) |
tlds | array | No | TLDs to check (default: popular TLDs) |
Example Request
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "myawesomesite",
"tlds": ["com", "io", "net"]
}' \
https://api.0.link/api/domains/searchExample Response
{
"results": [
{
"name": "myawesomesite.com",
"available": true,
"price": {
"registration": 12.99,
"renewal": 14.99,
"currency": "USD"
}
},
{
"name": "myawesomesite.io",
"available": true,
"price": {
"registration": 39.99,
"renewal": 39.99,
"currency": "USD"
}
},
{
"name": "myawesomesite.net",
"available": false,
"price": null
}
]
}Get Domain Quote
Get pricing information for one or more domains.
POST /api/domains/quoteRequest Body
{
"domains": [
{ "name": "example.com", "years": 1 },
{ "name": "example.io", "years": 2 }
]
}Example Request
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"domains": [
{ "name": "example.com", "years": 1 },
{ "name": "example.io", "years": 2 }
]
}' \
https://api.0.link/api/domains/quoteExample Response
{
"quotes": [
{
"name": "example.com",
"years": 1,
"available": true,
"price": {
"registration": 12.99,
"total": 12.99,
"currency": "USD"
}
},
{
"name": "example.io",
"years": 2,
"available": true,
"price": {
"registration": 39.99,
"total": 79.98,
"currency": "USD"
}
}
],
"total": {
"amount": 92.97,
"currency": "USD"
}
}Update Nameservers
Update the nameservers for a domain.
PUT /api/domains/{id}/nameserversRequest Body
{
"nameservers": [
"ns1.example.com",
"ns2.example.com"
]
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
nameservers | array | Yes | List of nameserver hostnames (2-13) |
Example Request
curl -X PUT \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"nameservers": [
"ns1.cloudflare.com",
"ns2.cloudflare.com"
]
}' \
https://api.0.link/api/domains/dom_abc123/nameserversExample Response
{
"id": "dom_abc123",
"name": "example.com",
"nameservers": [
"ns1.cloudflare.com",
"ns2.cloudflare.com"
],
"updated_at": "2026-01-20T10:30:00Z"
}Update Contacts
Update the contact information for a domain.
PUT /api/domains/{id}/contactsRequest Body
{
"registrant": {
"first_name": "Jane",
"last_name": "Smith",
"email": "[email protected]",
"phone": "+1.5559876543",
"address": {
"street": "456 Oak Ave",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
}
}
}Example Request
curl -X PUT \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"registrant": {
"first_name": "Jane",
"last_name": "Smith",
"email": "[email protected]",
"phone": "+1.5559876543",
"address": {
"street": "456 Oak Ave",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
}
}
}' \
https://api.0.link/api/domains/dom_abc123/contactsExample Response
{
"id": "dom_abc123",
"name": "example.com",
"contacts": {
"registrant": {
"first_name": "Jane",
"last_name": "Smith",
"email": "[email protected]"
}
},
"updated_at": "2026-01-20T10:30:00Z"
}Update Auto-Renew
Enable or disable automatic renewal for a domain.
PUT /api/domains/{id}/autorenewRequest Body
{
"auto_renew": true
}Example Request
curl -X PUT \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"auto_renew": true}' \
https://api.0.link/api/domains/dom_abc123/autorenewExample Response
{
"id": "dom_abc123",
"name": "example.com",
"auto_renew": true,
"updated_at": "2026-01-20T10:30:00Z"
}Update Transfer Lock
Enable or disable the transfer lock for a domain.
PUT /api/domains/{id}/transfer-lockRequest Body
{
"transfer_locked": true
}TIP
Transfer lock prevents unauthorized domain transfers. It's recommended to keep this enabled unless you're actively transferring the domain.
Example Request
curl -X PUT \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"transfer_locked": false}' \
https://api.0.link/api/domains/dom_abc123/transfer-lockExample Response
{
"id": "dom_abc123",
"name": "example.com",
"transfer_locked": false,
"updated_at": "2026-01-20T10:30:00Z"
}Generate Auth Code
Generate an authorization code for domain transfer.
POST /api/domains/{id}/auth-codeWARNING
Auth codes are sensitive. They allow the domain to be transferred to another registrar. Only generate an auth code when you intend to transfer the domain.
Example Request
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
https://api.0.link/api/domains/dom_abc123/auth-codeExample Response
{
"id": "dom_abc123",
"name": "example.com",
"auth_code": "X9kP2mN7qR4s",
"expires_at": "2026-01-27T10:30:00Z"
}Renew Domain
Renew a domain for additional years.
POST /api/domains/{id}/renewRequest Body
{
"years": 1
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
years | integer | No | Renewal period (1-10, default: 1) |
Example Request
curl -X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"years": 2}' \
https://api.0.link/api/domains/dom_abc123/renewExample Response
{
"id": "dom_abc123",
"name": "example.com",
"status": "active",
"expires_at": "2028-01-15T00:00:00Z",
"renewal": {
"years": 2,
"price": 25.98,
"currency": "USD"
},
"updated_at": "2026-01-20T10:30:00Z"
}Domain Statuses
| Status | Description |
|---|---|
pending | Domain registration is being processed |
active | Domain is registered and active |
expired | Domain has expired |
redemption | Domain is in redemption period |
pending_delete | Domain is pending deletion |
transferred_out | Domain was transferred to another registrar |
Error Responses
Domain Not Found
{
"error": {
"code": "DOMAIN_NOT_FOUND",
"message": "The specified domain was not found"
}
}Domain Unavailable
{
"error": {
"code": "DOMAIN_UNAVAILABLE",
"message": "This domain is not available for registration"
}
}Invalid Nameservers
{
"error": {
"code": "INVALID_NAMESERVERS",
"message": "Invalid nameserver configuration",
"details": "At least 2 nameservers are required"
}
}Insufficient Scope
{
"error": {
"code": "INSUFFICIENT_SCOPE",
"message": "This action requires WRITE scope"
}
}Code Examples
JavaScript
// List all domains
const domains = await fetch('https://api.0.link/api/domains', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}).then(res => res.json());
// Register a new domain
const newDomain = await fetch('https://api.0.link/api/domains', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'example.com',
years: 1,
contacts: {
registrant: {
first_name: 'John',
last_name: 'Doe',
email: '[email protected]',
phone: '+1.5551234567',
address: {
street: '123 Main St',
city: 'San Francisco',
state: 'CA',
postal_code: '94102',
country: 'US'
}
}
}
})
}).then(res => res.json());
// Update nameservers
await fetch('https://api.0.link/api/domains/dom_abc123/nameservers', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
nameservers: ['ns1.cloudflare.com', 'ns2.cloudflare.com']
})
});Python
import requests
API_KEY = 'YOUR_API_KEY'
BASE_URL = 'https://api.0.link/api'
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
# List all domains
domains = requests.get(f'{BASE_URL}/domains', headers=headers).json()
# Register a new domain
new_domain = requests.post(
f'{BASE_URL}/domains',
headers=headers,
json={
'name': 'example.com',
'years': 1,
'contacts': {
'registrant': {
'first_name': 'John',
'last_name': 'Doe',
'email': '[email protected]',
'phone': '+1.5551234567',
'address': {
'street': '123 Main St',
'city': 'San Francisco',
'state': 'CA',
'postal_code': '94102',
'country': 'US'
}
}
}
}
).json()
# Update nameservers
requests.put(
f'{BASE_URL}/domains/dom_abc123/nameservers',
headers=headers,
json={
'nameservers': ['ns1.cloudflare.com', 'ns2.cloudflare.com']
}
)Next Steps
- DNS Records API - Manage DNS records for your domains
- Authentication Guide - Learn about API authentication
- Rate Limiting - Understand API rate limits