API

Programmatically register domains, manage DNS, and let your app act on heynom domains via OAuth. Build integrations, automate workflows, and extend your domain management.

v1 · stable https://heynom.com/v1 60 req/min

Introduction

The heynom API gives you programmatic access to every action you can take in the dashboard — registering domains, managing DNS records and nameservers, updating WHOIS, and more. Two authentication options:

Both share the same scopes and the same per-domain binding model. You generally don't write per-token code differently — pick whichever credential model fits, send it as a Bearer token, and call the endpoints below.

Quickstart

Make your first API call in four steps.

1Create an API key

From your developer dashboard, click New Key, name it, pick the scopes you need (start with domains:read), and copy the secret. It's only shown once.

2List your domains
# Replace with your key
curl -H "Authorization: Bearer sk_live_your_api_key" \
  https://heynom.com/v1/domains
3Add a DNS record
curl -X POST https://heynom.com/v1/domains/example.com/dns \
  -H "Authorization: Bearer sk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"record_type":"A","name":"www","value":"1.2.3.4","ttl":3600}'
4Go further

Need to act on other users' domains? Build an OAuth app. Want a drop-in domain picker for your site? Use the embed widget.

Authentication

Every request needs a Bearer token in the Authorization header. Two formats:

# Personal API key — generate from the dashboard
Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxx

# OAuth access token — issued by the OAuth flow
Authorization: Bearer oat_live_xxxxxxxxxxxxxxxx
Both token types share the same scopes and the same per-domain binding. Pick what fits — your code doesn't need to care which one is sent.

Base URL

All endpoints are relative to:

https://heynom.com/v1

Response Format

Successful responses return JSON with a data key:

{ "data": { ... } }

Error responses look like:

{
  "error": {
    "code": "not_found",
    "message": "Domain not found"
  }
}

Rate Limits

API keys are limited to 60 requests per minute. Rate-limit info comes back in response headers:

HeaderDescription
X-RateLimit-LimitMax requests per window (60)
X-RateLimit-RemainingRemaining requests in current window

When throttled you'll get a 429. Wait, then retry.

Error Codes

StatusCodeDescription
400bad_requestInvalid request parameters
401unauthorizedMissing or invalid credentials
403forbiddenInsufficient scope permissions
404not_foundResource not found
429rate_limitedToo many requests
502registry_errorUpstream registry error

Domains

List Domains

GET /v1/domains domains:read

Returns all domains on your account.

// Response
{
  "data": [
    {
      "id": "abc123...",
      "domain_name": "example.com",
      "status": "active",
      "auto_renew": true,
      "locked": true,
      "expires_at": "2027-04-04T00:00:00Z",
      "nameservers": ["ns1.systemdns.com", "ns2.systemdns.com"]
    }
  ]
}

Get Domain

GET /v1/domains/:domain domains:read

Returns full detail for a single domain.

ParameterInDescription
:domainpathDomain name (URL-encoded)

Check Domain Availability

POST /v1/domains/check domains:read

Check if a domain is available for registration and fetch the price.

BodyTypeDescription
domainstringFull domain name, e.g. example.com
// Response
{
  "data": {
    "domain": "example.com",
    "available": true,
    "price": 12.99
  }
}

Check Transfer Eligibility

POST /v1/domains/transfer/check domains:read

Check if a domain is eligible for transfer to heynom.

BodyTypeDescription
domainstringFull domain name
// Response
{ "data": { "domain": "example.com", "transferable": true, "price": 11.99 } }

Set Transfer Lock

POST /v1/domains/:domain/lock domains:write

Enable or disable the transfer lock on a domain. Locked domains cannot be transferred away.

BodyTypeDescription
lockbooleantrue to lock, false to unlock

Toggle Auto-Renew

POST /v1/domains/:domain/auto-renew domains:write
BodyTypeDescription
auto_renewbooleantrue or false

DNS

List DNS Records

GET /v1/domains/:domain/dns dns:read

Returns all DNS records for the domain.

// Response
{
  "data": [
    { "id": "rec_123", "record_type": "A", "name": "@", "value": "1.2.3.4", "ttl": 3600 }
  ]
}

