What you will learn #
This chapter is for developers and advanced users who want to read Hitsteps analytics from their own software, or put Hitsteps numbers into external tools. After reading it you will be able to choose the right API for the job, find and protect the correct credential, run your first request, connect Grafana or Looker Studio, automate a daily pull with a tool such as n8n, and understand the limits and safety rules that apply. It covers the publicly documented APIs only: the Reports API, the Analytics (callback) API, the Grafana connector, the Looker Studio connector, and the account-gated White-label API.
Before you begin #
- You need a Hitsteps account with at least one website added and its tracking code installed. An API can only return data that the tracker has collected. If you have not installed the tracker, finish the installation guide first.
- Every Hitsteps website has a site API code (also called API key or tracking code). It is a 37-character code shown in the tracking code section of that website's settings. Many plugins, the desktop apps, the Grafana connector and the Looker Studio connector use this code. The Reports API uses a different, per-report key.
- The Reports API is available on every account and every plan, but only for saved Pages and Referrers reports. Other saved report types, such as Visitor sources, do not have a Reports API section yet; use the Analytics API for those.
- The Analytics API (the original website-level callback API) is available on every account and is documented as the safe first choice for a new server integration.
- Grafana and Looker Studio data access require a Hitsteps Business plan or higher, or an active trial. Below that level the endpoints answer HTTP 403 with
plan_required. Check the current plans at https://www.hitsteps.com/features.php#price before building around paid access. - The White-label API is for reseller accounts that already have white-label. Its reference lives inside the product and is not part of the public documentation.
- Report days follow your Hitsteps account's fixed UTC offset, not your browser or server timezone. You cannot override it in an API request.
- Read actions return aggregate data and do not expose visitor identities. No API call in this chapter changes your tracking setup unless the section says it is a write action.
Step by step #
A. Choose the right API
| You want | Use | Credential | Reference |
|---|---|---|---|
| One saved report (Pages or Referrers) as JSON in your own app | Reports API | Reports API key | https://www.hitsteps.com/api/reports-guide.html |
| Account, website, visitor, traffic or live data for a site | Analytics API | API code plus website ID | https://www.hitsteps.com/api/callback-doc |
| Hitsteps numbers on a Grafana dashboard | Grafana connector | Site API code (Bearer token) | https://www.hitsteps.com/grafana-integration/ |
| Client reports in Data Studio (Looker Studio) | Looker Studio connector | Full 37-character site API code | https://www.hitsteps.com/plugin/?type=lookerstudio |
| Reseller account and site provisioning | White-label API | White-label account sign-in | Sign in to https://www.hitsteps.com/api/whitelabel-doc |
The two public APIs are not interchangeable: they use different credentials and different request formats. Pick by what you need to read, not by which page you landed on first.
B. Create your first Reports API key and request
- Finish tracking: make sure the website has visits and its report data has finished processing. A brand new or quiet website shows no Reports API section until data has processed; the API would answer
422 report_unavailablein that window. - From the dashboard open
/stats/<your-site-id>/reports/, open a saved Pages or Referrers report, and expand the Reports API section. - Choose an expiry (1, 7, 30 or 90 days) and click Create API key. Copy the key and store it in your server's secret manager. It is shown only once.
- Save the report exactly as you want it. The API returns that saved report: its metrics, filters, sort and comparison setting. Editing the report afterwards invalidates the key.
- Send a POST from your server. The endpoint is
https://www.hitsteps.com/api/reports-v2.php, with no query fields; the credential goes in theAuthorizationheader and the body is JSON. The quickstart provides a safe cURL form:
# Previous complete account-local day for an account at UTC+02:00.
OFFSET=7200 # your Hitsteps account's UTC offset in seconds
UNTIL=$(( ( $(date +%s) + OFFSET ) / 86400 * 86400 - OFFSET ))
FROM=$(( UNTIL - 86400 ))
printf 'Authorization: Bearer %s\n' "$HITSTEPS_REPORT_API_KEY" |
curl --silent --show-error --include \
'https://www.hitsteps.com/api/reports-v2.php' \
-H @- \
-H 'Content-Type: application/json' \
--data "{\"from\":$FROM,\"until\":$UNTIL}"
The printf pipe keeps the key out of cURL's process arguments, and --include shows the status and headers, including Retry-After when rate-limited. HITSTEPS_REPORT_API_KEY must be set in your server environment.
-
Check the HTTP status before reading the body. An error response still carries a JSON body, so branch on the status, not on whether cURL connected.
-
Read the response under
result.rowsandresult.totals. Empty rows mean the window found no matching data, which is a successful result, not a failure.
The request body has exactly two fields, both integer Unix timestamps in seconds:
| Field | Meaning |
|---|---|
from |
Start of the first account-local day, included. |
until |
Start of the day after the last included day, excluded. Must be greater than from. |
Do not add sid, report_id, timezone, metrics, filters, SQL or definition JSON. Change the saved report in the dashboard instead, then create a replacement key.
C. Use the Analytics API
- Get your site API code from the tracking code section of the website settings (or from https://www.hitsteps.com/plugin/?type=api).
- Send POST requests to
https://www.hitsteps.com/api/callback/<action>with theapicodeform field, andwebsite_idfor most actions, asmultipart/form-data. - The documented actions are:
- Account and website access:
getAPI(obtain an account API code from account credentials),getAccountInfo,getListofTrackingWebsites,newTrackingAPI(add a website via API code) andnewTrackingUser(add a website via login details). - Visitor and traffic reports:
getXdaysHits,dailyhits,hourlyhits,secondlyhits. - Live analytics and report links:
now(online and real-time activity) andshortlink(generate a direct link to a supported Hitsteps report).
- Treat the write actions with care:
newTrackingAPIandnewTrackingUseradd a website to the account, so only call them from code that is meant to create sites. Read actions are what most integrations need. - The OpenAPI 2.0 specification at https://www.hitsteps.com/api/callback.oas2 defines every request field and every response property and is the authoritative reference for this API.
- Keep credentials server-side. The interactive reference does not accept credentials and does not make authenticated requests for you.
D. Connect Grafana with the Infinity data source
- Confirm the plan: Grafana data access needs a Business plan or higher, or an active trial.
- Install Grafana's Infinity data source. Grafana Cloud already includes it; self-managed Grafana installs the
yesoreyeram-infinity-datasourceplugin from the Grafana plugin catalog and restarts Grafana if asked. - Add an Infinity data source with URL
https://www.hitsteps.com/api/grafana.php(or base URLhttps://www.hitsteps.comand request path/api/grafana.php). - On the Authentication tab choose Bearer Token and paste the full 37-character site API code into the token field. Keep it in Grafana's protected secret setting; never put it in a panel URL or a dashboard query.
- In Allowed hosts enter
https://www.hitsteps.com/so Grafana permits requests to the connector. - Save and test the data source. Grafana should make requests from its server, not from a browser panel.
- Download the ready-made dashboard JSON from https://www.hitsteps.com/api/hitsteps-grafana-dashboard.json, open Dashboards → Import, upload it, and select your Hitsteps Infinity data source when Grafana asks. The import file contains no API key.
- Panels cover pageviews, visits, new visitors, bounce rate, sources, countries, search, technology, live visitors, top/entry/exit pages, referrers, downloads, outbound links, videos, goals, AI referrals, Segments and Funnels. The dashboard refreshes every five minutes by default.
Read-only report queries look like this:
{"action":"top_pages","days":30,"limit":10}
Supported report actions: query, live, top_pages, entry_pages, exit_pages, top_referrers, countries, search_engines, search_keywords, technology, downloads, outbound_links, actions, videos, goals, ai_referrals, triggers, funnels, funnel_steps, plus the diagnostic info action for connection tests. The endpoint supports hour, day, week and month grains and accepts Grafana epoch-millisecond values in from and to to follow a dashboard time range. Hourly queries are limited to 31 days and use the retained hourly rollup, which does not keep bounce, bot or social-source dimensions; use daily or coarser grains for those metrics. info returns the authorized website and metric names without returning the API key.
E. Connect Looker Studio (Data Studio)
- Confirm the plan: Looker Studio reporting needs a Business plan or higher, or an active trial.
- In Hitsteps, open My websites, choose the website, open its Settings, find the Tracking Code section and copy the full API code. It is 37 characters and Data Studio needs the whole code, not a short version.
- In Data Studio choose Add data, then Hitsteps. Paste the API code into the key field.
- Pick one of the 10 reports and set a start and end date. Traffic over time returns one row per day; the other reports list the top rows for the range, up to 50.
- Add one data source per website. A second client site needs its own data source and its own API code.
- If the numbers for the chosen dates are not ready, Data Studio shows an error; it does not fill the report with zeros. To load the latest numbers, an editor can choose Refresh data. Numbers from Hitsteps can be up to an hour old.
The 10 reports are: Traffic over time, Top pages, Entry pages, Exit pages, Referrers, Countries, Technology, AI referrals, Search engines and Goals.
F. Automate a daily pull with n8n
The Reports API quickstart documents a native n8n workflow that needs no Hitsteps plugin:
- Add an HTTP Request node with a credential of type Header Auth (Name
Authorization, ValueBearer <your key>). The key lives in the credential, not in the workflow. - Set the node to POST and the URL to
https://www.hitsteps.com/api/reports-v2.php. - Add a small Code node that returns the previous complete account-local day in seconds, so you never hardcode timestamps.
- Set the request body to
{"from": {{ $json.from }}, "until": {{ $json.until }}}(n8n sets the JSON content type itself). - Read the report further down the workflow through
{{ $json.result.rows }}and{{ $json.result.totals }}.
The same pattern works in any scheduler or HTTP client. Results for the same report and days are cached for up to an hour, so schedule runs at most every 15 minutes.
G. White-label API (resellers)
The White-label API provisions accounts and sites for reseller deployments. It is only for accounts that already have white-label; there is no public key signup. The reference is inside the product: sign in at https://www.hitsteps.com/api/whitelabel-doc to open it. The public OpenAPI 2.0 specification file is at https://www.hitsteps.com/api/whitelabel.oas2 and lists the documented actions such as obtaining an access token and provisioning sites. Treat this API as account-gated: linking the spec does not make the reference public.
H. Other product hooks (not general developer APIs)
- Form integration hooks. The WordPress plugin includes integrations for Contact Form 7, Gravity Forms, Ninja Forms and WooCommerce. Use the plugin’s supported setup and the form analytics chapter; these are not standalone developer APIs.
- Uptime notifications. Use the supported monitoring and alert-channel setup in the uptime chapter. No general-purpose customer webhook API is promised here.
- Feedback delivery and key pages. These are product features, not documented standalone developer APIs. Use the public Reports or Analytics API for supported retrieval; do not build integrations against undocumented dashboard or service endpoints.
Worked example #
Suppose a developer runs an online store called your-store.example. They saved a Pages report in Hitsteps that counts pageviews and unique visitors per page URL, with no comparison, and created a Reports API key with a 30-day expiry.
The request for the previous complete account-local day (their account is fixed at UTC+02:00) is the single POST shown in section 4B. A successful response has HTTP 200 and a body shaped like this (illustrative values, not a real customer's data):
{
"ok": true,
"version": 2,
"report_id": 103,
"report_revision": 1,
"result": {
"dataset": "pages",
"timezone_offset": 7200,
"current": {
"from_date": "2026-11-05",
"until_date": "2026-11-06",
"days": 1
},
"rows": [
{
"dimension_1": {"id": "page.url", "value": "/pricing", "state": "set"},
"pageviews": "120",
"unique_visitors": "38"
},
{
"dimension_1": {"id": "page.url", "value": "/help", "state": "set"},
"pageviews": "34",
"unique_visitors": "12"
}
],
"totals": {"pageviews": "154", "unique_visitors": "50"},
"warnings": [],
"has_more": false
}
}
Expected result: the script prints the two rows and the totals, converts the string numbers before doing any maths, and stores the result privately. The day shown in current uses the account's local dates. If the report had no data on that day, rows would be an empty array with a still-successful status. If the developer asked for a window that includes today, starts before retained history, or spans more than 31 days, the API answers 422 report_unavailable instead. This example is illustrative; it does not describe a real customer account or a measured result.
Controls and metrics #
| Term | Meaning |
|---|---|
| Site API code / API key / tracking code | The 37-character code shown for a website, used by plugins, desktop apps and reporting connectors. Its authority depends on the endpoint: legacy owner API operations can expose account-wide website information. Treat the full code as a secret; a website label does not make it a least-privilege credential. |
| Tracking code | The full JavaScript snippet for manual HTML installs. Different from the short API key; use the one your platform asks for. Do not install both the plugin and the manual snippet on the same page, because that can double-count visits. |
| Reports API | The current JSON API that returns one saved report (POST /api/reports-v2.php). Credential: a per-report Bearer key. |
| Reports API key | A key bound to one saved report and its revision. Expiry 1, 7, 30 or 90 days. Editing the report, deleting it, or losing owner access invalidates it. |
| Analytics API (callback API) | The original website-level API at POST /api/callback/<action>. Credential: apicode plus website_id for most actions. |
from / until |
First included account-local day (start, inclusive) and start of the day after the last included day (exclusive), both integer Unix timestamps in seconds. |
rows / totals |
Current-period breakdown rows and totals of the saved report. Empty rows mean no matching data, not an API failure. |
dimension_1 |
A breakdown cell carrying its field ID, value and state. Keep missing distinct from empty. |
has_more / row_cap / warnings |
Truncation and semantic-warning metadata. The result follows the saved sort and row limit; there is no pagination parameter. Do not present a limited table as an exhaustive export. |
| Metric precision | Metrics come back as exact decimal strings or null, not numbers. Convert before maths; do not treat null as zero, and do not add unique counts or ratios across date chunks to get an exact longer-period total. |
| Bearer token | The authentication scheme used by the Reports API header and the Grafana connector. |
available / availability_reason |
Connector readiness flags. available=false with a reason means the numbers are not ready yet; an empty data array without that flag is a valid zero-row result. |
plan_required |
HTTP 403 error returned below the Business plan for Grafana and Looker Studio access. |
| Grain | The time bucket of Grafana reports: hour, day, week or month. Hourly is limited to 31 days and uses a rollup without bounce, bot or social-source dimensions. |
| Rate limits | Reports API: 6 requests per minute and 60 per hour per key, and 240 per hour per website across all its keys. Analytics API: no published quota; repeated failed API-code attempts are throttled with HTTP 429 and Retry-After. |
| Result cache | Reports for the same report and days are cached up to an hour, so polling more often than every 15 minutes gains nothing. |
| Key pages | A legacy site list of categorized important pages, exchanged by a site-code endpoint that Hitsteps plugins use. Not a general developer API. |
Problems and fixes #
401 unauthorizedon the Reports API. Check the Bearer header, the key and its expiry. Saving changes to the report invalidates its keys; create a replacement key in that report. A website tracking code will not work here.422 report_unavailable. The window includes today, starts before your retained history, spans more than 31 days, or the data is still processing. Shorten the range, use complete account-local days in your account's offset, or wait. Unavailable data is not an empty report.400 invalid_request. Send only integerfromanduntil(each between 1 and 2147483647,until > from). Check for milliseconds, extra fields, or invalid JSON.403 not_availableorplan_required. Open the report in the dashboard and check feature availability and plan access; for Grafana and Looker Studio, Business plan or higher (or an active trial) is required. Reduce the range if the report is too expensive. Do not keep retrying without a change.429 rate_limited. Wait at least theRetry-Aftervalue in seconds and spread requests out. Reuse cached results instead of creating extra keys to bypass limits.404 not_foundon the Reports API. The endpoint may be disabled on the deployment. Confirm feature availability with support.- A web browser shows an error when you open the endpoint. Use POST from your server, not a browser GET. Opening the endpoint in a browser is not a report request.
- Numbers look wrong or missing. Confirm the tracker collected data for the dates, use complete account-local days for your account's offset, and expect that recent completed days can still be processing. The current day is never served. A blank or waiting report is not zero traffic.
- Values come back as strings or
null. That is the designed precision. Convert explicitly and never treat unavailable values as zero. - Looker Studio shows an error instead of numbers. The numbers for those dates are not ready yet; the connector shows an error, not zeros. Use Refresh data for the latest numbers, which can be up to an hour old.
- Grafana panels are empty. Check the Infinity query: Bearer token in the data source (never in the panel), Allowed hosts set to
https://www.hitsteps.com/, thedataroot selector, and a grain your plan and rollup support. - I cannot create a Reports API key. The report type may not support it yet (use the Analytics API instead), or the website's report data has not finished processing. Check support if it stays missing after visits.
Access, privacy and limits #
- The Grafana connector returns aggregate analytics without visitor identities, individual Segment matches or Funnel events. Legacy account and website operations return account/website metadata; keep that information and its credentials private. Do not assume every endpoint or exported report has the same data scope.
- Keep credentials server-side. Never place a password, API code, report key, or visitor data in browser JavaScript, public repositories, URLs, screenshots, or support messages. The documentation pages never accept credentials and never make authenticated requests for you.
- Reports API keys expire after 1, 7, 30 or 90 days. Rotate them and revoke a lost key in the saved report's API section. Editing or deleting the report, or losing the owner's access, stops authorized reads.
- Grafana and Looker Studio data access require a Business plan or higher, or an active trial (current plan details at https://www.hitsteps.com/features.php#price). Below Business, the endpoints answer
403 plan_required. This chapter does not state exact prices; check the plan page. - The Reports API answers
422 report_unavailablefor windows that include today, start before retained history, or exceed the 31-day default range. The API cannot return expired history. - Rate limits: Reports API 6 requests per minute and 60 per hour per key, and 240 per hour per website. Analytics API has no published quota; failed API-code attempts are throttled with HTTP 429 and
Retry-After. - Role and access depend on the API and credential. A Reports API key is bound to one saved report and revision. Grafana and Looker Studio reads select a website and enforce its access checks. The legacy API accepts owner and delegated-user credentials with different authority: an owner API code can access account-wide operations such as
getListofTrackingWebsites, which can return other accessible websites and their API codes. Treat it as an account credential, not a one-website least-privilege key. Delegated access remains subject to the permitted websites and operation checks. Prefer a report-scoped key when only one saved report is needed. - Write actions:
newTrackingAPIandnewTrackingUserin the Analytics API add a website to an account. Only call them from code meant to create sites, and protect the credentials that can do so. - The API does not edit reports, create schedules, or email results. Scheduled dashboard CSV exports and email reports are separate product features (see the reports and exports chapter) and do not require an API key.
- Exact per-plan retention windows and any future limits are verified on the current plan page; this chapter lists only the limits stated in the current public documentation. Undocumented dashboard and service endpoints are not supported public developer APIs.
Last checked #
Checked 8 November 2026 using product documentation and source, with public pages and safe sample screens where available. Account-specific access, provider controls and effective limits can differ; use the current message shown for your website. Examples are illustrative.