Domain Basics

3.5k views Markdown

The thirteen endpoints behind a domain's nameservers, nameserver requests, transfer lock, auth code, ownership details and recovery.

Overview

These thirteen endpoints run a domain's basics. Where it points, whether it can be moved, who it appears to belong to, and whether it survives expiry.

Most of them make a real call to the registry. So they can be slow, they can hit the registry's own rules, and a module may not support an operation at all. Every such endpoint shares the same four preconditions. The service must exist, be a domain, have a registrar module attached, and that module must support the operation. Setting the nameservers on a domain with no registrar module updates only the WISECP record. The two nameserver request endpoints never call the registry: they handle the requests customers file on such domains.

Reference

Setting the Nameservers

put/api/v1/admin/services/{id}/domain/nameservers
Services/SetDomainNameservers admin goes to the registry

Writes which nameservers the domain points at.

Body 4
ns1stringrequiredThe primary nameserver. It has to be a valid host name.
ns2stringrequiredThe secondary nameserver.
ns3stringA third nameserver.
ns4stringA fourth nameserver.
Response fields data — 3
nameserversstring[]The nameservers written. Ones left empty are not in the list.
idintService id.
registrar_updatedboolWhether the change went to the registry. false means the domain has no registrar module and only the WISECP record was updated.
Errors 9
not_found404No such service.
not_domain422The service is not a domain.
no_module422A registrar module is set on the domain but cannot be loaded. A domain with no registrar module does not get this error.
not_supported422The module does not support this operation.
ns_required422One of the first two nameservers was empty.
ns_invalid422A nameserver is not a valid host name.
module_error422The registry refused the request; the message carries its reason.
module_failed500The registry could not be reached, or the operation failed without a reason.
insufficient_scope403The key lacks the required scope.
Request
curl -X PUT 'https://panel.example.com/api/v1/admin/services/520/domain/nameservers' \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"ns1":"ns1.example.com","ns2":"ns2.example.com"}'
const res = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/nameservers', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    ns1: 'ns1.example.com',
    ns2: 'ns2.example.com',
  }),
});

const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/nameservers');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'ns1' => 'ns1.example.com',
        'ns2' => 'ns2.example.com',
    ]),
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// The list is written WHOLE: leave ns3 and ns4 out and any existing ones are cleared.
$response = Api::Services()->SetDomainNameservers([
    'id'  => 520,
    'ns1' => 'ns1.example.com',
    'ns2' => 'ns2.example.com',
]);

Listing Nameserver Requests

get/api/v1/admin/services/{id}/domain/nameserver-requests
Services/GetDomainNameserverRequests admin waits for staff

Lists the open nameserver requests customers filed on the domain, newest first.

Response fields data — 2
idintService id.
requestsobject[]Open requests, newest first. The list is empty when there is none.
idintRequest id. Pass it to the approve endpoint.
nameserversstring[]The nameservers the customer asked for, in order.
previousstring[]The nameservers on the record before the request. It is empty for a request carried over from 3.x.
requested_atstringWhen the request was filed. Server time, as Y-m-d H:i:s.
Errors 3
not_found404No such service.
not_domain422The service is not a domain.
insufficient_scope403The key lacks the required scope.
Request
curl 'https://panel.example.com/api/v1/admin/services/520/domain/nameserver-requests' \
  -H "Authorization: Bearer $API_KEY"
const res  = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/nameserver-requests', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/nameserver-requests');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// Works on any domain service: the registrar module is not called.
$response = Api::Services()->GetDomainNameserverRequests(['id' => 520]);

Approving a Nameserver Request

post/api/v1/admin/services/{id}/domain/nameserver-requests/{request_id}/approve
Services/ApproveDomainNameserverRequest admin

Closes an open nameserver request once you have applied it at the registrar.

Body —
——No body is needed; send an empty one. The request is addressed by the service id and the request id in the path.
Response fields data — 3
idintService id.
request_idintThe approved request.
nameserversstring[]The approved nameservers. They were already on the domain record; approving does not change it.
Errors 4
not_found404No such service.
not_domain422The service is not a domain.
request_not_found404No open request with this id on this domain. It was already approved, or it belongs to another domain.
insufficient_scope403The key lacks the required scope.
Request
curl -X POST 'https://panel.example.com/api/v1/admin/services/520/domain/nameserver-requests/409594/approve' \
  -H "Authorization: Bearer $API_KEY"
