Social APIs
ChatGPT API
Submit ChatGPT prompts asynchronously and retrieve structured answers from the snapshot API.
Download Postman collectionChatGPT API
The ChatGPT API submits prompt jobs through the async e-commerce endpoint. Each submit request returns a snapshot_id; use that ID to retrieve the finished records when they are ready.
API endpoint
https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=chatgpt_async&type=promptParameters
| Parameter | Required | Type | Description |
|---|---|---|---|
api_key | ✅ | string | Authenticates the request. |
engine | ✅ | string | Use chatgpt_async. |
type | ✅ | string | Use prompt. |
| request body | ✅ | array | JSON array of prompt inputs. The current schema accepts up to 5000 items. |
country | ❌ | string | Can be provided in each body item to geotarget the prompt session. |
answer_html | ❌ | boolean | Include HTML answer output when enabled. |
shopping | ❌ | boolean | Include shopping output fields when enabled. |
shopping_visible | ❌ | boolean | Include only visible shopping results when enabled. |
snapshot_id | Poll only | string | The ID returned by the submit request. |
Submit Prompts
Use POST to submit one or more prompt inputs.
curl --request POST "https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=chatgpt_async&type=prompt" \
--header "Content-Type: application/json" \
--data '[
{
"url": "https://chatgpt.com/",
"prompt": "Summarize the benefits of server-side rendered documentation for API users.",
"web_search": true,
"country": "US"
}
]'const API_KEY = "<YOUR_API_KEY>";
const API_URL = "https://ecom.webscrapingapi.com/v1";
const params = new URLSearchParams({
api_key: API_KEY,
engine: "chatgpt_async",
type: "prompt",
});
const response = await fetch(`${API_URL}?${params}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify([
{
url: "https://chatgpt.com/",
prompt: "Summarize the benefits of server-side rendered documentation for API users.",
web_search: true,
country: "US",
},
]),
});
const data = await response.json();
console.log(data.snapshot_id);import requests
response = requests.post(
"https://ecom.webscrapingapi.com/v1",
params={
"api_key": "<YOUR_API_KEY>",
"engine": "chatgpt_async",
"type": "prompt",
},
json=[
{
"url": "https://chatgpt.com/",
"prompt": "Summarize the benefits of server-side rendered documentation for API users.",
"web_search": True,
"country": "US",
}
],
)
print(response.json()["snapshot_id"])<?php
$query = http_build_query([
'api_key' => '<YOUR_API_KEY>',
'engine' => 'chatgpt_async',
'type' => 'prompt',
]);
$payload = json_encode([
[
'url' => 'https://chatgpt.com/',
'prompt' => 'Summarize the benefits of server-side rendered documentation for API users.',
'web_search' => true,
'country' => 'US',
],
]);
$ch = curl_init("https://ecom.webscrapingapi.com/v1?$query");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => $payload,
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
body := []byte(`[
{
"url": "https://chatgpt.com/",
"prompt": "Summarize the benefits of server-side rendered documentation for API users.",
"web_search": true,
"country": "US"
}
]`)
request, err := http.NewRequest(
http.MethodPost,
"https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=chatgpt_async&type=prompt",
bytes.NewReader(body),
)
if err != nil {
panic(err)
}
request.Header.Set("Content-Type", "application/json")
response, err := http.DefaultClient.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
responseBody, err := io.ReadAll(response.Body)
if err != nil {
panic(err)
}
fmt.Println(string(responseBody))
}import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws IOException, InterruptedException {
String body = """
[
{
"url": "https://chatgpt.com/",
"prompt": "Summarize the benefits of server-side rendered documentation for API users.",
"web_search": true,
"country": "US"
}
]
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=chatgpt_async&type=prompt"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var json = """
[
{
"url": "https://chatgpt.com/",
"prompt": "Summarize the benefits of server-side rendered documentation for API users.",
"web_search": true,
"country": "US"
}
]
""";
using var client = new HttpClient();
using var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(
"https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&engine=chatgpt_async&type=prompt",
content
);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}require "json"
require "net/http"
require "uri"
uri = URI("https://ecom.webscrapingapi.com/v1")
uri.query = URI.encode_www_form(
api_key: "<YOUR_API_KEY>",
engine: "chatgpt_async",
type: "prompt"
)
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request.body = [
{
url: "https://chatgpt.com/",
prompt: "Summarize the benefits of server-side rendered documentation for API users.",
web_search: true,
country: "US",
},
].to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.bodyResponse example
{
"snapshot_id": "s_m4x7enmven8djfqak"
}Retrieve Results
Use the returned snapshot_id to retrieve the processed result.
https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&snapshot_id=s_m4x7enmven8djfqakcurl --get "https://ecom.webscrapingapi.com/v1" \
--data-urlencode "api_key=<YOUR_API_KEY>" \
--data-urlencode "snapshot_id=s_m4x7enmven8djfqak"const params = new URLSearchParams({
api_key: "<YOUR_API_KEY>",
snapshot_id: "s_m4x7enmven8djfqak",
});
const response = await fetch(`https://ecom.webscrapingapi.com/v1?${params}`);
const data = await response.json();
console.log(data);import requests
response = requests.get(
"https://ecom.webscrapingapi.com/v1",
params={
"api_key": "<YOUR_API_KEY>",
"snapshot_id": "s_m4x7enmven8djfqak",
},
)
print(response.json())<?php
$query = http_build_query([
'api_key' => '<YOUR_API_KEY>',
'snapshot_id' => 's_m4x7enmven8djfqak',
]);
echo file_get_contents("https://ecom.webscrapingapi.com/v1?$query");package main
import (
"fmt"
"io"
"net/http"
)
func main() {
response, err := http.Get("https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&snapshot_id=s_m4x7enmven8djfqak")
if err != nil {
panic(err)
}
defer response.Body.Close()
body, err := io.ReadAll(response.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&snapshot_id=s_m4x7enmven8djfqak"))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
var response = await client.GetStringAsync("https://ecom.webscrapingapi.com/v1?api_key=<YOUR_API_KEY>&snapshot_id=s_m4x7enmven8djfqak");
Console.WriteLine(response);
}
}require "net/http"
require "uri"
uri = URI("https://ecom.webscrapingapi.com/v1")
uri.query = URI.encode_www_form(
api_key: "<YOUR_API_KEY>",
snapshot_id: "s_m4x7enmven8djfqak"
)
response = Net::HTTP.get(uri)
puts responseResult response example
{
"input": {
"prompt": "Summarize the benefits of server-side rendered documentation for API users.",
"web_search": true,
"country": "US"
},
"answer": "Server-side rendered documentation improves discoverability, loads quickly, and keeps API examples accessible to users and search engines.",
"answer_html": "<p>Server-side rendered documentation improves discoverability, loads quickly, and keeps API examples accessible to users and search engines.</p>"
}