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 LLM model information.

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, search queries the model used, 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())

Note: JavaScript rendering is enabled by default for all LLM sources. You do not need to include rendering parameters in your request payload.

Submitting a job with Push-Pull integration (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. Must be under 4000 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.

browser_instructions

Optional custom browser instructions when rendering JavaScript. 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.

chatgpt structured output

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 show ChatGPT-specific results[].content fields:

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

Field
Description
Type

prompt

Submitted prompt to generate result.

string

llm_model

Specific ChatGPT model used for the response (e.g., gpt-4o).

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, description, and section.

array

search_queries

Search queries used by the model to gather information.

array of strings

links

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

array

shopping_products

List of objects containing product details: price, title, rating, currency, price_str, and thumbnail.

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_url

object

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?