API Documentation

ChatGPT Scraper API

Create background ChatGPT tasks and poll for answers and citations.

Test API

Collect ChatGPT answers, follow-up answers and citations for independent questions. Receive a task ID immediately after acceptance, then poll for progress and results.

Open product page and API Tester

Submit a task

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

Authenticate with Authorization: Bearer YOUR_GOANYAPI_API_KEY. Send JSON with inputs (1–20 questions) and idempotency_key (8–128 letters, numbers, underscores or hyphens). Each question starts its own conversation; additional_prompt follows the first answer within that conversation. The target URL is fixed and is not an input parameter.

ParameterTypeDescription
promptstringQuestion to ask ChatGPT. Required; each input starts an independent conversation. (4000)
countrystringOptional supported uppercase country/region code. Omit or use an empty string for automatic location. CN is unsupported. See the complete country enum and Docs list.
indexintegerOptional unique tracking number within this batch. Omit to assign one automatically.
require_sourcesbooleanRequest sources with the answer; their presence is not guaranteed.
additional_promptstringOptional follow-up question in the same conversation, after the first answer. (4000)
web_searchbooleanRequest web search for this question.
geolocationstringOptional latitude,longitude, for example 37.7749,-122.4194. Latitude -90 to 90; longitude -180 to 180. (80)

Countries and regions

country accepts only the supported uppercase two-letter codes below. Omit it or use an empty string for automatic location. Location does not restrict the prompt language. CN, HK and MO are unsupported. An unsupported code returns HTTP 400 before credits are reserved.

All supported countries / regions (214)
CodeCountry / region
AFAfghanistan
ALAlbania
DZAlgeria
AXAland Islands
ASAmerican Samoa
ADAndorra
AOAngola
AIAnguilla
AGAntigua And Barbuda
ARArgentina
AMArmenia
AWAruba
AUAustralia
ATAustria
AZAzerbaijan
BSBahamas
BHBahrain
JEBailiwick of Jersey
BDBangladesh
BBBarbados
BEBelgium
BZBelize
BJBenin
BMBermuda
BTBhutan
BOBolivia
BQBonaire (Caribbean Netherlands)
BABosnia And Herzegovina
BWBotswana
BRBrazil
BNBrunei
BGBulgaria
BFBurkina Faso
BIBurundi
KHCambodia
CMCameroon
CACanada
CVCape Verde
KYCayman Islands
CFCentral African Republic
TDChad
CLChile
COColombia
KMComoros
CGCongo
CKCook Islands
CRCosta Rica
CICote D'Ivoire (Ivory Coast)
HRCroatia (Hrvatska)
CWCuracao
CYCyprus
CZCzech Republic
CDDemocratic Republic Of Congo (Zaire)
DKDenmark
DJDjibouti
DMDominica
DODominican Republic
ECEcuador
EGEgypt
SVEl Salvador
GQEquatorial Guinea
EEEstonia
ETEthiopia
FKFalkland Islands (Malvinas)
FOFaroe Islands
FJFiji
FIFinland
FRFrance
GFFrench Guiana
PFFrench Polynesia
GAGabon
GMGambia
GEGeorgia
DEGermany
GHGhana
GIGibraltar
GBGreat Britain
GRGreece
GLGreenland
GDGrenada
GUGuam
GPGuadeloupe
GTGuatemala
GGGuernsey
GNGuinea
GWGuinea-Bissau
GYGuyana
HTHaiti
HNHonduras
HUHungary
ISIceland
INIndia
IDIndonesia
IEIreland
IMIsle Of Man
ILIsrael
ITItaly
JMJamaica
JPJapan
JOJordan
KZKazakhstan
KEKenya
XKKosovo
KWKuwait
KGKyrgyzstan
LALaos
LVLatvia
LSLesotho
LRLiberia
LYLibya
LILiechtenstein
LTLithuania
LULuxembourg
MKMacedonia
MGMadagascar
MWMalawi
MYMalaysia
MVMaldives
MLMali
MTMalta
MHMarshall Islands
MQMartinique
MRMauritania
MUMauritius
YTMayotte
MXMexico
FMMicronesia
MDMoldova
MCMonaco
MNMongolia
MEMontenegro
MAMorocco
MZMozambique
MMMyanmar (Burma)
NANamibia
NRNauru
NPNepal
NLNetherlands
NCNew Caledonia
NZNew Zealand
NINicaragua
NENiger
NGNigeria
MPNorthern Mariana Islands
NONorway
OMOman
PKPakistan
PWPalau
PAPanama
PGPapua New Guinea
PEPeru
PHPhilippines
PLPoland
PTPortugal
PRPuerto Rico
QAQatar
RERéunion
RORomania
RWRwanda
KNSaint Kitts And Nevis
LCSaint Lucia
MFSaint Martin
VCSaint Vincent And The Grenadines
SMSan Marino
STSao Tome And Principe
SASaudi Arabia
SNSenegal
RSSerbia
SCSeychelles
SLSierra Leone
SGSingapore
SXSint Maarten (Dutch part)
SKSlovak Republic
SISlovenia
SBSolomon Islands
SOSomalia
ZASouth Africa
KRSouth Korea
SSSouth Sudan
ESSpain
LKSri Lanka
SRSuriname
SZSwaziland
SESweden
CHSwitzerland
TWTaiwan
TJTajikistan
TZTanzania
THThailand
TLTimor-Leste
TGTogo
TOTonga
TTTrinidad And Tobago
TNTunisia
TRTurkey
TMTurkmenistan
TCTurks And Caicos Islands
TVTuvalu
UGUganda
UAUkraine
AEUnited Arab Emirates
USUnited States
UYUruguay
UZUzbekistan
VUVanuatu
VAVatican City (Holy See)
VNVietnam
VGVirgin Islands (British)
VIVirgin Islands (US)
WFWallis And Futuna Islands
WSWestern Samoa
YEYemen
ZMZambia
ZWZimbabwe
{
  "idempotency_key": "research_batch_001",
  "inputs": [
    {
      "prompt": "Compare project management tools",
      "country": "US",
      "index": 1,
      "web_search": true,
      "require_sources": true,
      "additional_prompt": "Which options offer a free plan?",
      "geolocation": "37.7749,-122.4194"
    },
    { "prompt": "What are the latest renewable energy trends?", "index": 2 }
  ]
}

