Skip to content

Authentication

The versioned /api/v1/* endpoints on the web app authenticate with long-lived AnswerixAI API keys (prefix ans_), created under Settings → MCP & API Keys in the dashboard:

Terminal window
curl "https://app.answerixai.com/api/v1/brands" \
-H "Authorization: Bearer ans_..."

This is the right choice for external integrations — Looker Studio, Sheets, scripts, and the MCP server. See the Metrics API reference for the endpoint list.

AI apps such as Claude and ChatGPT can connect to the MCP endpoint, https://app.answerixai.com/api/mcp, by signing the person in instead of with an API key. The web app is the authorization server (OAuth 2.1 with PKCE S256, as the MCP authorization spec 2025-11-25 has it), with the issuer https://app.answerixai.com:

  • An app finds it from the endpoint’s 401 (WWW-Authenticate: Bearer resource_metadata="https://app.answerixai.com/.well-known/oauth-protected-resource/api/mcp", scope="mcp:read mcp:write"), then /.well-known/oauth-authorization-server.
  • It registers with a Client ID Metadata Document or by dynamic client registration (POST /api/oauth/register), sends the person to /api/oauth/authorize, and redeems the code at /api/oauth/token.
  • Scopes: mcp:read (every list_ and get_ tool) and mcp:write (every other tool), which the person can leave out on the consent page.
  • Access tokens (ans_oat_…) last an hour. Refresh tokens (ans_ort_…) last 30 days and rotate on every use. Both are bound to the MCP endpoint (RFC 8707 resource).
  • A token acts as the person who allowed it, with their role and brand access. They see and disconnect it in Settings → MCP & API Keys → Connected apps; an app revokes its own at /api/oauth/revoke (RFC 7009).

These tokens work at /api/mcp only. The Metrics API (/api/v1/*), the REST routes under /api/mcp/… and the server’s /api/* refuse them with 401. On AnswerixAI Cloud, app sign-in needs a paid plan; API keys work on every plan. The MCP server guide has the full flow, lifetimes and errors.

All /api/* endpoints on the AnswerixAI server require a Supabase JWT bearer token in the Authorization header:

Terminal window
curl https://api.your-domain.com/api/health \
-H "Authorization: Bearer <SUPABASE_JWT>"

The cleanest way is via the Supabase JS client in your own backend code:

import { createClient } from "@supabase/supabase-js";
const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
const {
data: { session },
} = await supabase.auth.signInWithPassword({
email,
password,
});
const token = session.access_token;

The web app does this automatically — every server action and fetch attaches the current session token transparently.

A handful of internal endpoints under /api/internal/* (used by Vercel Cron and the Stripe success callback) authenticate via a shared CRON_SECRET instead of user tokens:

Terminal window
curl -X POST https://api.your-domain.com/api/internal/daily-tracking \
-H "Authorization: Bearer $CRON_SECRET"

The same secret must be configured on both sides (Vercel env + server env).

Three endpoints don’t require any auth:

  • GET /t.js — tracking pixel script
  • POST /track/{trackingCode} — tracking pixel beacon (the tracking code identifies the brand; rate-limited)
  • GET / — basic uptime check, returns { "status": "ok", "service": "aeo-server", "mode": "cloud", "timestamp": "..." }
Continue: Brands API

CRUD endpoints for managing brands programmatically.