ChatGPT Scraper API
Create background ChatGPT tasks and poll for answers and citations.
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/tasksAuthenticate 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.
| Parameter | Type | Description |
|---|---|---|
prompt | string | Question to ask ChatGPT. Required; each input starts an independent conversation. (4000) |
country | string | Optional 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. |
index | integer | Optional unique tracking number within this batch. Omit to assign one automatically. |
require_sources | boolean | Request sources with the answer; their presence is not guaranteed. |
additional_prompt | string | Optional follow-up question in the same conversation, after the first answer. (4000) |
web_search | boolean | Request web search for this question. |
geolocation | string | Optional 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)
| Code | Country / region |
|---|---|
AF | Afghanistan |
AL | Albania |
DZ | Algeria |
AX | Aland Islands |
AS | American Samoa |
AD | Andorra |
AO | Angola |
AI | Anguilla |
AG | Antigua And Barbuda |
AR | Argentina |
AM | Armenia |
AW | Aruba |
AU | Australia |
AT | Austria |
AZ | Azerbaijan |
BS | Bahamas |
BH | Bahrain |
JE | Bailiwick of Jersey |
BD | Bangladesh |
BB | Barbados |
BE | Belgium |
BZ | Belize |
BJ | Benin |
BM | Bermuda |
BT | Bhutan |
BO | Bolivia |
BQ | Bonaire (Caribbean Netherlands) |
BA | Bosnia And Herzegovina |
BW | Botswana |
BR | Brazil |
BN | Brunei |
BG | Bulgaria |
BF | Burkina Faso |
BI | Burundi |
KH | Cambodia |
CM | Cameroon |
CA | Canada |
CV | Cape Verde |
KY | Cayman Islands |
CF | Central African Republic |
TD | Chad |
CL | Chile |
CO | Colombia |
KM | Comoros |
CG | Congo |
CK | Cook Islands |
CR | Costa Rica |
CI | Cote D'Ivoire (Ivory Coast) |
HR | Croatia (Hrvatska) |
CW | Curacao |
CY | Cyprus |
CZ | Czech Republic |
CD | Democratic Republic Of Congo (Zaire) |
DK | Denmark |
DJ | Djibouti |
DM | Dominica |
DO | Dominican Republic |
EC | Ecuador |
EG | Egypt |
SV | El Salvador |
GQ | Equatorial Guinea |
EE | Estonia |
ET | Ethiopia |
FK | Falkland Islands (Malvinas) |
FO | Faroe Islands |
FJ | Fiji |
FI | Finland |
FR | France |
GF | French Guiana |
PF | French Polynesia |
GA | Gabon |
GM | Gambia |
GE | Georgia |
DE | Germany |
GH | Ghana |
GI | Gibraltar |
GB | Great Britain |
GR | Greece |
GL | Greenland |
GD | Grenada |
GU | Guam |
GP | Guadeloupe |
GT | Guatemala |
GG | Guernsey |
GN | Guinea |
GW | Guinea-Bissau |
GY | Guyana |
HT | Haiti |
HN | Honduras |
HU | Hungary |
IS | Iceland |
IN | India |
ID | Indonesia |
IE | Ireland |
IM | Isle Of Man |
IL | Israel |
IT | Italy |
JM | Jamaica |
JP | Japan |
JO | Jordan |
KZ | Kazakhstan |
KE | Kenya |
XK | Kosovo |
KW | Kuwait |
KG | Kyrgyzstan |
LA | Laos |
LV | Latvia |
LS | Lesotho |
LR | Liberia |
LY | Libya |
LI | Liechtenstein |
LT | Lithuania |
LU | Luxembourg |
MK | Macedonia |
MG | Madagascar |
MW | Malawi |
MY | Malaysia |
MV | Maldives |
ML | Mali |
MT | Malta |
MH | Marshall Islands |
MQ | Martinique |
MR | Mauritania |
MU | Mauritius |
YT | Mayotte |
MX | Mexico |
FM | Micronesia |
MD | Moldova |
MC | Monaco |
MN | Mongolia |
ME | Montenegro |
MA | Morocco |
MZ | Mozambique |
MM | Myanmar (Burma) |
NA | Namibia |
NR | Nauru |
NP | Nepal |
NL | Netherlands |
NC | New Caledonia |
NZ | New Zealand |
NI | Nicaragua |
NE | Niger |
NG | Nigeria |
MP | Northern Mariana Islands |
NO | Norway |
OM | Oman |
PK | Pakistan |
PW | Palau |
PA | Panama |
PG | Papua New Guinea |
PE | Peru |
PH | Philippines |
PL | Poland |
PT | Portugal |
PR | Puerto Rico |
QA | Qatar |
RE | Réunion |
RO | Romania |
RW | Rwanda |
KN | Saint Kitts And Nevis |
LC | Saint Lucia |
MF | Saint Martin |
VC | Saint Vincent And The Grenadines |
SM | San Marino |
ST | Sao Tome And Principe |
SA | Saudi Arabia |
SN | Senegal |
RS | Serbia |
SC | Seychelles |
SL | Sierra Leone |
SG | Singapore |
SX | Sint Maarten (Dutch part) |
SK | Slovak Republic |
SI | Slovenia |
SB | Solomon Islands |
SO | Somalia |
ZA | South Africa |
KR | South Korea |
SS | South Sudan |
ES | Spain |
LK | Sri Lanka |
SR | Suriname |
SZ | Swaziland |
SE | Sweden |
CH | Switzerland |
TW | Taiwan |
TJ | Tajikistan |
TZ | Tanzania |
TH | Thailand |
TL | Timor-Leste |
TG | Togo |
TO | Tonga |
TT | Trinidad And Tobago |
TN | Tunisia |
TR | Turkey |
TM | Turkmenistan |
TC | Turks And Caicos Islands |
TV | Tuvalu |
UG | Uganda |
UA | Ukraine |
AE | United Arab Emirates |
US | United States |
UY | Uruguay |
UZ | Uzbekistan |
VU | Vanuatu |
VA | Vatican City (Holy See) |
VN | Vietnam |
VG | Virgin Islands (British) |
VI | Virgin Islands (US) |
WF | Wallis And Futuna Islands |
WS | Western Samoa |
YE | Yemen |
ZM | Zambia |
ZW | Zimbabwe |
{
"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
| 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_html | string / null | Answer page HTML; sanitize before embedding. |
answer_text | string / null | Plain-text answer. |
country | string / null | Country or region associated with the result. |
is_map | boolean / null | Whether map-related content is reported. |
shopping_visible | boolean / null | Whether shopping content is reported as visible. |
index | integer / null | Question tracking index; prefer the outer index for correlation. |
answer_text_markdown | string / null | Answer in Markdown. |
web_search_triggered | boolean / null | Whether web search was reported as triggered. |
additional_prompt | string / null | Submitted follow-up question. |
additional_answer_text | string / null | Follow-up answer text. |
model | string / null | Reported model name; this does not imply model selection is supported. |
prompt_sent_at | string / null | Reported time the question was sent. |
answer_text_raw | string / null | Answer text preserving whitespace and line breaks. |
additional_answer_text_markdown | string / null | Follow-up answer in Markdown. |
links_attached | array / null | Links attached to the answer. |
citations | array / null | Answer citations. |
references | array / null | Related references. |
shopping | array / null | Shopping entries. |
map | array / null | Map entries. |
search_sources | array / null | Search sources. |
search_sources_more | array / null | Additional search sources. |
business_locations | array / null | Business location entries. |
ads | array / null | Ad entries. |
questionnaire | array / null | Questionnaire entries in the answer. |
shopping_additional_prompt | array / null | Shopping entries in the follow-up answer. |
citations_additional_prompt | array / null | Citations in the follow-up answer. |
web_search_query | array / null | Reported 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.