Obtaining statistics via JSON API

(from github.com/micakovic)
Is it possible to obtain statistics via JSON API, preferably securely utilizing a token?

For example, to download search statistics in the web browser, this will prompt for authorization, and if that succeeds, download the file:


Is there a mechanism to do something along the lines of:

curl -H "Authorization: TOKEN" https://example.com/json/backup/search_log.ndjson