# ChatGPT

The LLM Scraper enables retrieval of ChatGPT responses- including optional search-enhanced answers and returns a structured JSON output.

***

### **API Setup**

#### **Endpoint**

```
https://llm-scraper.netnut.io/search
```

***

### **Authentication**

Use HTTP Basic Authentication:

```
Authorization: Basic <base64(username:password)>
```

Where `<base64(username:password)>` is the Base64-encoded string of your NetNut credentials.

***

### **Request Body Schema**

```json
{
  "prompt": "Explain SEO ranking factors in 2025",   // Required
  "country": "us",                                   // Optional
  "web_search": false,                               // Optional, default false
  "follow_up_prompt": "Summarize in 5 bullets",      // Optional
  "engine": "chatgpt",                               // default: chatgpt
  "raw_response" : false                             // Optional, default false
}
```

#### **Field Descriptions**

| Field                  | Description                                                                              | Parameter Type              |
| ---------------------- | ---------------------------------------------------------------------------------------- | --------------------------- |
| **prompt**             | Main prompt sent to ChatGPT. Max length: 4096 chars.                                     | Required                    |
| **web\_search**        | Enables ChatGPT’s built-in Web Search mode.                                              | Optional (default: false)   |
| **country**            | Target geographic region for contextual responses.                                       | Optional                    |
| **engine**             | The chatbot engine to use. Currently only "chatgpt" is supported.                        | Optional (default: chatgpt) |
| **follow\_up\_prompt** | A second message sent immediately after the first response.                              | Optional                    |
| **raw\_response**      | returns the raw output from the LLM session (including metadata and intermediate events) | Optional (default: false)   |

***

### **Example Usage**

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://llm-scraper.netnut.io/search \
  -H "Content-Type: application/json" \
  -U "username:password" \
  -d '{
    "prompt": "Give me SEO trends for 2025",
    "country": "uk",
    "web_search": true
  }'

```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from base64 import b64encode

headers = {
    "Authorization": "Basic " + b64encode(b"username:password").decode(),
    "Content-Type": "application/json"
}

body = {
    "prompt": "Give me SEO trends for 2025",
    "country": "us",
    "web_search": True
}

response = requests.post("https://llm-scraper.netnut.io/search", headers=headers, json=body)
print(response.json())

```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const username = 'your_username';
const password = 'your_password';
const auth = Buffer.from(`${username}:${password}`).toString('base64');

const headers = {
  'Authorization': `Basic ${auth}`,
  'Content-Type': 'application/json'
};

const body = {
  prompt: 'Give me SEO trends for 2025',
  country: 'us',
  web_search: true
};

fetch('https://llm-scraper.netnut.io/search', {
  method: 'POST',
  headers: headers,
  body: JSON.stringify(body)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error.message));
```

{% endtab %}
{% endtabs %}

***

### **Response Format**

The ChatGPT Scraper always returns **structured JSON**.\
No HTML is returned.

#### **Example JSON Response**

```json
{
  "timestamp": "2025-12-23T19:46:50.921Z",
  "traceID": "a6bc1d2e-1230-4b65-bde0-ab10c19e5345",
  "request_duration": 18.18,
  "process_duration": 18.18,
  "llm_model": "gpt-5.2",

  "response": {
    "prompt": "what are the leading SEO tips in 2025",

    "text_markdown": "Here are the **leading SEO tips for 2025**:\n\n### 1. High-quality, intent-focused content\n### 2. AI-aware optimization\n### 3. Strong UX and technical SEO\n\nIf you want tips tailored to your industry, let me know.",

    "text": "The leading SEO tips for 2025 include focusing on user intent, leveraging AI responsibly, improving user experience, and maintaining strong technical SEO foundations.",

    "model_search_queries": [
      "leading SEO tips in 2025",
      "top SEO best practices 2025"
    ],

    "widgets": [],

    "citations_found": true,
    "citations": [
      {
        "id": 1,
        "title": "SEO Trends for 2025",
        "url": "https://example.com/seo-trends-2025",
        "section": "citations"
      },
      {
        "id": 2,
        "title": "Future of Search Optimization",
        "url": "https://example.com/future-seo",
        "section": "more"
      }
    ]
  },

  "raw_response": [
    "data: {\"type\":\"server_metadata\",\"metadata\":{\"model_slug\":\"gpt-5.2\"}}",
    "event: delta",
    "data: {...}"
  ]
}


```
