Docs / Reference / API quickstart

API quickstart

Authenticate against the AskThis REST API and pull your first analytics data in a few minutes.

The REST API exposes your sites, configuration, prompts and analytics. It’s available on Pro plans and above; programmatic write access at scale is part of Enterprise.

Authentication

Create an API key under Settings → API keys in the dashboard (available on Pro and above), then send it as a bearer token:

curl https://api.askthis.io/api/v1/sites \
  -H "Authorization: Bearer ak_xxxxxxxxxxxx"

Keys are scoped to your account (see API keys) and can be restricted to read-only. Treat them like passwords — anyone holding a key can read your analytics.

Your first request

Pull 30 days of AI-click analytics for a site. Every response uses the standard envelope — your data is under data:

curl "https://api.askthis.io/api/v1/analytics/cq_8f2a/ai?days=30" \
  -H "Authorization: Bearer ak_xxxxxxxxxxxx"
{
  "data": {
    "totals": { "aiClicks": 967, "days": 30 },
    "series": [{ "date": "2026-06-01", "value": 31 }],
    "byPlatform": [{ "platform": "chatgpt", "value": 402 }]
  },
  "error": null,
  "meta": { "requestId": "req_..." }
}

Swap ai for social or questions for the other segments.

Core endpoints

Endpoint Purpose
GET /api/v1/sites List sites and install status
GET /api/v1/sites/:id Site detail + widget configuration
GET /api/v1/analytics/:siteId/ai?days=30 AI-click analytics (also /social, /questions)
GET /api/v1/analytics/:siteId/pages Per-page performance
GET /api/v1/analytics/:siteId/export?format=csv&kind=ai CSV / PDF export (Pro+)
GET /api/v1/prompts/:siteId Generated prompt templates for a site
PUT /api/v1/sites/:id/config Update widget configuration
GET /api/v1/sites/:siteId/llms.txt Generated llms.txt (public)

Rate limits and errors

Rate-limited endpoints return X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers, plus a 429 with Retry-After when you exceed the limit. Errors use the standard envelope with an uppercase code:

{ "data": null, "error": { "code": "RATE_LIMITED", "message": "…" }, "meta": { "requestId": "req_..." } }

See Errors & rate limits for the full list. For webhooks, see Webhooks; to authenticate, see API keys.