Resources

Ɨ

Visual CMS

Drag-and-drop visual editor and headless CMS for any tech stack

Theme Studio for Shopify

Build and optimize your Shopify-hosted storefront, no coding required

Resources

Blog

Get StartedLogin

ā˜°

Home

Forum

Blog

Github

Login

Signup

Made in Builder

Builder.io Analytics API

With the Analytics API you can query any analytics you have in Builder using SQL.

Creating an API Key

First, you'll need to create a private key. Go over to your organization settings page (be sure to have Developer or Admin permissions) and create a private key and copy it.

Note: Be careful with this key and keep it secret! It allows anyone to have write access to your content in Builder. Only use it in API calls from your server, not any calls from public client applications.

Using the API

To query your analytics in Builder, send a GET request like below

curl 'https://cdn.builder.io/api/v1/query-metrics?query=SELECT COUNT(*) FROM @EVENTS WHERE TYPE = "CLICK"'
  -H 'Authorization: Bearer YOUR_PRIVATE_KEY'

# Example response
# {
#  "results": [{ COUNT: 123 }]
# }

API Enablement

The Analytics API is only available with Builder Enterprise plans. For full details on usage of the API, please contact our support team.

Was this article helpful?