Live log tail as server-sent events.
const url = 'https://api.opdns.io/v1/profiles/example/logs/stream?limit=100';const options = { method: 'GET', headers: {cookie: '__Host-opdns_session=<__Host-opdns_session>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.opdns.io/v1/profiles/example/logs/stream?limit=100' \ --cookie __Host-opdns_session=<__Host-opdns_session>Token scope: logs:read. A text/event-stream of the new log rows of the
profile, with the filters of the tail query. The server polls the log
destination every second with the tail cursor. It polls ClickHouse for
cloud and both, and the node over the link for self-hosted. For none,
it sends only heartbeats. Errors known before the stream starts are problem
responses: 501 not_implemented, 503 node_offline, 400 invalid cursor,
and 429 too_many_streams when the account already holds the maximum number
of open streams.
Events:
event: rows,id: <cursor>,data:aQueryResultJSON (shapetail) with the new rows. Unless the stream resumes, the first event carries the latest rows (up tolimit). Sent only when there are rows.event: partial,data: {"partial": true, "partial_reason": "node_reconnecting"}: a poll got a partial answer with no rows, because the node of aself-hostedprofile is between link sessions. Sent once until a complete poll.rowsevents carry thepartialflag of their own result.event: error,data: {"status", "code", "detail"}: a failure while streaming. After a temporary failure (node_offline,node_timeout, 5xx), the polls continue. After any other failure, the stream ends.- A comment line
: heartbeatevery 15 s. At each heartbeat, the server makes sure again that the session or token and the profile are still valid. A revoked credential or a deleted profile ends the stream, after anerrorevent.
The event id is the tail cursor after the rows of that event. If you
reconnect with Last-Event-ID (EventSource does this by itself) or
?cursor=, the stream resumes after it, without gaps or repeats. The server
ends a stream after an hour. Clients then reconnect.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Public 6-character id. Never 000000.
Query Parameters
Section titled “Query Parameters”Device id. Repeat for several.
Repeat for several.
A substring match for search, and an exact name otherwise.
Numeric DNS type. Repeat for several.
Blocking list id. Repeat for several.
Opaque, from the next_cursor of a previous result.
Header Parameters
Section titled “Header Parameters”The id of the last rows event received. The stream resumes after it.
Responses
Section titled “Responses”The event stream.
Server-sent events, for example:
retry: 2000
id: dDE3Mjc2MDQ4MDAwMDAwMDA6MTcyNzYwNDc5OTk5OTAwMDAwMDo0Mg
event: rows
data: {"shape":"tail","source":"clickhouse","columns":[...],"rows":[[...]],"next_cursor":"dDE3..."}
: heartbeat
Examples
id: dDE3Mjc2MDQ4MDAwMDAwMDA6MTcyNzYwNDc5OTk5OTAwMDAwMDo0Mgevent: rowsdata: {"shape":"tail","source":"clickhouse","columns":[{"name":"ts","type":"time"}],"rows":[["2026-09-29T10:00:00Z"]],"next_cursor":"dDE3Mjc2MDQ4MDAwMDAwMDA6MTcyNzYwNDc5OTk5OTAwMDAwMDo0Mg"}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"}Not authenticated.
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/unauthenticated", "title": "Unauthorized", "status": 401, "code": "unauthenticated", "detail": "You are not signed in, or your sign-in ended. Sign in again to continue.", "request_id": "5f2c9a0e7b1d4c38"}Authenticated but not allowed: insufficient_scope, session_required, csrf_rejected, reauth_required (sign in again within five minutes), account_pending_deletion (the account is in its deletion cooling-off period), email_unverified (creating a profile before the email address is verified).
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/insufficient_scope", "title": "Forbidden", "status": 403, "code": "insufficient_scope", "detail": "This API token does not have the profiles:write scope that this request needs. Create a token with this scope, then try again.", "required_scope": "profiles:write", "request_id": "5f2c9a0e7b1d4c38"}Not found (also for resources of another organization).
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/not_found", "title": "Not Found", "status": 404, "code": "not_found", "detail": "We did not find that. The link is wrong, or the item no longer exists.", "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.
not_implemented (cloud log queries are not configured on this server) or shape_unsupported (the node is too old).
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/not_implemented", "title": "Not Implemented", "status": 501, "code": "not_implemented", "detail": "The query log is not available on this server, so there is nothing to show here.", "request_id": "5f2c9a0e7b1d4c38"}node_offline: the logs of the profile are on a self-hosted node, and no node is
connected. node_busy: the node has too many queries in progress.
relay_unavailable. Try again after Retry-After (also retry_after in the body).
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/node_offline", "title": "Service Unavailable", "status": 503, "code": "node_offline", "detail": "The self-hosted node that keeps the logs of this profile is offline. Make sure that the node is running and online, then try again.", "request_id": "5f2c9a0e7b1d4c38", "retry_after": 30}