API reference · Domains
Detect a domain's DNS provider
https://api.pidgely.com/domains/{id}/dns-providerFinds the DNS zone and provider of a domain so its records can be created automatically. When cloudflare is true, call Set up DNS with Cloudflare. When domain_connect is set, open its url in a browser: the provider applies only this domain's records after the user confirms. Otherwise publish the records from Retrieve a domain by hand.
Finds the DNS zone that holds the domain (NS lookups from the domain up to its registrable domain) and the provider that hosts it.
domain_connect is set when the provider supports Pidgely's Domain Connect template: open url (signed by Pidgely; it applies only this domain's records) and the provider creates the records after the user confirms, then redirects to /domains/connected/ on the dashboard. cloudflare is true when the zone is on Cloudflare, so the records can be written with an API token (POST .../dns-provider/cloudflare). Lookups are bounded (a few seconds at most). 30 requests per minute per organization.
Authorization: Bearer pdg_…. An API key with full_access. A sending_access key gets 401 restricted_api_key.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string | Yes | Resource id UUID. |
Request
This endpoint is in the Node.js SDK; the other SDKs don't cover it yet, so call it over HTTP from them.
import { Pidgely } from 'pidgely';
const pidgely = new Pidgely(process.env.PIDGELY_API_KEY);
const { data, error } = await pidgely.domains.dnsProvider('0199d7f0-1c2b-7e4d-a5f6-0b9c8d7e6f51');
console.log(data ?? error);curl -X GET 'https://api.pidgely.com/domains/0199d7f0-1c2b-7e4d-a5f6-0b9c8d7e6f51/dns-provider' \
-H "Authorization: Bearer $PIDGELY_API_KEY"Response
200 OK
{
"object": "dns_provider",
"zone": "acme.com",
"host": "send",
"nameservers": [
"ana.ns.cloudflare.com",
"bob.ns.cloudflare.com"
],
"provider": {
"id": "cloudflare",
"name": "Cloudflare"
},
"domain_connect": null,
"cloudflare": true
}Response fields
| Name | Type | Required | Description |
|---|---|---|---|
object |
string | Yes | Object type. One of dns_provider. |
zone |
string | Yes | DNS zone that holds the domain (e.g. acme.com for send.acme.com). |
host |
string | Yes | Labels of the domain below the zone (send; empty at the apex). |
nameservers |
string[] | Yes | — |
provider |
object | null | Yes | Recognised DNS provider, null when unknown. |
domain_connect |
object | null | Yes | Set when the provider supports Pidgely's Domain Connect template; null otherwise. |
cloudflare |
boolean | Yes | The zone is on Cloudflare; the records can be written with an API token. |
Errors
Errors have the shape {"statusCode", "name", "message"}. See Errors for the full list.
| Status | Name | When |
|---|---|---|
| 401 | missing_api_key, restricted_api_key |
No Authorization: Bearer header, or a sending_access key called an endpoint that needs full_access. |
| 403 | invalid_api_key, validation_error |
The API key is invalid or revoked, or the request is not allowed for this account (unverified domain, plan limit, paused account). |
| 404 | not_found |
The resource does not exist in this account (or the id is not a valid UUID). |
| 422 | validation_error |
A field is missing or invalid; message names it. |
| 429 | rate_limit_exceeded |
Too many requests per second. Wait for Retry-After seconds. |
| 429 | rate_limit_exceeded |
More than 30 detections per minute. |