Introducing: The Panelbear API

Anthony N. Simon

May 13, 2021·2 min read

Today I'm happy to introduce the Panelbear API for all developers. You can now access Stats API: the fast analytics engine that powers all features on Panelbear. In addition, the Sites management API is also available as of today.

These two APIs, enable you to build your own analytics dashboards, power functionality outside of Panelbear, automate workflows and more!

Panelbear API example request via terminal

Here's a few examples of what you can do:

  • Query the analytics data to power your own dashboards.
  • Use real time traffic data to automate workflows on your end.
  • Build powerful analytics integrations.
  • Manage multiple sites in bulk.

The API is available over a REST interface over HTTP. At the moment only the Sites and Stats endpoints are available, but more functionality will be added over time.

To make it as easy as possible to try out, I included API access on all pricing plans, subject to your plan’s quota.

To get started, create an Auth Token to make authenticated requests against the API. You can do so easily from your account's Settings > Auth Tokens page.

Auth tokens

Then, simply grab the TOKEN secret, and the SITE_ID for one of your sites, and run your stats queries.

For example, the following JSON query returns the average load time per day over the past 3 months:

$ curl -X POST \
      -H "Authorization: Bearer <TOKEN>" \
      -H "Content-type: application/json" \
      "https://api.panelbear.com/v1/stats/timeseries" \
      -d '{
           "site_id": "<SITE_ID>",
           "period": "3m",
           "time_bucket": "day",
           "aggregate": ["page_load_avg"]
       }'

< HTTP/1.1 200 OK
< Content-Type: application/json
{
   "time_bucket": "day",
   "data": [
       {
           "ts": "2021-01-01T00:00:00Z",
           "page_load_avg": 550
       },
       {
           "ts": "2021-01-02T00:00:00Z",
           "page_load_avg": 580
       },
       {
           "ts": "2021-01-03T00:00:00Z",
           "page_load_avg": 563
       }
       ...
   ]
}

For a complete guide on how to use the API and the available endpoints, head over to our API documentation.

Have suggestions, or feedback? Feel free to reach out anytime.


Share article

Website traffic and performance insights.

Free plan available · No credit card required

Start for free
Panelbear dashboard