Exchange an enrollment code for a node token (node side).
const url = 'https://api.opdns.io/v1/nodes/enrol';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"enrol_token":"example","name":"example","versions":{"edge":"example","unbound":"example","lists":1,"profile":1,"schema":1},"profile":{"schema":1,"schema_minor":1,"id":"example","version":1,"name":"example","deleted":true,"lists":[1],"deny":[{"pattern":"example"}],"allow":[{"pattern":"example"}],"rewrites":[{"name":"example","type":"example","value":"example"}],"security":{"rebinding":true,"idn_homograph":true,"typosquat":true,"nrd":true,"dga":true,"cryptojacking":true,"threat_intel":true,"csam":true},"parental":{"categories":["example"],"services":["example"],"safe_search":true,"youtube_restricted":true,"schedules":[{"name":"example","enabled":true,"mode":"allow_during","categories":["example"],"services":["example"],"windows":[{"day":"mon","start":"20:00","end":"07:00","end_day":"mon"}]}]},"settings":{"block_mode":"nxdomain","block_page_show_name":false,"logs_enabled":true,"log_client_ip":true,"log_domains":true,"log_destination":"cloud","retention_days":1,"cname_uncloak":true,"cache_boost_ttl":1,"ecs":"off","web3":false,"node_queue_hours":0,"log_region":"ca","protection":{"ads_trackers":1,"malware_phishing":1,"scams_abuse":1},"timezone":"America/Toronto"},"linked_ips":["example"],"suspended":true,"suspended_public_reason":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.opdns.io/v1/nodes/enrol \ --header 'Content-Type: application/json' \ --data '{ "enrol_token": "example", "name": "example", "versions": { "edge": "example", "unbound": "example", "lists": 1, "profile": 1, "schema": 1 }, "profile": { "schema": 1, "schema_minor": 1, "id": "example", "version": 1, "name": "example", "deleted": true, "lists": [ 1 ], "deny": [ { "pattern": "example" } ], "allow": [ { "pattern": "example" } ], "rewrites": [ { "name": "example", "type": "example", "value": "example" } ], "security": { "rebinding": true, "idn_homograph": true, "typosquat": true, "nrd": true, "dga": true, "cryptojacking": true, "threat_intel": true, "csam": true }, "parental": { "categories": [ "example" ], "services": [ "example" ], "safe_search": true, "youtube_restricted": true, "schedules": [ { "name": "example", "enabled": true, "mode": "allow_during", "categories": [ "example" ], "services": [ "example" ], "windows": [ { "day": "mon", "start": "20:00", "end": "07:00", "end_day": "mon" } ] } ] }, "settings": { "block_mode": "nxdomain", "block_page_show_name": false, "logs_enabled": true, "log_client_ip": true, "log_domains": true, "log_destination": "cloud", "retention_days": 1, "cname_uncloak": true, "cache_boost_ttl": 1, "ecs": "off", "web3": false, "node_queue_hours": 0, "log_region": "ca", "protection": { "ads_trackers": 1, "malware_phishing": 1, "scams_abuse": 1 }, "timezone": "America/Toronto" }, "linked_ips": [ "example" ], "suspended": true, "suspended_public_reason": "example" } }'The self-hosted node calls this. The code works once and expires. A refused
code gets 400 with a detail that names the cause and the fix:
token_expired (its 15 minutes are over), token_used (it already enrolled a
node, or its node was removed), or invalid_token. invalid_token means that
this environment does not know the code: it was mistyped, made in another
opdns environment, or its profile was deleted. Only this response returns the
node token (opdnsnode_...). The node presents it as Authorization: Bearer
to the node endpoints below and to the link (link_url). Rate limited per
client IP.
A node that enrolls out of standalone mode sends its local profile. When the
cloud profile is untouched (version 1, no rules), the local profile replaces
it (profile_replaced). The change goes through the profile write path, so
the API increments the version and publishes it. Otherwise, the cloud profile
does not change. The API holds the document on the node (node.adoption,
adoption_pending) until the owner of the profile adopts it or keeps the
cloud profile (POST /v1/profiles/{id}/nodes/{node}/adoption). Meanwhile, the
node follows the cloud profile. Profile content that is not valid (including
unknown or retired lists) gets 422. Nothing changes, and the code stays usable.
Control planes before 0.28.0 refused a profile that was not untouched with 409
profile_not_empty. This one no longer does.
Request Bodyrequired
Section titled “Request Bodyrequired”object
When set, replaces the name given at creation.
object
The local (standalone) profile of the node. The API ignores its id, version and linked IPs.
object
Document schema major version. Absent means 1. A consumer refuses a major version newer than it knows.
Document schema minor version, incremented for added fields. Absent means 0. A consumer accepts a newer minor version of its own major version, and ignores the fields that it does not know.
Public 6-character id. Never 000000.
The display name of the profile (a rename publishes the document again).
object
object
object
object
object
Recreation schedules (0.35.0). Each schedule blocks its categories and services by the clock, in settings.timezone. Empty for a profile without schedules.
A recreation schedule (0.35.0). In mode allow_during, the schedule blocks its categories and services outside its windows (the windows are recreation time). In mode block_during, it blocks them during its windows. Windows are on a weekly grid of 15-minute slots in the settings.timezone of the profile (UTC when unset), with daylight saving time. Windows can overlap. A schedule blocks in addition to categories and services, which always block. The allowlist wins over both. A query that a schedule blocks carries the EDE extra text blocked by schedule <name>, and the log records it with the reason schedule: <name>. Problems get 422 with the field path, such as parental.schedules[0].windows[1].start.
object
Unique within the profile, ignoring case. No leading or trailing space.
Optional on input (allow_during). Always present in responses.
A span of the week in the time zone of the profile. It starts on day at start. Without end_day, it ends at end the same day when end is later than start. Otherwise, it ends the next day (it wraps midnight, and end equal to start is 24 hours). With end_day, it ends at the first end_day end after its start. So it can span several days, up to the whole week (end_day and end equal to day and start).
object
Example
20:00Example
07:00object
How the resolver answers a blocked name. nxdomain (the default) says that the name does not exist. null answers 0.0.0.0 and ::. refused refuses the query. block-page answers the block page address, so a browser shows which setting blocked the name. block-page works only where the block page runs (GET /v1/capabilities). Otherwise, the API answers 422 settings.block_mode. On https:// names, the page needs the block page certificate of the profile installed (POST /v1/profiles/{id}/block-page/ca).
Shows the name of the profile on its block page. Off by default. When off, the page names only the setting that blocked the name.
EDNS Client Subnet (RFC 7871) forwarded to authoritative servers. off sends none (an explicit /0 opt-out). anonymised (the default for new profiles) sends the network of the client truncated to /24 (IPv4) or /56 (IPv6), never the address itself. CDNs pick a nearby server, and every client of one prefix shares one cached answer. full sends the address of the client itself (/32 and /128 by default). The operator can set a lower cap, often /64 for IPv6. So the IP address of the client reaches every authoritative server queried for it: better CDN steering, less privacy. If a client sends its own ECS option, the resolver forwards it no wider than the mode allows, and always honors its /0 opt-out.
Resolves Web3 names (0.39.0) for this profile. ENS .eth names resolve as a CNAME to the gateway of the operator (eth.limo by default). Unstoppable Domains and Handshake names resolve where the operator configures a gateway or resolver for them. The gateway sees every Web3 name requested. No chain client runs on the edge. Lists and the denylist block Web3 names and their gateway hosts like any name. Absent or false (the default): these names are not ICANN names and answer NXDOMAIN.
How long opdns holds the logs of this profile for its self-hosted node while the node is offline (log destination self-hosted or both), in hours, 24 at most. 0 holds nothing: opdns drops the records made while the node is offline (with both, it still keeps the cloud copy). opdns never delivers records older than the window. retention_days is the cloud log retention, a different setting. Profiles saved before 0.9.0 read as 24.
Where opdns stores the query log of this profile in the cloud (log destination cloud or both). ca: Canada, the only region available today and the default. eu is announced but not accepted yet: the API refuses it with a 422 problem (settings.log_region) until the region exists. The logs of a self-hosted node stay on the node. Profiles saved before 0.10.0 read as ca.
The Privacy sliders of the dashboard: the step, 1 (least restrictive) to 5 (most restrictive), per protection group. Only ads_trackers, malware_phishing and scams_abuse have a slider. Any other key is an unknown field (400 bad_request). This includes telemetry, because device telemetry keeps its per-manufacturer switches. A step outside 1 to 5 gets a 422 problem (settings.protection.<group>). The steps record the positions of the sliders. The lists of the profile still do the filtering (PUT /v1/profiles/{id}/lists), so a client sets both. For each group, the lists of a set of steps are the catalog lists that are not retired (GET /v1/lists), of that group, whose level is 1 to the step of the group. A group without a step counts as step 3. A step never chooses a list outside these groups. New profiles store every group at step 3 and start with those lists. Profiles saved before 0.30.0 have no steps, so clients derive a step from the lists.
object
The IANA time zone of the profile (0.35.0), in which parental schedules run. Absent when never set. Schedules then run in UTC. An unknown name gets a 422 problem (settings.timezone).
Example
America/TorontoThe operator suspended the profile. Every query gets REFUSED with Extended DNS Error 15 (Blocked). Absent means false.
Schema 1.1: the explanation of the operator for the users of the profile, sent as the Extended DNS Error text profile suspended: <reason>. The internal note of the operator is never in the copy that a node receives.
Responses
Section titled “Responses”Enrolled.
object
Public 6-character id. Never 000000.
object
Public 6-character id. Never 000000.
pending until the node exchanges the enrollment code.
object
object
The round trip of the link, as the node measured it at its last health report (handshake, then keepalive pings). Absent when unknown (older nodes).
The ids of the profile-signing keys that the node trusts (configured and learned), as it reported them in its last health report. The node refuses profiles signed by any other key. Empty when it accepts unsigned profiles. Absent from nodes older than the field.
health.link_rtt_ms while the node is online. Null when offline or unknown.
health.profile_key_ids, the key ids from the last health report of the node (kept while it is offline). Empty when unknown.
Only in GET /v1/profiles/{id}/nodes (0.42.0): whether
profile_key_ids holds the key that the cloud signs profiles with now. False
means that the node refuses new profiles and keeps its last good one. Null
when unknown: the cloud does not sign profiles, the node is not enrolled, or
it reported no keys.
The last committed rotation of the node token (node.token_rotated). Absent before the first.
The approximate location of a self-hosted node, from GeoIP.
object
Latitude. When the database has no coordinates, the representative point of the country.
Longitude, as lat.
ISO 3166-1 alpha-2 country code.
The city, when the database has one (a country database has none).
Where the location comes from.
Only in GET /v1/profiles/{id}/nodes: the log batches that wait in the queue
of the node. These are pending batches plus batches delivered but not
acknowledged on its consumer, or every queued batch of the profile before the
node first connected. Null when unknown (revoked node, or the API failed to
read the queue).
Only in GET /v1/profiles/{id}/nodes: when the oldest of the queue_depth
batches was queued. The dashboard uses it to show how long the node is
missing logs, compared with the node_queue_hours of the profile. Null when
nothing waits or the queue is unknown.
The local profile of a standalone node, which waits for its owner. Nothing in the cloud changed when it arrived. Meanwhile, the node follows the cloud profile.
object
When the node sent it (at its enrollment).
The document as the node sent it. Its id, version and linked IPs come from the node, and adoption ignores them.
object
Document schema major version. Absent means 1. A consumer refuses a major version newer than it knows.
Document schema minor version, incremented for added fields. Absent means 0. A consumer accepts a newer minor version of its own major version, and ignores the fields that it does not know.
Public 6-character id. Never 000000.
The display name of the profile (a rename publishes the document again).
object
object
object
object
object
Recreation schedules (0.35.0). Each schedule blocks its categories and services by the clock, in settings.timezone. Empty for a profile without schedules.
A recreation schedule (0.35.0). In mode allow_during, the schedule blocks its categories and services outside its windows (the windows are recreation time). In mode block_during, it blocks them during its windows. Windows are on a weekly grid of 15-minute slots in the settings.timezone of the profile (UTC when unset), with daylight saving time. Windows can overlap. A schedule blocks in addition to categories and services, which always block. The allowlist wins over both. A query that a schedule blocks carries the EDE extra text blocked by schedule <name>, and the log records it with the reason schedule: <name>. Problems get 422 with the field path, such as parental.schedules[0].windows[1].start.
object
Unique within the profile, ignoring case. No leading or trailing space.
Optional on input (allow_during). Always present in responses.
A span of the week in the time zone of the profile. It starts on day at start. Without end_day, it ends at end the same day when end is later than start. Otherwise, it ends the next day (it wraps midnight, and end equal to start is 24 hours). With end_day, it ends at the first end_day end after its start. So it can span several days, up to the whole week (end_day and end equal to day and start).
object
object
How the resolver answers a blocked name. nxdomain (the default) says that the name does not exist. null answers 0.0.0.0 and ::. refused refuses the query. block-page answers the block page address, so a browser shows which setting blocked the name. block-page works only where the block page runs (GET /v1/capabilities). Otherwise, the API answers 422 settings.block_mode. On https:// names, the page needs the block page certificate of the profile installed (POST /v1/profiles/{id}/block-page/ca).
Shows the name of the profile on its block page. Off by default. When off, the page names only the setting that blocked the name.
EDNS Client Subnet (RFC 7871) forwarded to authoritative servers. off sends none (an explicit /0 opt-out). anonymised (the default for new profiles) sends the network of the client truncated to /24 (IPv4) or /56 (IPv6), never the address itself. CDNs pick a nearby server, and every client of one prefix shares one cached answer. full sends the address of the client itself (/32 and /128 by default). The operator can set a lower cap, often /64 for IPv6. So the IP address of the client reaches every authoritative server queried for it: better CDN steering, less privacy. If a client sends its own ECS option, the resolver forwards it no wider than the mode allows, and always honors its /0 opt-out.
Resolves Web3 names (0.39.0) for this profile. ENS .eth names resolve as a CNAME to the gateway of the operator (eth.limo by default). Unstoppable Domains and Handshake names resolve where the operator configures a gateway or resolver for them. The gateway sees every Web3 name requested. No chain client runs on the edge. Lists and the denylist block Web3 names and their gateway hosts like any name. Absent or false (the default): these names are not ICANN names and answer NXDOMAIN.
How long opdns holds the logs of this profile for its self-hosted node while the node is offline (log destination self-hosted or both), in hours, 24 at most. 0 holds nothing: opdns drops the records made while the node is offline (with both, it still keeps the cloud copy). opdns never delivers records older than the window. retention_days is the cloud log retention, a different setting. Profiles saved before 0.9.0 read as 24.
Where opdns stores the query log of this profile in the cloud (log destination cloud or both). ca: Canada, the only region available today and the default. eu is announced but not accepted yet: the API refuses it with a 422 problem (settings.log_region) until the region exists. The logs of a self-hosted node stay on the node. Profiles saved before 0.10.0 read as ca.
The Privacy sliders of the dashboard: the step, 1 (least restrictive) to 5 (most restrictive), per protection group. Only ads_trackers, malware_phishing and scams_abuse have a slider. Any other key is an unknown field (400 bad_request). This includes telemetry, because device telemetry keeps its per-manufacturer switches. A step outside 1 to 5 gets a 422 problem (settings.protection.<group>). The steps record the positions of the sliders. The lists of the profile still do the filtering (PUT /v1/profiles/{id}/lists), so a client sets both. For each group, the lists of a set of steps are the catalog lists that are not retired (GET /v1/lists), of that group, whose level is 1 to the step of the group. A group without a step counts as step 3. A step never chooses a list outside these groups. New profiles store every group at step 3 and start with those lists. Profiles saved before 0.30.0 have no steps, so clients derive a step from the lists.
object
The IANA time zone of the profile (0.35.0), in which parental schedules run. Absent when never set. Schedules then run in UTC. An unknown name gets a 422 problem (settings.timezone).
The operator suspended the profile. Every query gets REFUSED with Extended DNS Error 15 (Blocked). Absent means false.
Schema 1.1: the explanation of the operator for the users of the profile, sent as the Extended DNS Error text profile suspended: <reason>. The internal note of the operator is never in the copy that a node receives.
The log records dropped from the node queue of a profile, by reason.
object
The records not queued, because the profile keeps nothing for an offline node
(node_queue_hours 0) and no node was online.
The records removed, oldest first, when the queue reached its limit before every node of the profile received them.
When a record was last dropped. Null when none was ever dropped.
The profile of the request replaced the cloud profile.
The version of the profile after the replacement (only with profile_replaced).
The API held the profile of the request for review by the owner,
instead of replacing the cloud profile (node.adoption).
Hex Ed25519 keys that the cloud signs node profile responses with, the signing key first. The node trusts them from enrollment on, and refuses unsigned or badly signed profiles after that. Absent when the cloud does not sign.
Example
{ "link_url": "wss://link.opdns.net/link", "profile_url": "/v1/nodes/self/profile", "node": { "mode": "enrolled", "status": "pending", "location": { "source": "geoip" }, "adoption": { "status": "pending", "profile": { "parental": { "schedules": [ { "mode": "allow_during", "windows": [ { "day": "mon", "start": "20:00", "end": "07:00", "end_day": "mon" } ] } ] }, "settings": { "block_mode": "nxdomain", "block_page_show_name": false, "log_destination": "cloud", "ecs": "off", "web3": false, "node_queue_hours": 0, "log_region": "ca", "timezone": "America/Toronto" } } } }}Malformed request.
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/bad_request", "title": "Bad Request", "status": 400, "code": "bad_request", "detail": "The JSON in the request is not valid (unexpected end of JSON input). Correct the JSON and try again.", "request_id": "5f2c9a0e7b1d4c38"}profile_not_empty: only from control planes before 0.28.0, when the cloud profile already had settings or rules.
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/profile_not_empty", "title": "Conflict", "status": 409, "code": "profile_not_empty", "detail": "This profile already has settings or rules in the dashboard, so we did not use the local profile of the node. Enroll the node without its local profile, or reset the profile in the dashboard first.", "request_id": "5f2c9a0e7b1d4c38"}Field validation failed (validation_failed, unknown_list), or the plan of the organization does not allow the write (plan_limit, which names the limit in limit).
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/validation_failed", "title": "Unprocessable Content", "status": 422, "code": "validation_failed", "detail": "Some values in the request are not valid. The list of errors tells you what to change.", "errors": [ { "field": "settings.block_mode", "message": "one of nxdomain, refused, null, block-page" } ], "request_id": "5f2c9a0e7b1d4c38"}Rate limited (rate_limited). For an API token, the organization used all of the rate of its plan until RateLimit-Reset.
object
Stable machine code.
object
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
The plan limit that a plan_limit problem reached.
object
The value of the limit in the plan.
Where to change to a larger plan.
The scope that the API token did not have (insufficient_scope).
Example
{ "type": "https://opdns.io/problems/rate_limited", "title": "Too Many Requests", "status": 429, "code": "rate_limited", "detail": "You sent too many requests in a short time. Wait a moment, then try again.", "request_id": "5f2c9a0e7b1d4c38", "retry_after": 6}Headers
Section titled “Headers”On every response to an API token: the rate of the plan of the organization, in requests per one-minute window (api_requests_per_minute).
On every response to an API token: the requests left to the organization in the current window.
On every response to an API token: the seconds until the current window ends and the count resets.
On every response to an API token: the quota policy, <limit>;w=60.