Skip to main content

Developer recipe

Check if ChatGPT mentions your brand in one API call

Send one buyer prompt to ChatGPT and receive the mention status, position, answer text, cited sources, sentiment, competitors, and explicit failure state in one JSON response.

The Foglift AI Visibility API uses the brand and domain already attached to your workspace. The recipe runs as a dry check, so it does not add an ad hoc prompt to monitoring history.

check-chatgpt-mention.mjs
// check-chatgpt-mention.mjs (Node.js 22+)
const apiKey = process.env.FOGLIFT_API_KEY;
const prompt = process.env.BUYER_PROMPT ??
  "Which AI search monitoring tools are best for a small SaaS team?";

if (!apiKey) throw new Error("Set FOGLIFT_API_KEY first.");

const response = await fetch("https://foglift.io/api/v1/ai-visibility", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-API-Key": apiKey,
  },
  body: JSON.stringify({
    prompts: [prompt],
    models: ["chatgpt"],
    dry_run: true,
    ...(process.env.FOGLIFT_BRAND_ID
      ? { brand_id: process.env.FOGLIFT_BRAND_ID }
      : {}),
  }),
});

const payload = await response.json();
if (!response.ok) {
  throw new Error(
    payload.message ??
      payload.error ??
      `Request failed with HTTP ${response.status}`,
  );
}

const result = payload.results?.find((item) => item.model === "ChatGPT");
if (!result || result.error) {
  console.error(result?.error ?? "ChatGPT returned no usable result.");
  process.exit(2);
}

console.log(JSON.stringify({
  prompt: result.prompt,
  mentioned: result.brand_mentioned,
  position: result.position,
  sentiment: result.sentiment,
  citations: result.citations,
  competitors: result.competitor_mentions,
}, null, 2));

process.exit(result.brand_mentioned ? 0 : 1);

Run it

One request, three honest outcomes

Save the script, choose the buyer question that matters, and run it with Node.js 22 or later. A multi-brand API key can set FOGLIFT_BRAND_ID to select the workspace explicitly.

  1. 1. Exit 0 means mentioned. ChatGPT completed the prompt and named the tracked brand.
  2. 2. Exit 1 means absent. ChatGPT completed the prompt without naming the tracked brand.
  3. 3. Exit 2 means no usable evidence. The provider result was missing or carried an error, so the script does not turn that failure into a false absence.
Terminal
export FOGLIFT_API_KEY=sk_fog_your_api_key
export BUYER_PROMPT="Which AI search monitoring tools are best for a small SaaS team?"
node check-chatgpt-mention.mjs

# Exit 0: mentioned
# Exit 1: completed answer, brand absent
# Exit 2: no usable ChatGPT evidence
Example output
{
  "prompt": "Which AI search monitoring tools are best for a small SaaS team?",
  "mentioned": true,
  "position": 3,
  "sentiment": "positive",
  "citations": ["https://example.com/source"],
  "competitors": ["Competitor A"]
}

Prompt design

Ask the buyer's question, then keep it fixed

A useful mention check measures whether ChatGPT selects your brand for a real category question. Putting the brand name inside a recommendation prompt changes the task from discovery to recall.

Category

Name the decision

Use a question such as “Which AI search monitoring tools are best for a small SaaS team?”

Control

Freeze the variables

Keep the prompt text, ChatGPT engine, locale, and workspace brand stable when comparing runs.

Evidence

Inspect more than the boolean

Position, answer text, citations, sentiment, and competitors explain what the mention status alone cannot.

Pricing and limits

ChatGPT API checks start on Launch at $49/mo

This recipe uses one API request and one ChatGPT prompt-engine check. The request counts against the API allowance, and the model run uses the workspace's monthly token balance.

Plans and API request allowances for one-call ChatGPT brand-mention checks
PlanPriceRequests per dayRequests per month
Launch$49/mo501,000
Growth$129/mo2005,000
EnterpriseCustomCustomCustom

Launch includes all five monitored engines and defaults to weekly scheduled monitoring, with daily scheduling available. See the complete plan comparison.

Brand-mention API FAQ

Questions before automating the check

How can I check whether ChatGPT mentions my brand via API?

Send one POST request to https://foglift.io/api/v1/ai-visibility with models set to chatgpt, one buyer prompt, dry_run set to true, and your X-API-Key header. The first result returns brand_mentioned, position, sentiment, response_text, citations, competitor_mentions, and error.

Does a false brand_mentioned value mean the request failed?

No. False means ChatGPT completed the prompt but the tracked brand was absent from that answer. A provider failure appears in error or as a non-successful HTTP response. The recipe uses a separate exit code for that missing-evidence state.

Does this one-call check change monitoring history?

No. The recipe sets dry_run to true, so the result is returned without being written to monitoring history. Remove dry_run only when the prompt belongs in the workspace record and the persistence rules fit your workflow.

Which prompt should I use for a brand-mention check?

Use the exact category or buyer question you want to measure. Do not put your brand name in a recommendation prompt unless the job is to test factual brand knowledge. Keep the prompt, engine, and locale stable when comparing runs over time.

What plan includes ChatGPT checks through the API?

Developer access and ChatGPT monitoring start on Launch at $49 per month. Launch includes 50 API requests per day and 1,000 per month. Each prompt-engine check also uses the workspace's model-token balance.

Tracked prompt

API to check if ChatGPT mentions my brand

This recipe turns that job into one request with an explicit evidence boundary. Use scheduled monitoring when you need a trend instead of a point-in-time answer.