Skip to main content
The analyze endpoint runs CogNerd’s full brand intelligence pipeline against your brand and streams progress and results back in real time using Server-Sent Events (SSE). Each call costs 30 credits and is validated before the pipeline starts. The stream delivers incremental progress events as each stage completes, followed by a final result containing your AI visibility score, platform breakdown, competitor rankings, sentiment, alerts, source attribution, and prompt analytics.
This endpoint costs 30 credits per call. Your credit balance is checked before the pipeline starts. If you have fewer than 30 credits, the request is rejected with a 402 error and no credits are consumed.
This endpoint uses Server-Sent Events (SSE), not standard JSON. The response content type is text/event-stream. Use fetch with a streaming reader in JavaScript, or curl with --no-buffer in the terminal. Do not call this endpoint with a standard REST client expecting a JSON body.

Endpoint

Request headers

string
required
Your API token in the format Bearer YOUR_TOKEN. Obtain this from your CogNerd account settings.
string
required
Must be application/json.
string
Set to text/event-stream to receive SSE output. If omitted, most HTTP clients will still receive the stream but may buffer it.

Request body

string
The full URL of the brand to analyze, including scheme (e.g., https://yoursite.com). CogNerd scrapes this URL to extract brand metadata before running analysis. Provide either brandUrl or brandName, not both.
string
The brand name to analyze, used when you do not have a URL or want to analyze a brand by name only. CogNerd uses this name directly in prompt generation and scoring.
array
An optional array of pre-built prompt objects to use instead of auto-generated prompts. If omitted, CogNerd generates up to 4 prompts automatically based on your brand, industry, and competitors.
array
An optional list of competitor brands to track. If provided, CogNerd uses this list instead of identifying competitors automatically via AI. Maximum 8 competitors.
When true, CogNerd runs each prompt through AI providers with live web search enabled (where the provider supports it). This produces more up-to-date results but may increase analysis time.
string
An optional seed query to prepend to the generated prompt list. Useful for anchoring the analysis around a specific question or topic relevant to your brand’s audience.

SSE event stream

The response is a stream of newline-delimited SSE events. Each event has the format:
Events arrive in the following sequence as the pipeline progresses through its stages.

Pipeline stages

Event types

string
The type of SSE event. Possible values:
  • start — Pipeline has begun.
  • stage — A new pipeline stage has started. Includes stage name and progress (0–100).
  • progress — Progress update within a stage. Includes progress (0–100) and a human-readable message.
  • competitor-found — A competitor was identified. Includes competitor name, index, and total.
  • prompt-generated — A prompt was generated. Includes prompt text, category, index, and total.
  • prompt-dequeued — A prompt has started processing across all providers.
  • analysis-start — A specific provider has started analyzing a prompt.
  • analysis-complete — A specific provider finished analyzing a prompt. status is completed or failed.
  • partial-result — A provider returned a result for one prompt. Contains brandMentioned, brandPosition, and sentiment.
  • prompt-complete — All providers finished a prompt successfully.
  • prompt-failed — All or some providers failed for a prompt.
  • scoring-start — Competitor scoring has started for one competitor.
  • result — Final analysis result. Contains the full structured output described below.
  • error — A fatal error occurred and the stream is closing.

Final result event

When the pipeline finishes, a result event is emitted containing the complete analysis object.
object
High-level mention and score summary.
object
Detailed visibility metrics broken down by time and platform.
object
Competitor ranking data.
object
Automatically generated alerts based on analysis results.
object
Source attribution data mapping AI citations back to specific pages on your site.
object
Analytics for each prompt used in the analysis.
boolean
true if a previous analysis run was interrupted before completing. When present, the dashboard displays a recovery banner.

Error responses

Code examples

Example SSE stream (truncated)