JustSERPDocs

ChatGPT

What chatgpt.com answers a logged-out visitor, in a fresh session for each request: the reply, the businesses on its place cards and the sites it cites, also under the fields `markdown`, `text_blocks`, `reference_links`, `cards` and `response_metadata`.

GET
/v1/chatgpt

What chatgpt.com answers a logged-out visitor, in a fresh session for each request: the reply, the businesses on its place cards and the sites it cites, also under the fields markdown, text_blocks, reference_links, cards and response_metadata. location.country sets the country the question is asked from; the coordinates are reported as the visitor's position; language is not read. Name the town in query: a "near me" question is answered for wherever the request was made from.

In the document form. $1 request $2 q and no query is the document-form ChatGPT call (q, country, web_search, expand_entities), answered as the document: search_metadata, search_parameters, text_blocks, markdown, reference_links, cards (knowledge_entity) and response_metadata (message_id, is_web_search_performed, is_truncated); no search_information. country always sets the country the question is asked from (the US when left out). web_search is echoed and may not change the page; expand_entities is accepted and does nothing. Not returned (not on the logged-out page): citations (character offsets), inline_images, web_results, search_queries, a reference's ref_id, response_metadata.model and .conversation_id, a card's details, widget cards.

Authorization

headerX-API-Key<token>

Your API key.

Query Parameters

cancel_token?string

A name you make up for this request (a UUID is fine), so you can later GET /v1/cancel with it. Only you know it, so only you can cancel. Use a new one for every request, retries included: a cancelled token stays cancelled for a few minutes.

Length1 <= length <= 128
query?string

The question, as it is to be asked. 1 to 2000 characters after trimming.

Length1 <= length <= 2000
location?

Where the question is asked from. Every part is optional; a part left out, null or "" is not an error. Latitude and longitude are sent together or not at all.

q?string

The prompt.

Length1 <= length <= 4000
country?string

The country the question is asked from (the US when left out). A country that cannot be used is asked from a default location.

Default"us"
expand_entities?boolean

Accepted and echoed; it does nothing.

Response Body

The answer; with q, the document.

application/json
  1. response

The AI answer, and the same answer in the fields markdown, text_blocks, reference_links, cards and response_metadata.

search_metadata*
search_parameters*

The request's own fields as sent, engine first, without cancel_token.

search_information*

The parser's own, e.g. yelp_search's; otherwise {}.

answer_status?string

no_answer only from google_ai_overview in practice; for the others a page with no reply is parsed: false.

Value in"answered""no_answer"
model?string|null
answer_text?|

Plain text. Null with no_answer.

answer_markdown?|

Headings, lists, bold, tables; code fenced with its language, formulas as $LaTeX$. Prefer it for display.

businesses?array<>
citations?array<>
location_used?|null
markdown?|

The same as answer_markdown.

text_blocks?array<>
reference_links?array<>
cards?array<>
response_metadata?
Example Request
curl -X GET 'https://api.justserp.com/v1/chatgpt?query=Who+has+the+best+pizza+near+Chelsea%2C+New+York%2C+NY%3F&location%5Bcountry%5D=us&location%5Blanguage%5D=en'
Example Response
{  "search_metadata": {    "id": "string",    "status": "Success",    "created_at": "string",    "request_url": "string",    "html_url": "string"  },  "search_parameters": {},  "search_information": {},  "answer_status": "answered",  "model": "string",  "answer_text": "string",  "answer_markdown": "string",  "businesses": [    {      "position": 0,      "name": "string",      "snippet": "string",      "place_id": "string",      "data_id": "string",      "data_cid": "string",      "kgmid": "string",      "website": "string",      "address": "string",      "phone": "string",      "latitude": 0,      "longitude": 0,      "rating": 0,      "reviews": 0,      "citation_indexes": [        0      ],      "maps_url": "string"    }  ],  "citations": [    {      "position": 0,      "url": "string",      "title": "string",      "snippet": "string",      "source": "string",      "date": "string"    }  ],  "location_used": {    "latitude": 0,    "longitude": 0,    "name": "string",    "source": "string"  },  "markdown": "string",  "text_blocks": [    {      "type": "paragraph",      "answer": "string",      "items": [        null      ],      "headers": [        "string"      ],      "rows": [        [          "string"        ]      ]    }  ],  "reference_links": [    {      "index": 0,      "title": "string",      "link": "string",      "source": "string",      "snippet": "string",      "date": "string"    }  ],  "cards": [    {      "type": "knowledge_entity",      "name": "string",      "category": "string",      "disambiguation": "string",      "id": "string"    }  ],  "response_metadata": {    "model": null,    "conversation_id": null,    "message_id": "string",    "is_web_search_performed": true,    "is_truncated": true  }}