const res = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/nameserver-requests/409594/approve', {
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}` },
});

const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/nameserver-requests/409594/approve');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// Make the change at the registrar FIRST: approving only closes the request.
$response = Api::Services()->ApproveDomainNameserverRequest([
    'id'         => 520,
    'request_id' => 409594,
]);

Reading the Transfer Lock

get/api/v1/admin/services/{id}/domain/transfer-lock
Services/GetDomainTransferLock admin

Returns whether the domain is locked against being moved to another registrar. On a domain with no registrar module the state comes from the WISECP record.

Response fields data — 2
transfer_lockstringThe lock state. From a registrar module the value comes raw and differs between registries. With no registrar module it is active (locked) or inactive (unlocked); a record with no lock state reads as locked.
liveboolWhether the state was read from the registry. false means the domain has no registrar module and the state comes from the WISECP record.
Errors 6
not_found404No such service.
not_domain422The service is not a domain.
no_module422A registrar module is set on the domain but cannot be loaded. A domain with no registrar module does not get this error.
not_supported422The module does not support this operation.
module_error422The registry refused the request; the message carries its reason.
module_failed500The registry could not be reached, or the operation failed without a reason.
insufficient_scope403The key lacks the required scope.
Request
curl 'https://panel.example.com/api/v1/admin/services/520/domain/transfer-lock' \
  -H "Authorization: Bearer $API_KEY"
const res  = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/transfer-lock', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/transfer-lock');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// Reading returns a RAW value while writing returns 'enabled'/'disabled': not the same vocabulary.
$response = Api::Services()->GetDomainTransferLock(['id' => 520]);

Changing the Transfer Lock

put/api/v1/admin/services/{id}/domain/transfer-lock
Services/SetDomainTransferLock admin

Locks the domain against being moved, or unlocks it. With no registrar module only the WISECP record changes.

Body 1
statusstringrequiredenable locks it, disable unlocks it.
Response fields data — 3
transfer_lockstringThe lock state afterwards: enabled or disabled.
idintService id.
registrar_updatedboolWhether the change went to the registry. false means the domain has no registrar module and only the WISECP record was updated.
Errors 7
not_found404No such service.
not_domain422The service is not a domain.
no_module422A registrar module is set on the domain but cannot be loaded. A domain with no registrar module does not get this error.
not_supported422The module does not support this operation.
invalid_status422The status is neither enable nor disable.
module_error422The registry refused the request; the message carries its reason.
module_failed500The registry could not be reached, or the operation failed without a reason.
insufficient_scope403The key lacks the required scope.
Request
curl -X PUT 'https://panel.example.com/api/v1/admin/services/520/domain/transfer-lock' \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"status":"enable"}'
const res = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/transfer-lock', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ status: 'enable' }),
});

const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/transfer-lock');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(['status' => 'enable']),
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// While the lock is ON the domain cannot move: unlock it before the client leaves for another registrar.
Api::Services()->SetDomainTransferLock(['id' => 520, 'status' => 'disable']);
$code = Api::Services()->GetDomainAuthCode(['id' => 520]);

Getting the Authorization Code

get/api/v1/admin/services/{id}/domain/auth-code
Services/GetDomainAuthCode admin may go by e-mail

Asks for the code needed to move the domain to another registrar. A domain with no registrar module has no code to read, so the request fails with auth_code_moduleless. Send that domain's code with the endpoint below.

Response fields data — 2
auth_codestringThe authorization code. Present only when the module hands it over directly.
sentboolThe code was e-mailed to the registrant. In that case the code itself is not in the response.
Errors 8
not_found404No such service.
not_domain422The service is not a domain.
no_module422A registrar module is set on the domain but cannot be loaded. A domain with no registrar module does not get this error.
auth_code_moduleless422The domain has no registrar module, so there is no code to read. details.pending_request is the customer's open code request (id, requested_at) or null.
not_supported422The module does not support this operation.
auth_code_rejected422A gate:domain.epp_code_get listener stopped the read; the message carries its reason.
module_error422The registry refused the request; the message carries its reason.
module_failed500The registry could not be reached, or the operation failed without a reason.
insufficient_scope403The key lacks the required scope.
Request
curl 'https://panel.example.com/api/v1/admin/services/520/domain/auth-code' \
  -H "Authorization: Bearer $API_KEY"
const res  = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/auth-code', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();

if (body.data.sent) {
  // it went by e-mail, the code is not here
}
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/auth-code');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// There are two response shapes; do NOT assume the code arrived.
$response = Api::Services()->GetDomainAuthCode(['id' => 520])['data'];

$code = $response['auth_code'] ?? null;
$mailed = $response['sent'] ?? false;
Response
{
  "data": {
    "auth_code": "EXAMPLE-AUTH-CODE"
  }
}
{
  "data": {
    "sent": true
  }
}
{
  "error": {
    "code": "auth_code_moduleless",
    "message": "This domain has no registrar module. Send the code you got from the registrar with POST /services/520/domain/auth-code/send.",
    "details": {
      "pending_request": {
        "id": 8814,
        "requested_at": "2026-11-28 09:46:13"
      }
    }
  }
}

Sending the Auth Code to the Customer

post/api/v1/admin/services/{id}/domain/auth-code/send
Services/SendDomainAuthCode admin a real e-mail goes out

For a domain with no registrar module: emails the code you got from the registrar to the customer. The customer's open code requests are approved, and WISECP does not store the code.

Body 1
auth_codestringrequiredThe code you got from the registrar. At most 255 characters, with no control characters. Leading and trailing spaces are trimmed.
Response fields data — 3
sentboolAlways true: the code was emailed to the customer.
idintService id.
approved_requestsintOpen code requests of the customer that this send approved. 0 when there was none.
Errors 7
not_found404No such service.
not_domain422The service is not a domain.
auth_code_module_linked422A registrar module, or a provider for the auth code, answers for the domain. Read the code with the GET auth-code endpoint.
auth_code_required422auth_code is empty.
invalid_auth_code422auth_code is not a string, is longer than 255 characters or carries control characters.
auth_code_rejected422A gate:domain.epp_code_get listener stopped the send; the message carries its reason.
auth_code_not_delivered500The e-mail to the customer could not be delivered; the message carries the reason. No request is approved.
insufficient_scope403The key lacks the required scope.
Request
curl -X POST 'https://panel.example.com/api/v1/admin/services/520/domain/auth-code/send' \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"auth_code":"EXAMPLE-AUTH-CODE"}'
const res = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/auth-code/send', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ auth_code: 'EXAMPLE-AUTH-CODE' }),
});

const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/auth-code/send');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(['auth_code' => 'EXAMPLE-AUTH-CODE']),
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// Only for a domain with no registrar module; a linked module answers auth_code_module_linked.
$response = Api::Services()->SendDomainAuthCode(['id' => 520, 'auth_code' => 'EXAMPLE-AUTH-CODE'])['data'];

$approved = $response['approved_requests'];
Response
{
  "data": {
    "sent": true,
    "id": 520,
    "approved_requests": 1
  }
}
{
  "error": {
    "code": "auth_code_module_linked",
    "message": "This domain is linked to a registrar module. Read the code with GET /services/520/domain/auth-code."
  }
}

Restoring the Domain

post/api/v1/admin/services/{id}/domain/restore
Services/RestoreDomain admin time-bound

Recovers an expired domain. It only works while the recovery window is open.

Body —
——No body is needed; send an empty one. The domain is addressed by the service id in the path.
Response fields data — 2
restoredboolWhether the recovery succeeded.
idintService id.
Errors 7
not_found404No such service.
not_domain422The service is not a domain.
no_module422No registrar module is attached.
not_supported422The module does not support this operation.
not_in_window422The domain is not in the recovery window. Once it closes the domain may have been released.
module_error422The registry refused the request; the message carries its reason.
module_failed500The registry could not be reached, or the operation failed without a reason.
insufficient_scope403The key lacks the required scope.
Request
curl -X POST 'https://panel.example.com/api/v1/admin/services/520/domain/restore' \
  -H "Authorization: Bearer $API_KEY"
const res = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/restore', {
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}` },
});