Create DNS Record

POST /v1/domains/:domain/dns dns:write
FieldTypeDescription
record_typereqstringA, AAAA, CNAME, MX, TXT, NS, SRV, CAA
namereqstringSubdomain or @ for root
valuereqstringRecord value
ttloptintegerTTL in seconds (60–86400, default 3600)
priorityoptintegerPriority for MX/SRV
// Request body
{ "record_type": "A", "name": "www", "value": "1.2.3.4", "ttl": 3600 }

Delete DNS Record

DELETE /v1/domains/:domain/dns/:id dns:write

Deletes a single DNS record by ID. Admin-locked records cannot be deleted.

Nameservers

Get Nameservers

GET /v1/domains/:domain/nameservers nameservers:read
// Response
{ "data": ["ns1.systemdns.com", "ns2.systemdns.com"] }

Update Nameservers

PUT /v1/domains/:domain/nameservers nameservers:write

Replace the nameservers for a domain. If the domain is transfer-locked, the lock is temporarily removed and re-applied automatically.

FieldTypeDescription
nameserversreqstring[]Array of nameserver hostnames (min 1)

WHOIS

Get WHOIS Contacts

GET /v1/domains/:domain/whois whois:read

Returns the WHOIS contact set (owner, admin, billing, tech) from the registry.

Update WHOIS Contacts

PUT /v1/domains/:domain/whois whois:write

Update WHOIS contacts. Provide a contact_set object with the contacts to update.

// Request body
{
  "contact_set": {
    "owner": {
      "first_name": "Jane",
      "last_name": "Doe",
      "email": "jane@example.com",
      "phone": "+1.5551234567",
      "address1": "123 Main St",
      "city": "Denver",
      "state": "CO",
      "postal_code": "80202",
      "country": "US"
    }
  }
}

Billing

List Payment Methods

GET /v1/account/payment-methods billing:read

Returns saved payment methods (cards) on the account — brand + last 4 only.

// Response
{
  "data": [
    { "id": "pm_123", "brand": "visa", "last4": "4242", "exp_month": 12, "exp_year": 2028, "is_default": 1 }
  ]
}

Embed Widget

The heynom embed lets your users connect their heynom domains to your app without leaving your site. It's an iframe you drop in — your users see their domains, click Connect, and your app receives an OAuth authorization code.

When to use the embed vs. a plain OAuth link: use the embed when you want users to see their domains in context (e.g. on your "Add domain" page). Use a plain OAuth link when you just need a "Connect heynom" button somewhere. Both flows end the same way — you receive an authorization_code at your registered redirect_uri.

Quickstart

Drop the helper script on your page and call heynom.embed():

<div id="heynom-connect"></div>
<script src="https://heynom.com/embed.js"></script>
<script>
  heynom.embed({
    element: '#heynom-connect',
    clientId: 'hn_app_xxxxxxxxxxxx',
    scope: ['dns:read', 'dns:write'],
    redirectUri: 'https://yoursite.com/oauth/callback',
    state: 'your_csrf_token',
    // Optional: restrict the register search to these TLDs
    tlds: ['com', 'io', 'dev'],
    onAuthorized: ({ code, state }) => {
      // Send code+state to your backend to exchange for tokens
    },
  });
</script>

Or write the iframe by hand:

<iframe
  src="https://heynom.com/embed?client_id=hn_app_xxx&scope=dns:read+dns:write
       &redirect_uri=https%3A%2F%2Fyoursite.com%2Foauth%2Fcallback&state=abc"
  style="width:100%;border:0;background:transparent;min-height:320px"></iframe>
Origin allowlist: Your site's origin must be listed under Embed origins in the OAuth app's settings, otherwise the iframe will refuse to render via Content-Security-Policy: frame-ancestors.

URL parameters

