Skip to main content

Read the response

Most reads return JSON. For example, GET /profiles returns an array in data, and GET /profiles/{profile} returns a single object in data. Analytics and logs can also include meta for pagination, time series, or streaming. Stream logs returns server-sent events. Download logs redirects to a CSV download by default. A 204 No Content response has an empty body.

Handle errors

Check both the HTTP status and the response body. Some operations return 200 OK with an errors array when NextDNS declines a change. For example, adding an entry that already exists in the Denylist returns this body.
Read errors[].code for the reason. Validation errors can include a detail message and identify the offending query parameter in source.parameter or body field in source.pointer.

Fetch the next page

For paginated analytics and historical log queries, pass meta.pagination.cursor as the cursor query parameter on the next request. Treat it as an opaque string and keep the endpoint, sort order, and filters the same. Stop when there is no next cursor. An oldest-first raw log query can return the same cursor while waiting for new entries. See List logs. For example, to fetch the next page of logs after a request with limit=50, set CURSOR to the value from the previous response and repeat the request.

Rate limits

Requests to an individual profile share a limit of 300 reads and 60 writes per minute across callers. Account-wide limits also apply across profiles and depend on your subscription. Streaming and downloading logs have additional limits.