Developers · HTTP API
A web analytics API for any language.
Read stats, manage goals and funnels, and send events from a CRM, a payment webhook or a script, with one key. For a SaaS, the platform API also sets up users and their websites.
curl -H "Authorization: Bearer nak_…" \
"https://youragency.com/wp-json/nahnu-analytics/v1/api/stats/SITE_ID?period=30d&compare=previous"Keys and limits
One key, scoped to what it needs.
Make a key under Settings › Data & API › API keys. It reads every website or one client’s websites, and you choose what it can do.
- Read stats; read, manage goals and funnels and send events; or Platform
- 600 requests an hour per key, 20,000 for a platform key
- A batch of events counts as one request
- Only a hash of the key is stored, so copy it when it’s made

Routes
Everything on the dashboard, as JSON.
Base address: https://your-site/wp-json/nahnu-analytics/v1/api/
sitesEvery website the key can readstats/{site}Key numbers for a period, with a comparison and filtersstats/{site}/reportOne report: sources, pages, countries and morerealtime/{site}Who is on the website right nowcsv/{site}A report as CSVsites/{site}/goalsList or add page and event goalssites/{site}/funnelsList or add funnels of 2 to 8 stepsstats/{site}/funnel · /journeyA funnel’s or a journey’s numbersevents/{site}One event, or up to 50 at oncev2/queryMetrics and dimensions for Looker Studio and scriptsPeriods: today, yesterday, 24h, 7d, 28d, 30d, 91d, month, 6mo, year, 12m, all, or custom with from and to.
Goals from your own systems
Count a lead won in your CRM.
Declare the goal once, then send the event from your CRM’s webhook. With the visitor’s address and browser, it joins their visit and the source gets the credit.
- Only name is required
- The same id within 3 days counts once, so a retried webhook isn’t a second sale
- Revenue in any currency
- Without the visitor’s address, the event still counts, as its own visitor
curl -X POST -H "Authorization: Bearer nak_…" -H "Content-Type: application/json" \
-d '{"kind": "event", "match": "Lead won", "label": "Lead won (CRM)"}' \
https://youragency.com/wp-json/nahnu-analytics/v1/api/sites/SITE_ID/goalscurl -X POST -H "Authorization: Bearer nak_…" -H "Content-Type: application/json" \
-d '{"name": "Lead won", "revenue": {"amount": 490, "currency": "USD"}}' \
https://youragency.com/wp-json/nahnu-analytics/v1/api/events/example.comPlatform API
For a SaaS that adds its own users.
With a platform key, your product makes clients, portal users and websites, links websites, signs users in and reads usage for billing, all from your own code.
- Your own refs, such as your user id, for clients and sites
- An OpenAPI 3.1 file in the SDK package describes every route
- Import it into Postman or Insomnia, or generate a client
- Or use the TypeScript SDK, which wraps it all
/platform/clients/{ref}Make or update a client/platform/clients/{ref}/usersAdd someone who signs in to the portal/platform/clients/{ref}/loginA one-time sign-in link/platform/sites/{ref}Make or update a website, with its tracking code/platform/sites/{ref}/statusIs it receiving visits?/platform/usageVisitors and pageviews, for billingSome of the platform routes
API playground
Try any route before you write code.
Settings › API playground runs any route with your key and shows exactly what it answers, with the same request as curl to copy.

How do I authenticate?
Send the key as Authorization: Bearer nak_…, or as X-Nahnu-Key if your host strips the Authorization header.
What are the rate limits?
600 requests an hour per key, and 20,000 for a platform key. A batch of events counts as one. Every answer carries X-RateLimit-Limit, -Remaining and -Reset.
Can a key read only one client’s websites?
Yes. A key reads every website or one client’s websites.
My site has no pretty permalinks. Does it still work?
Yes. Use ?rest_route=/nahnu-analytics/v1/api… instead of /wp-json/.
Can I connect Looker Studio or Google Sheets?
Yes. The v2 query API is made for Looker Studio connectors and scripts, and Settings › Data & API explains Google Sheets.
Build on your analytics.
Unlimited websites, every feature, the API included.