Skip to content

Gemini API endpoint for AI-powered web data extraction

Send a prompt through an existing scraping account and API key, then use the structured answer in an app, database, dashboard, agent, or retrieval pipeline. The endpoint is designed to turn current web information into plain text, formatted Markdown, and — when available — source citations, without building a separate model-access layer.

How the endpoint works

You supply the question or instruction. The response separates the answer into results_text for plain text and results_markdown for formatted output, alongside a citations array when sources are available. If you need to inspect or process the underlying page yourself, add_html set to true also returns the full response in full_html. That split matters: use the text or Markdown for display and downstream processing, use citations for attribution, and use full_html only when verification or custom parsing requires it.

What you can build with it

The endpoint fits workflows that need more than raw HTML or extracted fields. It can compare competitor pricing, feature lists, descriptions and positioning; summarize reviews and surface sentiment, recurring complaints and feature requests; answer market questions with source attribution; enrich scraped records with summaries, labels or insights before storage; supply fresh context to retrieval-augmented generation; and give agents current web information. A practical decision check is to ask whether your next step needs a narrative summary, a classification, or a comparison — if so, prompt the endpoint; if you only need deterministic fields, keep extracting them directly.

Parameters, cost and response fields

Only prompt is required. The optional controls cover the main workflow choices: country_code localizes context, for example us, gb or fr; add_html adds the full HTML response when true; and tag attaches your own identifier for tracking. Each successful Gemini request costs 15 API credits, and failed requests are not charged. Before you run a batch, decide which optional controls you actually need — localization for country-specific research, HTML for verification, and a tag for cost or quality tracking — rather than enabling everything by default.

Quickstart and worked examples

Start with an account and API key, send the prompt, and parse results_text, results_markdown and citations from the structured response. The supplied Python examples cover two patterns: a general query that prints the Markdown answer with any citations, and localized market research that sets country_code, enables add_html, adds a tag, and reports the size of any returned HTML. Both examples handle HTTP errors, timeouts and invalid JSON, and the second uses a France electric-bike market prompt as a concrete research case. Keep the key in an environment variable in production rather than embedding it in code.

Frequently asked questions

How much does a Gemini API request cost?

Each successful request costs 15 API credits. Failed requests are not charged.

How fast is the Gemini endpoint?

Responses are not instant because the prompt must be processed and an answer generated. Most requests complete in under a minute, although timing varies with prompt and response size.

Are citations always returned?

No. Citations depend on the prompt and are more likely for web-grounded work such as current research, market analysis, or source-based questions. General-knowledge prompts may return an answer without citations.

Can I localize Gemini responses by country?

Yes. Set country_code to localize the request context, for example for prices, availability, news, or market trends in a specific country.

Can I get the raw HTML response?

Yes. Set add_html to true to include the full HTML response in full_html, for verification or your own post-processing.