const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/restore');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// Recovery costs a FEE at the registry, and it has to be called before the window closes.
$response = Api::Services()->RestoreDomain(['id' => 520]);

Checking a Transfer

post/api/v1/admin/services/{id}/domain/check-transfer
Services/CheckDomainTransfer admin

Asks the registry where a domain transfer in progress has got to.

Body —
——No body is needed; send an empty one. The transfer is addressed by the service id in the path.
Response fields data — 2
transfer_statusstringThe transfer status. A service that is not a transfer comes back with the error value.
messagestring | nullAn explanation from the registry.
Errors 6
not_found404No such service.
not_domain422The service is not a domain.
no_module422No registrar module is attached.
not_supported422The module does not support this operation.
module_error422The registry refused the request; the message carries its reason.
module_failed500The registry could not be reached, or the operation failed without a reason.
insufficient_scope403The key lacks the required scope.
Request
curl -X POST 'https://panel.example.com/api/v1/admin/services/520/domain/check-transfer' \
  -H "Authorization: Bearer $API_KEY"
const res = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/check-transfer', {
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}` },
});

const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/check-transfer');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// The error state comes back inside a 200, not as an HTTP error: read the status before assuming success.
$check = Api::Services()->CheckDomainTransfer(['id' => 520])['data'];

$stuck = $check['transfer_status'] === 'error';

Checking a Registration

post/api/v1/admin/services/{id}/domain/check-registration
Services/CheckDomainRegistration admin

Asks the registry whether a registration it queued has completed.

Some registries accept a new registration and report the result later. Until then the service stays inprocess and its page shows a "registration in progress" banner. The domain.registration automation task runs the same check every 15 minutes, then once a day after three days.

Body —
——No body is needed; send an empty one. The registration is addressed by the service id in the path.
Response fields data — 3
registration_statusstringactive, pending or failed. On active the service and its add-ons are activated, the due date comes from the registry's expiry date and the client is notified. On failed the pending request is closed and staff are notified.
messagestring | nullThe registry's status text while pending, the refusal reason when failed.
service_statusstringThe service status after the check. active once activated, inprocess while pending.
Errors 7
not_found404No such service.
not_domain422The service is not a domain.
is_transfer422The domain was ordered as a transfer. Use the transfer check above.
not_supported422The registrar module cannot report registration results.
not_pending422No registration is pending for this domain.
module_error422The registry refused the request; the message carries its reason.
module_failed500The registry could not be reached, or the operation failed without a reason.
insufficient_scope403The key lacks the required scope.
Request
curl -X POST 'https://panel.example.com/api/v1/admin/services/520/domain/check-registration' \
  -H "Authorization: Bearer $API_KEY"
const res = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/check-registration', {
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}` },
});

