API2026-08-064 min read

Python AI Visibility API

Query the raw answers ChatGPT, Perplexity, Google AI Overviews, Copilot and Gemini actually give — from Python, in one API call. Send a query to https://api.agentgeo.org/v1/fetches with your ag_live_ key and get back the answer text, its citations and its sources as clean JSON. No headless browser, no Selenium, no parsing Perplexity's HTML. AgentGEO is the answer-access layer for AI visibility. Your own code (or your users' AI agent over MCP) runs the GEO/AEO analysis — the API just hands you the raw data, structured and identical across all five engines.

Query the raw answers ChatGPT, Perplexity, Google AI Overviews, Copilot and Gemini actually return — from Python, with a single API call. No headless browser, no Selenium, no parsing Perplexity's HTML. Just clean JSON with the answer text, citations and sources your code can act on.

Get your free API key → · Read the quickstart → — Free tier, no credit card required.

Start for free

Call the AI Visibility API from Python

POST to https://api.agentgeo.org/v1/fetches with your ag_live_ key as a bearer token, name the engines you want in the surfaces array, and you get back the exact answer each AI engine gave for the query — plus every source it cited, as clean JSON.

import requests

resp = requests.post(
    "https://api.agentgeo.org/v1/fetches",
    json={
        "query": "best running shoes for flat feet",
        "surfaces": ["chatgpt"],  # chatgpt | perplexity | gemini | google_ai_overview | copilot
    },
    headers={"Authorization": "Bearer ag_live_your_key_here"},
    timeout=60,
)
resp.raise_for_status()
run = resp.json()

for answer in run["answers"]:
    print(answer["surfaceKey"], "→", answer["answerText"])
    for src in answer["sources"]:      # cited sources, in order
        print(" ", src["position"], src["title"], src["url"])

The response is a plain JSON object — no scraping artifacts, no HTML to clean up:

{
  "id": "run_84c1f2ab91d3",
  "query": "best running shoes",
  "surfaces": ["chatgpt"],
  "status": "completed",
  "recordsDelivered": 1,
  "creditsCharged": 1,
  "answers": [
    {
      "surfaceKey": "chatgpt",
      "answerText": "For most runners, top picks include ...",
      "sources": [
        { "title": "Best Running Shoes", "url": "https://example.com/guide", "position": 1 }
      ]
    }
  ]
}

Because the shape is stable across all five engines, you can loop the same query over chatgpt, perplexity, google_ai, copilot and gemini and diff the citation sets — that diff is the core of any GEO/AEO analysis you want to build.

What the Python API gives you

AgentGEO is a thin answer-access layer, not a closed dashboard. The API hands you the raw material; your Python code (or your users' AI agent) does the analysis.

  • Five engines, one contract — ChatGPT, Perplexity, Google AI Overviews, Copilot and Gemini behind an identical request/response shape, so adding an engine is a one-word change.
  • Citations and sources, structured — every inline citation with its position, plus a deduplicated source list, ready to store, rank or diff. No regexing links out of prose.
  • Zero-scrape, official-API engine — answers come through supported access paths, so you never manage a headless browser, rotate proxies, or get IP-banned mid-run.
  • Provider metadataengine and model on every response, so your data stays auditable as underlying models change.
  • MCP connection, too — the same data is exposed over MCP, so Claude Code, Cursor, Codex or any MCP client can pull answers and run the GEO analysis itself, no glue code required.
  • Usage-based billing — API key with a free tier (no credit card), then pay for what you call, subscription plus overage. No per-seat pricing.

Common problems with DIY answer-scraping in Python

The obvious first instinct is to script it yourself — spin up Playwright or Selenium, drive ChatGPT or Perplexity in a headless browser, and scrape the DOM. It demos in an afternoon and then quietly becomes a maintenance sink.

  • Anti-bot walls. Headless Chrome gets fingerprinted and challenged. You end up buying residential proxies and solving CAPTCHAs to keep a scraper alive — work that has nothing to do with your product.
  • Brittle HTML parsing. Perplexity and AI Overviews render answers and citations through client-side JS with class names that change without notice. Your BeautifulSoup selectors break on a silent frontend deploy, usually in production.
  • No stable citation model. Extracting *which* sources an answer cited — in order, deduplicated — from rendered HTML is fiddly and engine-specific. You reinvent it per engine.
  • Concurrency and rate pain. Running five engines across many queries means orchestrating browser pools, retries and backoff yourself.
  • Legal and reliability gray area. Browser-scraping consumer UIs is fragile and easy to get blocked from. An official-API path is steadier ground to build a product on.
DIY scraping in PythonAgentGEO API
SetupPlaywright/Selenium, proxies, CAPTCHA solvingpip install requests + a key
ParsingPer-engine HTML selectors that breakStable JSON, identical across engines
CitationsHand-rolled extraction per engineStructured answers[].sources[]
BansIP rotation, fingerprint gamesZero-scrape, official-API engine
Adding an engineA new scraper from scratchAdd a key to the surfaces array

AgentGEO is the answer-access layer; the dashboards are what you build on it. You own the raw data and embed it in your own product, instead of logging into someone else's.

Who builds on this

Primarily developers embedding AI-visibility tracking as a feature inside their own SaaS — a rank-tracker for the AI-answer era — and agencies white-labeling GEO/AEO reporting for clients. If you compared closed platforms like Profound, Peec AI or Otterly and wanted the raw data instead of a locked dashboard, this is the layer underneath them.

Frequently asked questions

What is the Python AI visibility API?
It is a single HTTP endpoint — https://api.agentgeo.org/v1/fetches — that you POST to from Python to get the raw answer each AI engine (ChatGPT, Perplexity, Google AI Overviews, Copilot or Gemini) gave for a query, along with its citations and sources as structured JSON. Authenticate with a Bearer ag_live_ key, name the engines in surfaces, and read answers[].answerText and answers[].sources[] off the response.
Do I need a headless browser or Selenium to track AI answers in Python?
No. AgentGEO uses a zero-scrape, official-API engine, so you make a normal requests call and get clean JSON back. There is no browser to manage, no proxies to rotate, and no HTML to parse — which removes the IP-ban and broken-selector failures that come with DIY scraping.
Which AI engines can I query, and does the response shape change?
Five: ChatGPT, Perplexity, Google AI Overviews, Copilot and Gemini. The request and response shape is identical across all of them — you change one engine parameter — so you can loop the same query over every engine and diff the citation sets without special-casing each one.
How is this different from Profound, Peec AI or Otterly?
Those are closed analytics dashboards. AgentGEO is a thin answer-access layer: you own the raw answers, citations and sources, pay by usage rather than per seat, and embed the data in your own product instead of logging into someone else's. The dashboards are what you build on top of this API.
Is there a free tier?
Yes. You can get an API key and start calling the endpoint on a free tier with no credit card required, then move to usage-based billing (subscription plus overage) as your volume grows.

Keep reading