A new valid submission returns HTTP 202 immediately after credits are reserved and the task is persisted, with data.task_id and status: "queued". It does not wait for processing or results. The ID confirms GoAnyAPI has accepted the task; it does not mean the answer is ready. Save it and use the query endpoint below. Retry a lost response with the same idempotency key and identical inputs to retrieve the same task without duplicate charges. Different inputs with the same key return HTTP 409. A new key creates a separately billed task. Reusing an already completed task can return HTTP 200 with its saved result. Keys are retained with tasks; do not reuse them after retention expires.

Query status and results

GET https://api.goanyapi.com/api/v1/chatgpt-scraper/tasks/{task_id}

Replace {task_id} with the ID returned by submission. Use the same authenticated account; another account cannot query your task. Poll at intervals of at least 5 seconds. queued and running are pending; succeeded and failed are terminal. A succeeded batch can include failed questions: inspect each results[].status. Every item contains its tracking index and either result or a public error.

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_htmlstring / nullAnswer page HTML; sanitize before embedding.
answer_textstring / nullPlain-text answer.
countrystring / nullCountry or region associated with the result.
is_mapboolean / nullWhether map-related content is reported.
shopping_visibleboolean / nullWhether shopping content is reported as visible.
indexinteger / nullQuestion tracking index; prefer the outer index for correlation.
answer_text_markdownstring / nullAnswer in Markdown.
web_search_triggeredboolean / nullWhether web search was reported as triggered.
additional_promptstring / nullSubmitted follow-up question.
additional_answer_textstring / nullFollow-up answer text.
modelstring / nullReported model name; this does not imply model selection is supported.
prompt_sent_atstring / nullReported time the question was sent.
answer_text_rawstring / nullAnswer text preserving whitespace and line breaks.
additional_answer_text_markdownstring / nullFollow-up answer in Markdown.
links_attachedarray / nullLinks attached to the answer.
citationsarray / nullAnswer citations.
referencesarray / nullRelated references.
shoppingarray / nullShopping entries.
maparray / nullMap entries.
search_sourcesarray / nullSearch sources.
search_sources_morearray / nullAdditional search sources.
business_locationsarray / nullBusiness location entries.
adsarray / nullAd entries.
questionnairearray / nullQuestionnaire entries in the answer.
shopping_additional_promptarray / nullShopping entries in the follow-up answer.
citations_additional_promptarray / nullCitations in the follow-up answer.
web_search_queryarray / nullReported search queries.

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": "cgs_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": "cgs_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": "cgs_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_html": "<p>Example answer.</p>"        }      }    ]  }}

All failed

{  "code": "ok",  "message": "ok",  "data": {    "task_id": "cgs_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": "cgs_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_html": "<p>Example answer.</p>"        }      },      {        "index": 2,        "status": "failed",        "error": {          "code": "collection_failed",          "message": "Unable to deliver a result for this question"        }      }    ]  }}

Billing and retention

3 credits per question, deducted at submission; failed inputs are automatically refunded. Queries are free.

Credits are deducted for every input at submission. Insufficient balance prevents task creation. A background processing failure refunds all credits; partial failures refund the affected questions. Read the terminal task and each result to see failures and refunds. Successful questions are billed whether or not you view the answers. Sources, fields or citations being empty does not by itself make a result a failure. Queries and repeated result downloads are free. A follow-up is included in the per-input rate.

Processing continues without an open page or polling. Temporary network errors do not immediately fail or refund a task. Tasks not delivered within 24 hours are closed and refunded when next processed or queried; refunds may be delayed without subsequent activity. A later recovery does not charge you again. Completed results are retained for 30 days. Keep batches small: a task supports downloaded JSON up to 20 MB and a retained record up to 1.8 MB including task metadata; undeliverable oversized results are refunded. Expired results return HTTP 410 while the record exists, then HTTP 404 after cleanup. Refunds keep the original credits' expiration date.

Errors

HTTP 400: invalid JSON, unknown parameters, duplicate tracking indexes or invalid values. HTTP 401: invalid authentication. HTTP 402: insufficient credits. HTTP 404: task not found or inaccessible. HTTP 409: idempotency key conflict. HTTP 410: expired task. HTTP 429: rate limit. HTTP 503: service or billing configuration unavailable before acceptance. Background processing failures are reported by the query endpoint as status: "failed" and results[].error, with refunds in credits_refunded. The public envelope uses code, message and data.