API Documentation

Gemini Scraper API

Submit independent Gemini questions, receive a task ID immediately, and query answers and citations.

Test API

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 Tester

Submit a task

POST https://api.goanyapi.com/api/v1/gemini-scraper/tasks

Authenticate 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_-].

ParameterTypeConstraints / defaultDescription
promptstringmaxLength=4000Question to ask Gemini. Required; each input is an independent question.
countrystringOptional supported uppercase country/region code. Omit or use an empty string for automatic location. Use only the listed enum values.
indexintegerminimum=1; maximum=2147483647Optional 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)
CodeCountry / region
AEUnited Arab Emirates
AFAfghanistan
AGAntigua and Barbuda
ALAlbania
AMArmenia
AOAngola
ARArgentina
ASAmerican Samoa
AUAustralia
AZAzerbaijan
BABosnia and Herzegovina
BBBarbados
BDBangladesh
BHBahrain
BIBurundi
BJBenin
BNBrunei Darussalam
BOBolivia
BRBrazil
BSBahamas
BTBhutan
BWBotswana
BZBelize
CACanada
CDCongo (Democratic Republic)
CFCentral African Republic
CGCongo
CICôte d'Ivoire
CMCameroon
COColombia
CRCosta Rica
CVCabo Verde
DJDjibouti
DMDominica
DODominican Republic
DZAlgeria
ECEcuador
EGEgypt
ETEthiopia
FJFiji
FMMicronesia
FOFaroe Islands
GAGabon
GDGrenada
GEGeorgia
GHGhana
GMGambia
GNGuinea
GQEquatorial Guinea
GTGuatemala
GUGuam
GWGuinea-Bissau
GYGuyana
HNHonduras
HTHaiti
KEKenya
KGKyrgyzstan
KHCambodia
KMComoros
KNSaint Kitts and Nevis
KRSouth Korea
KWKuwait
KZKazakhstan
LALaos
LSLesotho
LCSaint Lucia
LKSri Lanka
LRLiberia
LYLibya
MAMorocco
MDMoldova
MEMontenegro
MGMadagascar
MHMarshall Islands
MKNorth Macedonia
MLMali
MMMyanmar
MNMongolia
MPNorthern Mariana Islands
MRMauritania
MUMauritius
MVMaldives
MWMalawi
MXMexico
MYMalaysia
MZMozambique
NANamibia
NENiger
NGNigeria
NINicaragua
NPNepal
NZNew Zealand
OMOman
PAPanama
PEPeru
PGPapua New Guinea
PHPhilippines
PKPakistan
PYParaguay
QAQatar
RSSerbia
RWRwanda
SASaudi Arabia
SBSolomon Islands
SCSeychelles
SGSingapore
SNSenegal
SOSomalia
SRSuriname
SSSouth Sudan
STSão Tomé and Príncipe
SVEl Salvador
SZEswatini
TDChad
TGTogo
THThailand
TJTajikistan
TLTimor-Leste
TNTunisia
TOTonga
TRTurkey
TTTrinidad and Tobago
TWTaiwan
TZTanzania
UAUkraine
UGUganda
UYUruguay
UZUzbekistan
VCSaint Vincent and the Grenadines
VEVenezuela
VIVirgin Islands (U.S.)
VNVietnam
VUVanuatu
WSSamoa
XKKosovo
YEYemen
ZASouth Africa
ZMZambia
ZWZimbabwe
JPJapan
INIndia
USUnited States
AXÅland Islands
ADAndorra
AIAnguilla
AWAruba
ATAustria
JEJersey
BMBermuda
BQBonaire
BGBulgaria
BFBurkina Faso
CLChile
CKCook Islands
HRCroatia
CWCuraçao
CYCyprus
DKDenmark
EEEstonia
FKFalkland Islands
FIFinland
FRFrance
GFFrench Guiana
PFFrench Polynesia
DEGermany
GBUnited Kingdom
GRGreece
GLGreenland
GGGuernsey
HUHungary
ISIceland
IDIndonesia
IOBritish Indian Ocean Territory
IEIreland
IMIsle of Man
ILIsrael
ITItaly
JMJamaica
KIKiribati
LVLatvia
LILiechtenstein
LTLithuania
LULuxembourg
MTMalta
MQMartinique
YTMayotte
JOJordan
MCMonaco
NRNauru
NLNetherlands
NONorway
PWPalau
PMSaint Pierre and Miquelon
PTPortugal
PRPuerto Rico
RERéunion
RORomania
BLSaint Barthélemy
NCNew Caledonia
SHSaint Helena
SISlovenia
SKSlovakia
SXSint Maarten
CHSwitzerland
TMTurkmenistan
VGVirgin Islands (British)
MFSaint Martin
TVTuvalu
TCTurks and Caicos Islands
SLSierra Leone
ESSpain
BEBelgium
KYCayman Islands
CZCzechia
GPGuadeloupe
GIGibraltar
HKHong Kong
MOMacao
SESweden
SMSan Marino
PLPoland
WFWallis 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

FieldTypeDescription
codestringok when the query itself succeeds, including a task whose status is failed.
messagestringQuery message, normally ok. Task failure reasons are in results[].error.
data.task_idstringTask ID from submission; cgs_ for ChatGPT, gms_ for Gemini.
data.statusstringqueued / running / succeeded / failed; see the state table.
data.created_atstring (ISO 8601)Task creation time in UTC.
data.expires_atstring (ISO 8601)Retention deadline in UTC; completed results are retained for 30 days.
data.input_countintegerNumber of questions submitted.
data.credits_reservedintegerTotal credits reserved and deducted at submission, using the configuration at creation time.
data.credits_refundedintegerTotal credits already refunded for failed questions.
data.credits_usedintegerSettled credits at a terminal state: reserved minus refunded. Zero while queued/running does not mean no reservation was deducted.
data.poll_after_secondsinteger (optional)Returned while pending, currently 5. Omitted at terminal states; stop polling.
data.resultsarray (optional)Per-question outcomes after completion; usually omitted while pending. Correlate inputs using index rather than array order.
data.results[].indexintegerTracking index of the input; automatically assigned from 1 when omitted.
data.results[].statusstringsucceeded or failed. A succeeded batch may still contain failed items.
data.results[].resultobject (optional)Present for a successful item; engine-specific fields are listed below.
data.results[].errorobject (optional)Present for a failed item.
data.results[].error.codestringcollection_failed when the question could not be delivered.
data.results[].error.messagestringPublic failure message without internal connection details.
data.expiredboolean (optional)Compatibility field: true, when present, indicates expiry. Normal expired-task queries return HTTP 410, or 404 after cleanup.

Task states

FieldTypeDescription
queuedstringAccepted and awaiting processing; keep polling.
runningstringProcessing; keep polling.
succeededstringAt least one question succeeded; stop polling and inspect every item.
failedstringAll 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.

FieldTypeDescription
urlstring / nullAnswer page URL.
promptstring / nullInput question.
answer_textstring / nullPlain-text answer.
countrystring / nullCountry or region associated with the result.
indexinteger / nullQuestion tracking index; prefer the outer index for correlation.
answer_text_markdownstring / nullAnswer in Markdown.
answer_section_htmlstring / nullAnswer-section HTML used by the Gemini preview.
modelstring / nullReported model name; this does not imply model selection is supported.
answer_text_rawstring / nullAnswer text preserving whitespace and line breaks.
links_attachedarray / nullLinks attached to the answer.
citationsarray / nullAnswer 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.