API Reference

Query your analytics programmatically. Available on Pro and Business plans.

Authentication

Generate an API key from the Connections page in your dashboard. Include it as a Bearer token in every request:

Authorization: Bearer ca_live_your_api_key_here

Endpoints

Base URL: https://api.clawanalytics.ai

POST /v1/query

Send a natural language question and get a structured answer with data and charts.

Request body:

{
  "question": "How many visitors today?",
  "propertyId": "optional — omit to use default property"
}

Response:

{
  "answer": "You had 1,247 visitors today, up 12% from yesterday.",
  "data": [{ "date": "2026-02-17", "visitors": 1247 }],
  "chartUrl": "https://api.clawanalytics.ai/charts/abc123.png",
  "conversationId": "conv_xyz",
  "usage": { "used": 24, "limit": 500 }
}

GET /v1/properties

List all connected GA4 properties.

[
  { "id": "properties/123456", "name": "My Website", "url": "https://example.com" }
]

GET /v1/usage

Check your current plan and query usage.

{
  "plan": "pro",
  "used": 24,
  "limit": 500,
  "resetDate": "2026-03-01"
}

Code Examples

cURL

curl -X POST https://api.clawanalytics.ai/v1/query \
  -H "Authorization: Bearer ca_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"question": "How many visitors today?"}'

Python

import requests

response = requests.post(
    "https://api.clawanalytics.ai/v1/query",
    headers={"Authorization": "Bearer ca_live_your_key"},
    json={"question": "How many visitors today?"}
)

data = response.json()
print(data["answer"])

JavaScript

const response = await fetch("https://api.clawanalytics.ai/v1/query", {
  method: "POST",
  headers: {
    "Authorization": "Bearer ca_live_your_key",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ question: "How many visitors today?" })
});

const data = await response.json();
console.log(data.answer);

Rate Limits & Errors

The API is rate-limited to 60 requests per minute.

Error Code HTTP Status Description
AUTH_ERROR 401 Invalid or missing API key
PLAN_ERROR 403 API access requires Pro or Business plan
USAGE_LIMIT 429 Monthly query limit reached
RATE_LIMIT_EXCEEDED 429 Too many requests per minute (max 60/min)
TIMEOUT 504 Query took too long to process