Gemini Scraper API
Submit independent Gemini questions, receive a task ID immediately, and query answers and citations.
Collect Gemini answers, Markdown, answer-section HTML and citations. Submission returns a task ID immediately; answers arrive through a separate status query.
Open product page and API TesterSubmit a task
POST https://api.goanyapi.com/api/v1/gemini-scraper/tasksAuthenticate with Authorization: Bearer YOUR_GOANYAPI_API_KEY and send JSON. inputs is an array of independent questions. idempotency_key identifies this batch; use a new key for each new batch, and retain the same key and identical inputs when retrying an uncertain response. Different inputs with the same key return HTTP 409.
The target URL is fixed. Only prompt, country and index are accepted within each input. Follow-up questions, coordinates, model selection, web-search and source-request switches are not supported. The page Tester submits one question; the API supports batches.
inputs: 1–20. idempotency_key: 8–128, [A-Za-z0-9_-].
| Parameter | Type | Constraints / default | Description |
|---|---|---|---|
prompt | string | maxLength=4000 | Question to ask Gemini. Required; each input is an independent question. |
country | string | Optional supported uppercase country/region code. Omit or use an empty string for automatic location. Use only the listed enum values. | |
index | integer | minimum=1; maximum=2147483647 | Optional unique tracking number within this batch. Omit to assign one automatically. |
{
"idempotency_key": "gemini_research_001",
"inputs": [
{ "prompt": "Recommend three cities for a first trip to Japan", "country": "US", "index": 1 },
{ "prompt": "Compare project management tools", "index": 2 }
]
}A new valid request returns HTTP 202 after credits are reserved and the task is persisted. Save data.task_id. Acceptance does not mean that the answer is ready. Repeating the same key and inputs returns the original task without duplicate charges; completed tasks may return HTTP 200. Do not reuse keys after the retention period.
{
"code": "ok",
"message": "ok",
"data": {
"task_id": "gms_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"status": "queued",
"input_count": 2,
"poll_after_seconds": 5
}
}Examples omit some timestamp and billing fields for readability. Actual responses also contain created_at, expires_at, credits_reserved, credits_refunded and credits_used.
Supported countries and regions
country accepts only the uppercase codes listed below. Omit it or use "" for automatic location. Country does not restrict the prompt language. An unsupported code returns HTTP 400 before credits are reserved. The list is specific to Gemini and may differ from other APIs.
All supported countries / regions (222)
| Code | Country / region |
|---|---|
AE | United Arab Emirates |
AF | Afghanistan |
AG | Antigua and Barbuda |
AL | Albania |
AM | Armenia |
AO | Angola |
AR | Argentina |
AS | American Samoa |
AU | Australia |
AZ | Azerbaijan |
BA | Bosnia and Herzegovina |
BB | Barbados |
BD | Bangladesh |
BH | Bahrain |
BI | Burundi |
BJ | Benin |
BN | Brunei Darussalam |
BO | Bolivia |
BR | Brazil |
BS | Bahamas |
BT | Bhutan |
BW | Botswana |
BZ | Belize |
CA | Canada |
CD | Congo (Democratic Republic) |
CF | Central African Republic |
CG | Congo |
CI | Côte d'Ivoire |
CM | Cameroon |
CO | Colombia |
CR | Costa Rica |
CV | Cabo Verde |
DJ | Djibouti |
DM | Dominica |
DO | Dominican Republic |
DZ | Algeria |
EC | Ecuador |
EG | Egypt |
ET | Ethiopia |
FJ | Fiji |
FM | Micronesia |
FO | Faroe Islands |
GA | Gabon |
GD | Grenada |
GE | Georgia |
GH | Ghana |
GM | Gambia |
GN | Guinea |
GQ | Equatorial Guinea |
GT | Guatemala |
GU | Guam |
GW | Guinea-Bissau |
GY | Guyana |
HN | Honduras |
HT | Haiti |
KE | Kenya |
KG | Kyrgyzstan |
KH | Cambodia |
KM | Comoros |
KN | Saint Kitts and Nevis |
KR | South Korea |
KW | Kuwait |
KZ | Kazakhstan |
LA | Laos |
LS | Lesotho |
LC | Saint Lucia |
LK | Sri Lanka |
LR | Liberia |
LY | Libya |
MA | Morocco |
MD | Moldova |
ME | Montenegro |
MG | Madagascar |
MH | Marshall Islands |
MK | North Macedonia |
ML | Mali |
MM | Myanmar |
MN | Mongolia |
MP | Northern Mariana Islands |
MR | Mauritania |
MU | Mauritius |
MV | Maldives |
MW | Malawi |
MX | Mexico |
MY | Malaysia |
MZ | Mozambique |
NA | Namibia |
NE | Niger |
NG | Nigeria |
NI | Nicaragua |
NP | Nepal |
NZ | New Zealand |
OM | Oman |
PA | Panama |
PE | Peru |
PG | Papua New Guinea |
PH | Philippines |
PK | Pakistan |
PY | Paraguay |
QA | Qatar |
RS | Serbia |
RW | Rwanda |
SA | Saudi Arabia |
SB | Solomon Islands |
SC | Seychelles |
SG | Singapore |
SN | Senegal |
SO | Somalia |
SR | Suriname |
SS | South Sudan |
ST | São Tomé and Príncipe |
SV | El Salvador |
SZ | Eswatini |
TD | Chad |
TG | Togo |
TH | Thailand |
TJ | Tajikistan |
TL | Timor-Leste |
TN | Tunisia |
TO | Tonga |
TR | Turkey |
TT | Trinidad and Tobago |
TW | Taiwan |
TZ | Tanzania |
UA | Ukraine |
UG | Uganda |
UY | Uruguay |
UZ | Uzbekistan |
VC | Saint Vincent and the Grenadines |
VE | Venezuela |
VI | Virgin Islands (U.S.) |
VN | Vietnam |
VU | Vanuatu |
WS | Samoa |
XK | Kosovo |
YE | Yemen |
ZA | South Africa |
ZM | Zambia |
ZW | Zimbabwe |
JP | Japan |
IN | India |
US | United States |
AX | Åland Islands |
AD | Andorra |
AI | Anguilla |
AW | Aruba |
AT | Austria |
JE | Jersey |
BM | Bermuda |
BQ | Bonaire |
BG | Bulgaria |
BF | Burkina Faso |
CL | Chile |
CK | Cook Islands |
HR | Croatia |
CW | Curaçao |
CY | Cyprus |
DK | Denmark |
EE | Estonia |
FK | Falkland Islands |
FI | Finland |
FR | France |
GF | French Guiana |
PF | French Polynesia |
DE | Germany |
GB | United Kingdom |
GR | Greece |
GL | Greenland |
GG | Guernsey |
HU | Hungary |
IS | Iceland |
ID | Indonesia |
IO | British Indian Ocean Territory |
IE | Ireland |
IM | Isle of Man |
IL | Israel |
IT | Italy |
JM | Jamaica |
KI | Kiribati |
LV | Latvia |
LI | Liechtenstein |
LT | Lithuania |
LU | Luxembourg |
MT | Malta |
MQ | Martinique |
YT | Mayotte |
JO | Jordan |
MC | Monaco |
NR | Nauru |
NL | Netherlands |
NO | Norway |
PW | Palau |
PM | Saint Pierre and Miquelon |
PT | Portugal |
PR | Puerto Rico |
RE | Réunion |
RO | Romania |
BL | Saint Barthélemy |
NC | New Caledonia |
SH | Saint Helena |
SI | Slovenia |
SK | Slovakia |
SX | Sint Maarten |
CH | Switzerland |
TM | Turkmenistan |
VG | Virgin Islands (British) |
MF | Saint Martin |
TV | Tuvalu |
TC | Turks and Caicos Islands |
SL | Sierra Leone |
ES | Spain |
BE | Belgium |
KY | Cayman Islands |
CZ | Czechia |
GP | Guadeloupe |
GI | Gibraltar |
HK | Hong Kong |
MO | Macao |
SE | Sweden |
SM | San Marino |
PL | Poland |
WF | Wallis and Futuna |
Query status and results
GET https://api.goanyapi.com/api/v1/gemini-scraper/tasks/{task_id}Replace {task_id} with your submission ID and authenticate as the same account. Other accounts cannot access your task. Query and result retrieval are free.
Query response fields
| Field | Type | Description |
|---|---|---|
code | string | ok when the query itself succeeds, including a task whose status is failed. |
message | string | Query message, normally ok. Task failure reasons are in results[].error. |
data.task_id | string | Task ID from submission; cgs_ for ChatGPT, gms_ for Gemini. |
data.status | string | queued / running / succeeded / failed; see the state table. |
data.created_at | string (ISO 8601) | Task creation time in UTC. |
data.expires_at | string (ISO 8601) | Retention deadline in UTC; completed results are retained for 30 days. |
data.input_count | integer | Number of questions submitted. |
data.credits_reserved | integer | Total credits reserved and deducted at submission, using the configuration at creation time. |
data.credits_refunded | integer | Total credits already refunded for failed questions. |
data.credits_used | integer | Settled credits at a terminal state: reserved minus refunded. Zero while queued/running does not mean no reservation was deducted. |
data.poll_after_seconds | integer (optional) | Returned while pending, currently 5. Omitted at terminal states; stop polling. |
data.results | array (optional) | Per-question outcomes after completion; usually omitted while pending. Correlate inputs using index rather than array order. |
data.results[].index | integer | Tracking index of the input; automatically assigned from 1 when omitted. |
data.results[].status | string | succeeded or failed. A succeeded batch may still contain failed items. |
data.results[].result | object (optional) | Present for a successful item; engine-specific fields are listed below. |
data.results[].error | object (optional) | Present for a failed item. |
data.results[].error.code | string | collection_failed when the question could not be delivered. |
data.results[].error.message | string | Public failure message without internal connection details. |
data.expired | boolean (optional) | Compatibility field: true, when present, indicates expiry. Normal expired-task queries return HTTP 410, or 404 after cleanup. |
Task states
| Field | Type | Description |
|---|---|---|
queued | string | Accepted and awaiting processing; keep polling. |
running | string | Processing; keep polling. |
succeeded | string | At least one question succeeded; stop polling and inspect every item. |
failed | string | All questions failed; stop polling and inspect errors and refunds. |
result answer fields
All fields below may be missing, null or empty; empty fields alone do not mean failure.
| Field | Type | Description |
|---|---|---|
url | string / null | Answer page URL. |
prompt | string / null | Input question. |
answer_text | string / null | Plain-text answer. |
country | string / null | Country or region associated with the result. |
index | integer / null | Question tracking index; prefer the outer index for correlation. |
answer_text_markdown | string / null | Answer in Markdown. |
answer_section_html | string / null | Answer-section HTML used by the Gemini preview. |
model | string / null | Reported model name; this does not imply model selection is supported. |
answer_text_raw | string / null | Answer text preserving whitespace and line breaks. |
links_attached | array / null | Links attached to the answer. |
citations | array / null | Answer citations. |
Arrays may contain strings, numbers, booleans, null or objects. Objects retain only position, text, title, url, description, domain, icon, cited, name, price, currency, rating, address, latitude and longitude; these fields may also be absent or empty.
Query response JSON examples
All examples below use HTTP 200 and illustrate the structure rather than real tasks. Billing figures use the current configuration; actual task rates are fixed at creation.
Queued
{ "code": "ok", "message": "ok", "data": { "task_id": "gms_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "status": "queued", "created_at": "2026-11-10T00:00:00.000Z", "expires_at": "2026-12-10T00:00:00.000Z", "input_count": 1, "credits_reserved": 3, "credits_refunded": 0, "credits_used": 0, "poll_after_seconds": 5 }}Running
{ "code": "ok", "message": "ok", "data": { "task_id": "gms_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "status": "running", "created_at": "2026-11-10T00:00:00.000Z", "expires_at": "2026-12-10T00:00:00.000Z", "input_count": 1, "credits_reserved": 3, "credits_refunded": 0, "credits_used": 0, "poll_after_seconds": 5 }}All succeeded
{ "code": "ok", "message": "ok", "data": { "task_id": "gms_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "status": "succeeded", "created_at": "2026-11-10T00:00:00.000Z", "expires_at": "2026-12-10T00:00:00.000Z", "input_count": 1, "credits_reserved": 3, "credits_refunded": 0, "credits_used": 3, "results": [ { "index": 1, "status": "succeeded", "result": { "index": 1, "prompt": "Example question", "answer_text": "Example answer.", "citations": [], "answer_section_html": "<p>Example answer.</p>" } } ] }}All failed
{ "code": "ok", "message": "ok", "data": { "task_id": "gms_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "status": "failed", "created_at": "2026-11-10T00:00:00.000Z", "expires_at": "2026-12-10T00:00:00.000Z", "input_count": 1, "credits_reserved": 3, "credits_refunded": 3, "credits_used": 0, "results": [ { "index": 1, "status": "failed", "error": { "code": "collection_failed", "message": "Unable to deliver a result for this question" } } ] }}Partial failure
{ "code": "ok", "message": "ok", "data": { "task_id": "gms_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "status": "succeeded", "created_at": "2026-11-10T00:00:00.000Z", "expires_at": "2026-12-10T00:00:00.000Z", "input_count": 2, "credits_reserved": 6, "credits_refunded": 3, "credits_used": 3, "results": [ { "index": 1, "status": "succeeded", "result": { "index": 1, "prompt": "Example question", "answer_text": "Example answer.", "citations": [], "answer_section_html": "<p>Example answer.</p>" } }, { "index": 2, "status": "failed", "error": { "code": "collection_failed", "message": "Unable to deliver a result for this question" } } ] }}Polling example
const headers = { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' };
const submission = await fetch(`${apiBase}/api/v1/gemini-scraper/tasks`, {
method: 'POST', headers,
body: JSON.stringify({ inputs: [{ prompt: 'Compare project management tools' }], idempotency_key: crypto.randomUUID() })
});
const accepted = await submission.json();
if (!submission.ok) throw new Error(accepted.message);
const taskId = accepted.data.task_id;
for (;;) {
await new Promise(resolve => setTimeout(resolve, 5000));
const response = await fetch(`${apiBase}/api/v1/gemini-scraper/tasks/${taskId}`, { headers });
const payload = await response.json();
if (!response.ok) throw new Error(payload.message);
if (['succeeded', 'failed'].includes(payload.data.status)) {
console.log(payload.data); // Inspect every results[].status, including partial failures.
break;
}
}Billing, retries and retention
3 credits per question, deducted at submission; failed inputs are automatically refunded. Queries are free.
Submission reserves the current configured per-question rate for every input. Insufficient balance prevents task creation. Successful inputs are charged whether or not you view their answers; failed inputs are automatically refunded. Missing or empty answer fields and citations alone do not make a request fail. Queries are free. Reuse the original idempotency key and identical inputs after a lost response; a new key creates a separately billed task.
Processing can continue through background work and callbacks after the page is closed. Overdue tasks have a 24-hour processing deadline and are closed and refunded when next processed or queried; refunds may be delayed without subsequent activity. Completed results are retained for 30 days. Downloaded JSON is limited to 20 MB; retained task records, including metadata, are limited to 1.8 MB. Results that cannot be retained or delivered are refunded.
HTTP errors
400 invalid JSON, parameters, country or task ID; 401 missing or invalid API key; 402 insufficient credits; 404 task not found or owned by another account; 409 idempotency conflict; 410 expired task; 429 rate limit; 503 service not configured or temporarily unavailable. A task failure is returned in the task body with HTTP 200 and terminal status failed.