Need public brand information? Keyless Brand Index reads require no credentials.

Developer reference · REST

Keyed REST API

Ordinary HTTP against a bearer key. The same records the application and the MCP connector read, exposed as 14 routes under /api/v2.

Authentication

Send a key as a bearer credential. The key resolves the organization, and the brand comes from the key or from the request. No route takes a brand id in its path.

curl https://app.optimly.ai/api/v2/brand \
  -H "Authorization: Bearer $OPTIMLY_KEY" \
  -H "X-Optimly-Brand: $BRAND_ID"

Every brand in the organization

An sk_live_… key created under Connections, shown once, with its scope left on every brand — the default. Each request selects one with an X-Optimly-Brand header, and GET /api/v2/brands lists the ids it accepts. The same key works on the MCP connector, where the tool call carries the brand instead of a header.

One brand

The same key, created with a single brand chosen. It pins that brand, so no request needs to name one, and a selector naming a different brand is ignored rather than obeyed.

Routes

MethodPathReturns
GET /api/v2/brands Every brand in the key's org, ordered by name — the ids an `X-Optimly-Brand` selector accepts. A brand-scoped key sees only its own brand.
POST /api/v2/brands Create a brand in the key's organization. Org-scoped keys only — a brand-scoped key gets 403 `org_scoped_credential_required` — and the key's owner must be a trusted user (`trust_required` otherwise). An exact canonical-URL match returns the existing brand with `created: false` and HTTP 200; a new brand returns 201, queues the site prefill, and starts no interview or report run.
GET /api/v2/brand Identity meta: name, canonical domain, slugs, and claim state.
GET /api/v2/vault The active vault — every section with its `publish_state`, plus competitors and disambiguation.
PUT /api/v2/vault Update and publish. Partial updates are allowed: sections you omit copy forward. Recorded with `origin_source='api'`.
GET /api/v2/recommendations Every recommendation for the key's brand.
PATCH /api/v2/recommendations/{rec_id} Act on a recommendation. `acted_by` stays NULL — the key acted, not a signed-in user — so the attribution overlay reads `acted_at` alone.
GET /api/v2/reports Every report for the key's brand, newest version first.
GET /api/v2/reports/{report_id} Report detail: the frozen summary metrics and the run's panel snapshot.
GET /api/v2/reports/{report_id}/questions Question Analysis: every question with its per-model answers and judgments.
GET /api/v2/reports/{report_id}/sources Sources: per-domain citation aggregation with owned / competitor / third-party classification.
GET /api/v2/attribution The attribution overlay: the metric trend across the brand's report versions plus the acted-on recommendation timeline.
GET /api/v2/vault/versions Version metadata for the key's brand, newest first.
GET /api/v2/vault/versions/{version} One version snapshot: its metadata plus the full section rows.

Conventions

Reports are read-only

Every route that returns report data is a GET. No route starts a run: measurement runs on schedules set in the application, so a report appears when the schedule produces it.

Writing is three operations

PUT /api/v2/vault publishes a brand profile, PATCH /api/v2/recommendations/{rec_id} acts on a recommendation, and POST /api/v2/brands creates a brand. The first two address an existing brand; brand creation does not. Partial vault updates are allowed — sections you omit copy forward — and the write is recorded with its origin, so an API-authored change is distinguishable from one made in the application.

Creating a brand

POST /api/v2/brands takes name and website_url. It is org-scoped only: a brand-scoped key answers 403 with code org_scoped_credential_required. The key's owner must be a trusted user; an untrusted or ownerless credential answers 403 with code trust_required.

An exact canonical-URL match already in the organization is idempotent: the existing brand is returned with created: false and HTTP 200. A new brand returns 201 with created: true, queues the site prefill, and starts no interview or report run. Archived brands are excluded from the match, so re-adding an archived URL creates a new brand.

curl -sS -X POST 'https://app.optimly.ai/api/v2/brands' \
  -H "Authorization: Bearer $OPTIMLY_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"name": "Example Company", "website_url": "https://example.com"}'

Rate limit

60 requests per minute per key. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset (epoch seconds). A request over the limit answers 429; the body's details.retry_after says how long to wait.

Errors

Failures share one envelope with a machine-readable code, a human message, and any details the specific failure adds:

{
  "error": {
    "code": "org_scoped_credential_required",
    "message": "A brand-scoped key cannot create a brand — use an org-scoped key.",
    "details": { "reason": "brand_scoped_credential" }
  }
}

The same envelope is what the MCP connector surfaces as a tool error, so an agent sees the same message a script would.

The previous version

Anything under /api/v1 answers 410 Gone with a pointer to /api/v2.

Related

The MCP connector covers the same records for MCP clients, and is usually the shorter path for an agent. The public brand data quickstart covers the keyless read surface, which is separate from this API.