GET/embed
ParameterRequiredDescription
client_idYesYour OAuth app's hn_app_* identifier.
scopeYesSpace- or plus-separated list of scopes the OAuth flow will request.
redirect_uriYesWhere the OAuth flow returns the user. Must match a registered URI exactly.
stateRecommendedOpaque CSRF token; echoed back in the redirect.
targetNo_self (default) navigates the top window for OAuth. _blank opens a popup and postMessages the result back.
modeNoconnect (default), search, or both.
suggest_domainsNoComma-separated list pre-checked on the OAuth consent screen.
tldsNoComma-separated TLD allowlist for the register search (e.g. tlds=com,io,dev). When set, only these TLDs are searched. Leading dots are tolerated. Falls back to heynom's popular TLDs when omitted.
themeNotransparent (default), light, or dark.

postMessage events

The iframe posts these events to window.parent, origin-checked against your registered embed origins:

EventPayloadWhen
heynom:ready{ client_id }Iframe has loaded.
heynom:resize{ height }Iframe content height changed.
heynom:register_start{ domain }User clicked Register on a search result; checkout popup opening.
heynom:registered{ domain, order_id }Registration completed.
heynom:authorized{ code, state }Only with target=_blank: user authorized the app; exchange the code server-side.

With the JS helper, subscribe via onReady, onRegistered, onAuthorized, and onRegisterStart.

OAuth 2.0

OAuth lets your app act on a user's heynom domains without ever seeing their password or API key.

1Redirect to /oauth/authorize

Send the user to https://heynom.com/oauth/authorize?… with your client_id, scopes, and a redirect_uri.

2User picks domains and approves

They sign in (if needed), pick which of their domains your app may manage, and approve.

3Receive a code

heynom redirects them back to your redirect_uri with a one-time code.

4Exchange for tokens

Your server exchanges the code (plus a client secret or PKCE verifier) for an access token at POST /api/oauth/token.

5Call the API

