Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cognerd.in/llms.txt

Use this file to discover all available pages before exploring further.

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

POST https://api.cognerd.in/api/brand-monitor/analyze

Request headers

Authorization
string
required
Your API token in the format Bearer YOUR_TOKEN. Obtain this from your CogNerd account settings.
Content-Type
string
required
Must be application/json.
Accept
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

brandUrl
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.
brandName
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.
prompts
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.
userSelectedCompetitors
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.
baseQuery
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:
data: {"type":"...","stage":"...","data":{...},"timestamp":"..."}
Events arrive in the following sequence as the pipeline progresses through its stages.

Pipeline stages

StageDescription
initializingPipeline has started. Credit check passed.
identifying-competitorsCogNerd is identifying your competitors via AI or using your provided list.
generating-promptsPrompts are being generated or validated.
analyzing-promptsEach prompt is being sent to every configured AI provider.
calculating-scoresVisibility scores and competitor rankings are being computed.
finalizingAnalysis is complete. Final result is about to be emitted.

Event types

type
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.
data.overview
object
High-level mention and score summary.
data.visibility
object
Detailed visibility metrics broken down by time and platform.
data.competitors
object
Competitor ranking data.
data.alerts
object
Automatically generated alerts based on analysis results.
data.sources
object
Source attribution data mapping AI citations back to specific pages on your site.
data.prompts
object
Analytics for each prompt used in the analysis.
data.interruptedRun
boolean
true if a previous analysis run was interrupted before completing. When present, the dashboard displays a recovery banner.

Error responses

StatusMeaning
400Invalid or missing request body. Check that brandUrl or brandName is provided.
401Missing or invalid Authorization header.
402Insufficient credits. You need at least 30 credits to run an analysis.
500Internal server error. The stream may emit an error event before closing.

Code examples

curl --no-buffer \
  --request POST \
  --url https://api.cognerd.in/api/brand-monitor/analyze \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Content-Type: application/json' \
  --header 'Accept: text/event-stream' \
  --data '{
    "brandUrl": "https://yoursite.com"
  }'

Example SSE stream (truncated)

data: {"type":"start","stage":"initializing","data":{"stage":"initializing","progress":0,"message":"Starting analysis for Acme Corp"},"timestamp":"2026-04-27T10:00:00.000Z"}

data: {"type":"stage","stage":"identifying-competitors","data":{"stage":"identifying-competitors","progress":0,"message":"Identifying competitors..."},"timestamp":"2026-04-27T10:00:01.000Z"}

data: {"type":"competitor-found","stage":"identifying-competitors","data":{"competitor":"Rival Co","index":1,"total":3},"timestamp":"2026-04-27T10:00:03.000Z"}

data: {"type":"stage","stage":"generating-prompts","data":{"stage":"generating-prompts","progress":0,"message":"Generating analysis prompts..."},"timestamp":"2026-04-27T10:00:04.000Z"}

data: {"type":"prompt-generated","stage":"generating-prompts","data":{"prompt":"What are the best project management tools for remote teams?","category":"category_authority","index":1,"total":4},"timestamp":"2026-04-27T10:00:05.000Z"}

data: {"type":"partial-result","stage":"analyzing-prompts","data":{"provider":"ChatGPT","prompt":"...","response":{"provider":"ChatGPT","brandMentioned":true,"brandPosition":2,"sentiment":"positive"}},"timestamp":"2026-04-27T10:00:20.000Z"}

data: {"type":"result","stage":"finalizing","data":{"overview":{"mentions":{"total":12,"explicit":9,"implicit":3},"citations":{"total":5},"scores":{"visibilityScore":67,"averagePosition":2.3},"opportunities":4},"visibility":{"score":67,"dailyTrend":[{"date":"2026-04-27","score":67}],"platformBreakdown":[{"platform":"ChatGPT","score":72,"mentions":5,"citations":3,"sentiment":"positive","change":4},{"platform":"Gemini","score":61,"mentions":4,"citations":2,"sentiment":"neutral","change":-1}]},"alerts":{"alerts":[{"id":"alert-1","type":"visibility_spike","title":"Visibility spike on ChatGPT","description":"Your visibility on ChatGPT increased by 4 points.","time":"just now"}]},"sources":{"sources":[{"domain":"yoursite.com","urls":["https://yoursite.com/features"],"mentions":8,"citations":3}]},"prompts":{"prompts":[{"prompt":"What are the best project management tools?","visibility":72,"avgPosition":2,"trending":true}]}},"timestamp":"2026-04-27T10:01:10.000Z"}