const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/check-registration');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// A refused registration comes back inside a 200: read registration_status, not only the HTTP code.
$check = Api::Services()->CheckDomainRegistration(['id' => 520])['data'];

$refused = $check['registration_status'] === 'failed';

Reading the WHOIS Contacts

get/api/v1/admin/services/{id}/domain/whois
Services/GetDomainWhois admin four contacts

Fetches the domain's contact details from the registry. With no registrar module the stored contacts come back and meta.live is false.

Response fields data — 4 · meta — 1
registrantobjectThe registrant's contact. This is who legally holds the domain.
first_namestringFirst name.
last_namestringLast name.
companystringCompany name.
emailstringE-mail address.
phonestringPhone number.
phone_ccstringCountry code for the phone.
faxstringFax number.
fax_ccstringCountry code for the fax.
address_line1stringFirst line of the address.
address_line2stringSecond line of the address.
citystringCity.
statestringState or region.
zipcodestringPostcode.
countrystringCountry. The two-letter ISO code.
administrativeobjectThe administrative contact.
first_namestringFirst name.
last_namestringLast name.
companystringCompany name.
emailstringE-mail address.
phonestringPhone number.
phone_ccstringCountry code for the phone.
faxstringFax number.
fax_ccstringCountry code for the fax.
address_line1stringFirst line of the address.
address_line2stringSecond line of the address.
citystringCity.
statestringState or region.
zipcodestringPostcode.
countrystringCountry. The two-letter ISO code.
technicalobjectThe technical contact.
first_namestringFirst name.
last_namestringLast name.
companystringCompany name.
emailstringE-mail address.
phonestringPhone number.
phone_ccstringCountry code for the phone.
faxstringFax number.
fax_ccstringCountry code for the fax.
address_line1stringFirst line of the address.
address_line2stringSecond line of the address.
citystringCity.
statestringState or region.
zipcodestringPostcode.
countrystringCountry. The two-letter ISO code.
billingobjectThe billing contact.
first_namestringFirst name.
last_namestringLast name.
companystringCompany name.
emailstringE-mail address.
phonestringPhone number.
phone_ccstringCountry code for the phone.
faxstringFax number.
fax_ccstringCountry code for the fax.
address_line1stringFirst line of the address.
address_line2stringSecond line of the address.
citystringCity.
statestringState or region.
zipcodestringPostcode.
countrystringCountry. The two-letter ISO code.
meta.livebooltrue when the contacts were read from the registry and the stored copy refreshed. false on a domain with no registrar module: the stored contacts come back.
Errors 7
not_found404No such service.
not_domain422The service is not a domain.
no_module422A registrar module is set on the domain but cannot be loaded. A domain with no registrar module does not get this error.
blocked_by_gate422A hook refused the read. The message carries its reason.
not_supported422The module does not support this operation.
module_error422The registry refused the request; the message carries its reason.
module_failed500The registry could not be reached, or the operation failed without a reason.
insufficient_scope403The key lacks the required scope.
Request
curl 'https://panel.example.com/api/v1/admin/services/520/domain/whois' \
  -H "Authorization: Bearer $API_KEY"
