curl --fail --location "https://api.nextdns.io/profiles/$PROFILE_ID/logs/download" \
--header "X-Api-Key: $NEXTDNS_API_KEY" \
--output "${PROFILE_ID}.csv"
curl "https://api.nextdns.io/profiles/$PROFILE_ID/logs/download?redirect=0" \
--header "X-Api-Key: $NEXTDNS_API_KEY"
{
"data": {
"url": "https://api.nextdns.io/logs/c2ke6y/<export-token>"
}
}
Logs
Download logs
Export all retained DNS queries for a profile to a CSV file.
GET
/
profiles
/
{profile}
/
logs
/
download
curl --fail --location "https://api.nextdns.io/profiles/$PROFILE_ID/logs/download" \
--header "X-Api-Key: $NEXTDNS_API_KEY" \
--output "${PROFILE_ID}.csv"
curl "https://api.nextdns.io/profiles/$PROFILE_ID/logs/download?redirect=0" \
--header "X-Api-Key: $NEXTDNS_API_KEY"
{
"data": {
"url": "https://api.nextdns.io/logs/c2ke6y/<export-token>"
}
}
The export contains individual queries in reverse chronological order. It covers the profile’s full retained history and includes the details recorded under its logging settings. For a filtered time range or a single device, use List logs.
In the CSV, a blank
Anyone with the download URL can retrieve the exported file. Store it with the same care as the logs themselves.
status corresponds to default in the JSON logs. An export with zero entries produces an empty file.
By default, the API responds with
302 Found and a download URL in the Location header. Pass 0 or false to receive 200 OK with the URL in data.url once the export is ready.curl --fail --location "https://api.nextdns.io/profiles/$PROFILE_ID/logs/download" \
--header "X-Api-Key: $NEXTDNS_API_KEY" \
--output "${PROFILE_ID}.csv"
curl "https://api.nextdns.io/profiles/$PROFILE_ID/logs/download?redirect=0" \
--header "X-Api-Key: $NEXTDNS_API_KEY"
{
"data": {
"url": "https://api.nextdns.io/logs/c2ke6y/<export-token>"
}
}