Any /v1/* endpoint accepts Authorization: Bearer oat_live_….

App review. Until an admin approves your app, only the app's developer and listed testers can complete the authorize step. Other users see a "pending review" screen. Submit for review from the OAuth Apps section of your dashboard once you're happy with it.

Registering an app

Create an OAuth app from your developer dashboard → OAuth Apps → New OAuth App. You'll choose:

After creating, you'll see the client_id (always visible) and the client_secret (shown once; rotate it if lost).

Authorize URL

GET/oauth/authorize

Send the user here to start consent.

ParameterRequiredDescription
response_typeYesMust be code.
client_idYesYour app's identifier.
redirect_uriYesMust exactly match a registered redirect URI.
scopeYesSpace-separated scopes. Must be a subset of what the app is registered for.
stateRecommendedOpaque value echoed back unmodified.
code_challengeIf PKCEBase64url-encoded SHA-256 of your code_verifier.
code_challenge_methodIf PKCEMust be S256.
suggest_domainsNoComma-separated domain names to pre-check on the consent screen.

On success, the user is redirected to:

https://yoursite.com/callback?code=hn_code_xxx&state=abc

On denial:

https://yoursite.com/callback?error=access_denied&state=abc

Token exchange

POST/api/oauth/token

Exchange a one-time code for an access + refresh token. Accepts either application/json or application/x-www-form-urlencoded.

FieldRequiredDescription
grant_typeYesauthorization_code
codeYesThe code from the redirect.
redirect_uriYesMust match the value used in the authorize call.
client_idYesYour app's identifier.
client_secretIf non-PKCERequired when PKCE isn't being used. Send via body or HTTP Basic.
code_verifierIf PKCEThe original verifier whose SHA-256 produced your code_challenge.
// Successful response
{
  "access_token": "oat_live_...",
  "refresh_token": "ort_live_...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "dns:read dns:write"
}

Access tokens live 1 hour; refresh tokens live 30 days. Codes expire after 30 seconds and may be redeemed once.

Refreshing tokens

POST/api/oauth/token

Trade a refresh token for a fresh access token. The refresh token is rotated — the old value is invalidated.

// Request
{
  "grant_type": "refresh_token",
  "refresh_token": "ort_live_...",
  "client_id": "hn_app_...",
  "client_secret": "hn_sec_..."
}

PKCE example

PKCE removes the need for a client secret and is the right choice for browser SPAs, mobile apps, and CLIs.

// 1) Generate a verifier and challenge in the browser
async function sha256(text) {
  const data = new TextEncoder().encode(text);
  const digest = await crypto.subtle.digest('SHA-256', data);
  return btoa(String.fromCharCode(...new Uint8Array(digest)))
    .replace(/=+$/, '').replace(/\+/g, '-').replace(/\//g, '_');
}

const verifier = crypto.randomUUID() + crypto.randomUUID();
sessionStorage.setItem('pkce_verifier', verifier);
const challenge = await sha256(verifier);

// 2) Send the user to authorize with the challenge
location.href = `https://heynom.com/oauth/authorize?` + new URLSearchParams({
  response_type: 'code', client_id: 'hn_app_...',
  redirect_uri: 'https://yoursite.com/cb', scope: 'dns:read dns:write',
  state: 'csrf123', code_challenge: challenge, code_challenge_method: 'S256',
});

// 3) On the callback, exchange the code using the verifier
const res = await fetch('https://heynom.com/api/oauth/token', {
  method: 'POST', headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    grant_type: 'authorization_code',
    code: new URLSearchParams(location.search).get('code'),
    redirect_uri: 'https://yoursite.com/cb',
    client_id: 'hn_app_...',
    code_verifier: sessionStorage.getItem('pkce_verifier'),
  }),
});

Scopes reference

Scopes work the same for OAuth tokens and API keys. Grant only what you need.

ScopeWhat it allows
domains:readList and inspect domains
domains:writeToggle auto-renew, lock, etc.
dns:readList DNS records
dns:writeCreate / delete DNS records
nameservers:readRead nameservers
nameservers:writeReplace nameservers
whois:readRead WHOIS contacts
whois:writeUpdate WHOIS contacts
billing:readRead saved payment methods (brand + last 4)
domains:allSensitive. Grants access to the user's current and future domains, bypassing per-domain selection. Requires admin-approved status and an explicit user opt-in.

Domain binding

Unlike most OAuth implementations, heynom tokens are bound to a specific set of domains chosen by the user during consent. The token's effective permission is the cross-product of the requested scopes and the domains the user selected.

You can hint which domains to pre-select with suggest_domains=example.com,b.com. The user is in full control of the final list.

Calls against a domain the token isn't bound to return 404 not_found. If you need flexibility for users who add domains later, request domains:all — this requires admin approval and an explicit consent-screen toggle.

Revocation

POST/api/oauth/revoke

Invalidate an access or refresh token. Returns 200 whether or not the token existed.

// Body (JSON or form-encoded)
{ "token": "oat_live_..." }

Users can also revoke an app at any time from /dashboard/settings → Connected apps.

Code Examples

# List all domains
curl -H "Authorization: Bearer sk_live_your_key" \
  https://heynom.com/v1/domains

# Create a DNS record
curl -X POST https://heynom.com/v1/domains/example.com/dns \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"record_type":"A","name":"www","value":"1.2.3.4","ttl":3600}'

# Check domain availability
curl -X POST https://heynom.com/v1/domains/check \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"domain":"coolstartup.com"}'
const API_KEY = 'sk_live_your_key';
const BASE = 'https://heynom.com/v1';

async function heynom(path, options = {}) {
  const res = await fetch(BASE + path, {
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json',
      ...options.headers,
    },
    ...options,
  });
  return res.json();
}

// List domains
const { data } = await heynom('/domains');
console.log(data);

// Add DNS record
await heynom('/domains/example.com/dns', {
  method: 'POST',
  body: JSON.stringify({
    record_type: 'A', name: 'www',
    value: '1.2.3.4', ttl: 3600,
  }),
});
import requests

API_KEY = "sk_live_your_key"
BASE = "https://heynom.com/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}

# List domains
domains = requests.get(f"{BASE}/domains", headers=HEADERS).json()
print(domains["data"])

# Add DNS record
requests.post(
    f"{BASE}/domains/example.com/dns",
    headers=HEADERS,
    json={
        "record_type": "A",
        "name": "www",
        "value": "1.2.3.4",
        "ttl": 3600,
    },
)