const res  = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/whois', {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/whois');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer ' . $apiKey],
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// The read goes to the registry and refreshes the local copy too, so it can be slow.
$whois = Api::Services()->GetDomainWhois(['id' => 520])['data'];
$owner = $whois['registrant'];
Response
{
  "data": {
    "registrant": {
      "first_name": "John",
      "last_name": "Doe",
      "company": "",
      "email": "[email protected]",
      "phone": "5550100",
      "phone_cc": "+1",
      "fax": "",
      "fax_cc": "",
      "address_line1": "123 Market Street",
      "address_line2": "",
      "city": "San Francisco",
      "state": "California",
      "zipcode": "94105",
      "country": "US"
    },
    "administrative": { "first_name": "John", "last_name": "Doe", "email": "[email protected]" },
    "technical": { "first_name": "John", "last_name": "Doe", "email": "[email protected]" },
    "billing": { "first_name": "John", "last_name": "Doe", "email": "[email protected]" }
  }
}

Writing the WHOIS Contacts

put/api/v1/admin/services/{id}/domain/whois
Services/SetDomainWhois admin ownership is affected

Writes the contact details to the registry. With no registrar module only the WISECP record changes.

Body 4
registrantobjectThe registrant's contact. This is who legally holds the domain.
first_namestringFirst name.
last_namestringLast name.
companystringCompany name.
emailstringE-mail address.
phonestringPhone number.
phone_ccstringCountry code for the phone.
faxstringFax number.
fax_ccstringCountry code for the fax.
address_line1stringFirst line of the address.
address_line2stringSecond line of the address.
citystringCity.
statestringState or region.
zipcodestringPostcode.
countrystringCountry. The two-letter ISO code.
administrativeobjectThe administrative contact.
first_namestringFirst name.
last_namestringLast name.
companystringCompany name.
emailstringE-mail address.
phonestringPhone number.
phone_ccstringCountry code for the phone.
faxstringFax number.
fax_ccstringCountry code for the fax.
address_line1stringFirst line of the address.
address_line2stringSecond line of the address.
citystringCity.
statestringState or region.
zipcodestringPostcode.
countrystringCountry. The two-letter ISO code.
technicalobjectThe technical contact.
first_namestringFirst name.
last_namestringLast name.
companystringCompany name.
emailstringE-mail address.
phonestringPhone number.
phone_ccstringCountry code for the phone.
faxstringFax number.
fax_ccstringCountry code for the fax.
address_line1stringFirst line of the address.
address_line2stringSecond line of the address.
citystringCity.
statestringState or region.
zipcodestringPostcode.
countrystringCountry. The two-letter ISO code.
billingobjectThe billing contact.
first_namestringFirst name.
last_namestringLast name.
companystringCompany name.
emailstringE-mail address.
phonestringPhone number.
phone_ccstringCountry code for the phone.
faxstringFax number.
fax_ccstringCountry code for the fax.
address_line1stringFirst line of the address.
address_line2stringSecond line of the address.
citystringCity.
statestringState or region.
zipcodestringPostcode.
countrystringCountry. The two-letter ISO code.
Response fields data — 2
savedboolAlways true: the contacts are on the WISECP record.
registrar_updatedboolWhether the change went to the registry. false means only the WISECP record was updated. That happens with no registrar module, or before the domain is registered.
Errors 7
not_found404No such service.
not_domain422The service is not a domain.
blocked_by_gate422A hook refused the save. Nothing is written then.
no_module422A registrar module is set on the domain but cannot be loaded. A domain with no registrar module does not get this error.
not_supported422The module does not support this operation.
module_error422The registry refused the request; the message carries its reason.
module_failed500The registry could not be reached, or the operation failed without a reason.
insufficient_scope403The key lacks the required scope.
Request
curl -X PUT 'https://panel.example.com/api/v1/admin/services/520/domain/whois' \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"registrant":{"first_name":"John","last_name":"Doe","email":"[email protected]","phone":"5550100","phone_cc":"+1","address_line1":"123 Market Street","city":"San Francisco","state":"California","zipcode":"94105","country":"US"}}'
const res = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/whois', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    registrant: {
      first_name: 'John',
      last_name: 'Doe',
      email: '[email protected]',
      phone: '5550100',
      phone_cc: '+1',
      address_line1: '123 Market Street',
      city: 'San Francisco',
      state: 'California',
      zipcode: '94105',
      country: 'US',
    },
  }),
});

