Skip to content

API reference

ChatGPT API

Prompt in, answer out. Send a prompt and get ChatGPT's answer back as text. Handy for summarising, classifying or rewriting what you just scraped, on the same key and balance.

POST/api/v1/chatgptJSON body: {"prompt"}10 credits
Only successful calls are charged

Body

  • promptstringRequired
    What to ask. Include any text you want it to work on.

Response

success, response (the answer), duration and statusCode. A missing prompt returns 400 with Missing required parameter: prompt; other failures return success: false with an error and are refunded.

Request

curl -X POST "https://scrapingbot.io/api/v1/chatgpt" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Summarize in one sentence: ScrapingBot turns any web page into clean, structured data."
  }'
import requests

response = requests.post(
    "https://scrapingbot.io/api/v1/chatgpt",
    headers={"x-api-key": "YOUR_API_KEY"},
    json={
        "prompt": "Summarize in one sentence: ScrapingBot turns any web page into clean, structured data.",
    },
    timeout=60,
)
data = response.json()
print(data["response"])
const response = await fetch("https://scrapingbot.io/api/v1/chatgpt", {
  method: "POST",
  headers: {
    "x-api-key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    prompt: "Summarize in one sentence: ScrapingBot turns any web page into clean, structured data.",
  }),
});
const data = await response.json();
console.log(data.response);
<?php
$ch = curl_init("https://scrapingbot.io/api/v1/chatgpt");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "x-api-key: YOUR_API_KEY",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "prompt" => "Summarize in one sentence: ScrapingBot turns any web page into clean, structured data.",
    ]),
]);
$data = json_decode(curl_exec($ch), true);
print_r($data["response"]);

Response

200 OK
{
  "success": true,
  "response": "ScrapingBot is an API that converts web pages into clean, structured data.",
  "duration": "1.84",
  "statusCode": 200
}

Stuck on something?

Try requests in the dashboard playgrounds, check every call in your usage log, or write to [email protected]. A real developer answers.