const url = ' https://api.opdns.io/v1/profiles/example/analytics/counts_by_status?limit=100 ' ;
headers: {cookie: ' __Host-opdns_session=<__Host-opdns_session> ' }
const response = await fetch ( url , options );
const data = await response . json ();
--url ' https://api.opdns.io/v1/profiles/example/analytics/counts_by_status?limit=100 ' \
--cookie __Host-opdns_session=<__Host-opdns_session>
Token scope: analytics:read. The routing by log destination is the same as
for /v1/profiles/{id}/logs, with one exception. When you filter
counts_by_status and timeline by time only (no device, status,
qname, qtype, list or client_ip), they always come from ClickHouse
(source = clickhouse), also for none and self-hosted profiles.
The cloud keeps hourly totals of the queries of every profile. The edge counts
them even when no per-query row is kept. So these shapes answer totals derived
from the counters, in whole hours: a range or bucket shorter than an hour
reports the hours around it. With any other filter, these two shapes follow
the destination. top_* and destinations always follow it: the API relays
them to the node for self-hosted, and they are empty for none. Without
ClickHouse configured, those two shapes also use the routing of the
destination.
bucket applies to timeline (default 3600).
In top_devices, device_name is the display name when one is set. Rows
stay grouped by device id.
top_reasons groups queries by what decided them. Its columns are
reason_code (list, rule, operator:<code>, rewrite, none),
list_id (set for list only), reason (the list name for list, the rule
or operator text for the others, "" for none) and count. The most
frequent come first, and ties sort by reason_code, list_id, reason.
Without a status filter, it counts blocked and rewritten queries.
destinations groups allowed queries (without a status filter) by answer
address. Its columns are ip, count, country and owner. country is
the ISO 3166-1 alpha-2 code of the address from the GeoIP database of the
server. It is "" when unknown or when no database is configured (see
geoip_attribution in GET /v1/meta). owner is the company whose address
it is: google, apple, meta, amazon, microsoft, or the CDNs
cloudflare, akamai, fastly. It is "" for any other.
top_owners counts queries by the company that they reached. Its columns are
owner and count, most first, and ties sort by owner. The owner of a
query comes from its name (a curated domain suffix list), or else from its
first classified answer address. The shape leaves out queries that it cannot
classify, and it has no default status filter. Nodes older than top_owners
answer 501 shape_unsupported.
top_pops counts queries by the PoP that answered them. Its columns are
pop and count, most first, and ties sort by pop. pop is the PoP id as
in GET /v1/pops, for example ams. Queries that a self-hosted node answered
itself are node. It has no default status filter. Nodes older than
top_pops answer 501 shape_unsupported.
Guardrails, per organization and api replica:
Each shape covers at most a fixed range, by plan. On free, search,
top_devices, destinations and top_pops cover 31 days, the hourly
shapes 400 days, and tail has no limit. A wider from..to gets 422
range_too_large. Without from, the range starts that long before to.
Queries draw on a cost budget of 1,200 units a minute: two units per day
of raw rows, and one unit per week of hourly totals.
At most four queries run at once. A query waits up to five seconds for a
slot, then gets 429 too_many_queries with Retry-After. A query over the
budget gets the same answer.
A cloud query that reads more rows or memory than the limit for one query
gets 422 query_too_expensive.
Public 6-character id. Never 000000.
string
/^[a-z0-9]{6}$/
string
Allowed values: counts_by_status top_domains top_devices top_blocked destinations timeline top_reasons top_owners top_pops
from
string
Inclusive start, RFC 3339 or Unix milliseconds.
to
string
Exclusive end, RFC 3339 or Unix milliseconds. Default now.
device
Array<string>
Device id. Repeat for several.
status
Array<string>
Allowed values: allowed blocked rewritten error
qname
string
<= 253 characters
A substring match for search, and an exact name otherwise.
qtype
Array<integer>
Numeric DNS type. Repeat for several.
list
Array<integer>
Blocking list id. Repeat for several.
limit
integer
default: 100 >= 1 <= 1000
cursor
string
<= 512 characters
Opaque, from the next_cursor of a previous result.
bucket
integer
>= 60 <= 86400
Timeline bucket width in seconds.
Media type application/json
object The fixed query shapes that both ClickHouse and self-hosted nodes implement.
string
Allowed values: tail search counts_by_status top_domains top_devices top_blocked destinations timeline top_reasons top_owners top_pops
string
Allowed values: clickhouse node none
node
The node that answered, for source = node.
string format: uuid
Array<object>
object string
Allowed values: string int uint float bool time bytes unknown
One array per row, cells in column order. Time as RFC 3339, bytes as base64, null for NULL.
Array<Array>
partial
Always sent (false when complete). True when there are fewer rows than the
full query gives. The node cut its answer short (partial_reason timeout
near its query deadline, or overload), or the node of a self-hosted
profile is reconnecting (node_reconnecting, no rows, and a tail keeps its
cursor). The rows in the result are valid, and next_cursor continues
after them.
boolean
partial_reason
Set when partial is true.
string
Allowed values: timeout overload node_reconnecting
Example "partial_reason" : " timeout "
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/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 "
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/unauthenticated " ,
"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).
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/insufficient_scope " ,
"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).
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/not_found " ,
"detail" : " We did not find that. The link is wrong, or the item no longer exists. " ,
"request_id" : " 5f2c9a0e7b1d4c38 "
The API refused the query: validation_failed (a parameter is not valid), range_too_large (from..to is wider than the shape allows, and errors names from), or query_too_expensive (the query needs more rows or memory than the limit for one query, so narrow the range or add filters).
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/range_too_large " ,
"title" : " Unprocessable Content " ,
"code" : " range_too_large " ,
"detail" : " This view can cover at most 31 days. Choose a shorter time range (from and to). " ,
"message" : " at most 31 days before to "
"request_id" : " 5f2c9a0e7b1d4c38 "
Too many log queries of this organization are running, or it used all of its query budget (too_many_queries). Try again after Retry-After seconds.
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/too_many_queries " ,
"title" : " Too Many Requests " ,
"code" : " too_many_queries " ,
"detail" : " Too many searches are running for your organization now. Wait a few seconds, then try again. " ,
"request_id" : " 5f2c9a0e7b1d4c38 " ,
not_implemented (cloud log queries are not configured on this server) or shape_unsupported (the node is too old).
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/not_implemented " ,
"title" : " Not Implemented " ,
"code" : " not_implemented " ,
"detail" : " The query log is not available on this server, so there is nothing to show here. " ,
"request_id" : " 5f2c9a0e7b1d4c38 "
node_error: the node failed to answer.
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/node_error " ,
"detail" : " Your self-hosted node returned an error for this search: the node's log database is unavailable. Read the log of the node, or try again in a minute. " ,
"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).
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/node_offline " ,
"title" : " Service Unavailable " ,
"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 " ,
node_timeout: the node did not answer within 10 seconds. query_timeout: a cloud (ClickHouse) log query ran too long.
Media type application/problem+json
object string
Allowed values: bad_request body_too_large bad_if_match unauthenticated signup_closed invite_required waitlist_unavailable mail_unavailable invalid_token token_expired token_used email_unverified session_required insufficient_scope csrf_rejected not_found version_mismatch ip_conflict managed_by_opwan no_opdns _account service_unavailable unknown_list too_many_rules validation_failed rate_limited internal node_revoked node_offline node_busy node_timeout node_error result_too_large shape_unsupported node_token_superseded relay_unavailable not_implemented query_timeout query_too_expensive range_too_large too_many_queries mfa_required reauth_required account_pending_deletion deletion_pending no_deletion_pending deletion_started organisation_has_members export_in_progress export_not_ready block_exists profile_not_empty no_adoption_pending invalid_cursor bad_idempotency_key idempotency_key_reused idempotency_in_progress too_many_streams too_many_reports profile_suspended plan_limit owner_required billing_unavailable billing_provider_error subscription_exists no_billing_account block_page_ca_exists oidc_unavailable feedback_status_conflict reply_not_wanted reply_unavailable
retry_after
Seconds, the same value as the Retry-After header (rate limits, offline nodes).
integer
limit
The plan limit that a plan_limit problem reached.
object string
Allowed values: profiles linked_ips nodes queries_per_month log_retention_days api_tokens api_requests_per_minute
The value of the limit in the plan.
integer format: int64
string
Allowed values: free personal family business
Where to change to a larger plan.
string format: uri
required_scope
The scope that the API token did not have (insufficient_scope).
string
Allowed values: profiles:read profiles:write nodes:write account:read billing:read logs:read analytics:read
Example "type" : " https://opdns.io/problems/node_timeout " ,
"title" : " Gateway Timeout " ,
"detail" : " Your self-hosted node took too long to answer. Choose a shorter time range, or try again in a minute. " ,
"request_id" : " 5f2c9a0e7b1d4c38 "