const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/whois');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'registrant' => [
            'first_name'    => 'John',
            'last_name'     => 'Doe',
            'email'         => '[email protected]',
            'address_line1' => '123 Market Street',
            'city'          => 'San Francisco',
            'country'       => 'US',
        ],
    ]),
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// Read first and write on top: fields left out can end up empty at the registry.
$whois = Api::Services()->GetDomainWhois(['id' => 520])['data'];

$whois['registrant']['email'] = '[email protected]';

Api::Services()->SetDomainWhois(['id' => 520] + $whois);

Changing WHOIS Privacy

put/api/v1/admin/services/{id}/domain/whois-privacy
Services/SetDomainWhoisPrivacy admin

Turns on or off the hiding of contact details in public lookups. With no registrar module only the WISECP record changes.

Body 1
statusstringrequiredenable hides them, disable reveals them.
Response fields data — 2
whois_privacystringThe privacy state afterwards. Either enabled or disabled.
registrar_updatedboolWhether the change went to the registry. false means the domain has no registrar module and only the WISECP record was updated.
Errors 7
not_found404No such service.
not_domain422The service is not a domain.
no_module422A registrar module is set on the domain but cannot be loaded. A domain with no registrar module does not get this error.
not_supported422The module does not support this operation.
invalid_status422The status is neither enable nor disable.
module_error422The registry refused the request; the message carries its reason.
module_failed500The registry could not be reached, or the operation failed without a reason.
insufficient_scope403The key lacks the required scope.
Request
curl -X PUT 'https://panel.example.com/api/v1/admin/services/520/domain/whois-privacy' \
  -H "Authorization: Bearer $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"status":"enable"}'
const res = await fetch('https://panel.example.com/api/v1/admin/services/520/domain/whois-privacy', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ status: 'enable' }),
});

const body = await res.json();
$ch = curl_init('https://panel.example.com/api/v1/admin/services/520/domain/whois-privacy');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(['status' => 'enable']),
]);

$body = json_decode(curl_exec($ch), true);
curl_close($ch);
// On most extensions privacy is a PAID add-on, so turning it on can raise an invoice.
$response = Api::Services()->SetDomainWhoisPrivacy([
    'id'     => 520,
    'status' => 'enable',
]);

Pitfalls

The authorization code has two response shapes

Some registries hand the code over directly while others e-mail it to the registrant. In the second case the response says only that it was sent and carries no code. A client that assumes the code arrived reads an empty value here.

The nameserver list is written whole

What you send becomes the truth: leave the third and fourth out and any existing ones are cleared. Even to change only the primary, the others have to go with it.

Without a registrar module only the record changes

On a domain with no registrar module the nameserver call still answers 200, but registrar_updated is false: the domain keeps pointing where it did until the same change is made at the registrar. A client that checks only the status code assumes the domain already points to the new nameservers.

Approving a request does not reach the registrar

The requested nameservers are already on the domain record, and approving does not call the registrar. Make the change at the registrar first, then approve. The call closes the request, logs it and fires action:domain.nameservers_saved.

Changing the registrant changes ownership

The WHOIS write is more than updating contact details: the registrant field decides who legally holds the domain. On most extensions that change starts an approval process and locks the domain out of transfers for a while. Fields left out can also end up empty at the registry, so read first and write on top.

The recovery window closes

An expired domain first passes through a period where it can be recovered, then it is released. Once the window closes this endpoint answers not_in_window and there is nothing left to do. Recovery also tends to cost a steep fee at the registry.

The transfer check returns its error inside a 200

A service that is not a transfer, or a transfer that is stuck, shows up in the status field of the response rather than as an HTTP error. A client reading only the status code counts a failed transfer as a success.

Not every module reports a queued registration

The registration check needs a module that implements registration_sync(); others answer not_supported. With those, activate the service yourself once the name is registered at the registry. After a refusal, activating the service sends a new registration.

Was this helpful?

Thanks for your feedback!

Still Need Help?

The support team is here around the clock for anything you can't find in the knowledge base.