For the complete documentation index, see llms.txt. This page is also available as Markdown.

ChatGPT

Extract ChatGPT responses by submitting prompts, with parsed data including response text, Markdown output, citations, external links, and shopping product details.

The chatgpt source lets you submit a prompt to ChatGPT and receive a fully parsed, structured response, including the plain-text and Markdown answer, source citations, and shopping products and ads.

Request samples

The following code examples demonstrate how to submit a prompt to ChatGPT using Push-Pull.

curl 'https://data.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
        "source": "chatgpt",
        "prompt": "best supplements for better sleep",
        "parse": true,
        "geo_location": "United States",
        "callback_url": "https://your-server.com/oxylabs-callback"
    }'
import requests
from pprint import pprint

# Structure payload.
payload = {
    'source': 'chatgpt',
    'prompt': 'best supplements for better sleep',
    'parse': True,
    'geo_location': "United States",
    'callback_url': "https://your-server.com/oxylabs-callback"
}

# Get response.
response = requests.request(
    'POST',
    'https://data.oxylabs.io/v1/queries',
    auth=('USERNAME', 'PASSWORD'),
    json=payload,
)

# Print prettified response to stdout.
pprint(response.json())

Submitting a job with Push-Pull integration method (including batch queries) method returns the job ID immediately – not the result. Once the job status is done, retrieve the parsed response. See Integration method on the LLMs and AI page for the full submit-and-retrieve flow.

Request parameters

Basic setup and customization options for scraping ChatGPT.

Parameter
Description
Default Value

source

Sets the scraper target. Use chatgpt.

–

prompt

The prompt or question to submit to ChatGPT. Up to 4,000 characters.

–

callback_url

Recommended. URL where we deliver a notification once the job completes. More info

–

search

Set to true for web search.

false

parse

Set to true for structured JSON results.

false

geo_location

Specify a country to route the request from. More info.

–

- mandatory parameter

Structured data

Once the job is retrieved via the Push-Pull results endpoint, Web Scraper API returns either an HTML or JSON object that contains ChatGPT output, with structured data on various elements of the results page.

In the examples below, long text values are shortened (...) and arrays are trimmed to the first few items.

chatgpt structured output

When ChatGPT recommends products, the response also contains shopping_products with the product cards shown in the answer. The following example is from the prompt What are the best running shoes for flat feet under $150?:

shopping_products example

Output data dictionary

HTML example

JSON structure

All LLM targets return the same top-level job and results[] envelope. See LLMs and AI for the full metadata reference.

The following table shows ChatGPT-specific results[].content fields:

The number of items and fields for a specific result type may vary depending on the submitted prompt.

In addition to this, parsed fields follow ChatGPT's current layout and can change when ChatGPT changes it.

Field
Description
Type

prompt

Submitted prompt to generate result.

string

response_text

Plain-text response from ChatGPT.

string

markdown_text

ChatGPT response as Markdown.

string

markdown_json

Structured JSON representation of the Markdown response. Each item contains type and children.

array

citations

List of response source citations. Objects contain title, url, text, and description.

array

links

List of objects for inline source link details: url and text.

array

shopping_products

List of products ChatGPT recommends, as shown on the product cards in the answer. Objects contain title, url (link to the product page), price, price_str, currency, merchant (the store selling the product), badge (ChatGPT's label for the product, e.g. "Best overall"), description (ChatGPT's description of the product), thumbnail, image_page_title and image_page_url (title and URL of the web page the card image comes from, which may be a different store than merchant), rating (the product's star rating from the store listing), citations, and offers.

array

shopping_products.offers

Merchant offers for the product. ChatGPT usually lists one store per product. Objects contain merchant, price, price_str, currency, url, and details (availability and delivery details, as displayed).

array

shopping_products.citations

Sources ChatGPT cites for the product. Objects contain source (the website or publication name), title, and url.

array

ads

Ad details containing url, title, image_url, description, and an advertiser_info object.

array

ads.advertiser_info

Object with advertiser url, name, and image_data.

object

raw_response

Raw streamed response from ChatGPT, one line per item.

array of strings

parse_status_code

12000 – successful. Otherwise, parser failed to extract some or all structured fields.

integer

– conditional, returned only when content is in the LLM's response.

Last updated

Was this helpful?