> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brightdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 发送您的第一个ChatGPT搜索请求

> 使用可复制粘贴的代码示例向Bright Data ChatGPT爬虫API发起同步请求，支持搜索、国家定位和后续提示。

本指南介绍如何向 Bright Data ChatGPT Scraper API 发送同步请求。完成后，您将拥有基本搜索、国家定向搜索和后续提示的工作示例。

## Prerequisites

* A [Bright Data account](https://www.bright.cn/cp/start) with an active API key
* Completed the [Quickstart](/cn/products/scrapers/chatgpt/quickstart)

## 请求结构

每个同步请求都遵循相同的模式：

```
POST https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_m7aof0k82r803d5bjm&format=json
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

[{"url": "https://chatgpt.com/", "prompt": "Your search prompt here"}]
```

`url` 字段始终为 `https://chatgpt.com/`。`prompt` 字段包含您的搜索查询。

<Note>
  同步请求最多支持 20 个输入，超时时间为 1 分钟。如果请求耗时较长，API 将自动返回 `snapshot_id`。请参阅[异步请求](/cn/products/scrapers/scrapers-library/async-requests)。
</Note>

## ChatGPT 搜索

**Dataset ID:** `gd_m7aof0k82r803d5bjm`

### 基本搜索

发送提示并获取带有引用的结构化答案：

```bash theme={null}
curl -X POST \
  "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_m7aof0k82r803d5bjm&format=json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{"url": "https://chatgpt.com/", "prompt": "Top hotels in New York"}]'
```

您应该看到 `200` 响应。这需要 15-45 秒。

<Accordion title="Example response">
  ```json theme={null}
  [
    {
      "url": "https://chatgpt.com/",
      "prompt": "Top hotels in New York",
      "answer_text": "Here are some of the top-rated hotels in New York City...",
      "answer_text_markdown": "Here are some of the top-rated hotels in **New York City**...",
      "model": "gpt-4o",
      "web_search_triggered": true,
      "is_map": false,
      "shopping_visible": false,
      "citations": [
        {
          "title": "Best Hotels in NYC - Travel Guide",
          "url": "https://example.com/nyc-hotels",
          "position": 1
        }
      ],
      "search_sources": [
        {
          "url": "https://example.com/nyc-hotels",
          "title": "Best Hotels in NYC - Travel Guide"
        }
      ],
      "links_attached": [
        {
          "url": "https://example.com/nyc-hotels",
          "text": "Travel Guide"
        }
      ],
      "recommendations": [],
      "references": [],
      "prompt_sent_at": "2026-04-08T12:00:00.000Z"
    }
  ]
  ```
</Accordion>

### 国家定向搜索

使用 `country` 字段获取特定位置的结果：

```bash theme={null}
curl -X POST \
  "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_m7aof0k82r803d5bjm&format=json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{"url": "https://chatgpt.com/", "prompt": "Best local restaurants", "country": "JP"}]'
```

<Accordion title="Example response">
  ```json theme={null}
  [
    {
      "url": "https://chatgpt.com/",
      "prompt": "Best local restaurants",
      "answer_text": "Here are some highly recommended local restaurants in Japan...",
      "model": "gpt-4o",
      "web_search_triggered": true,
      "is_map": true,
      "citations": [
        {
          "title": "Top Restaurants in Tokyo",
          "url": "https://example.com/tokyo-restaurants",
          "position": 1
        }
      ],
      "prompt_sent_at": "2026-04-08T12:05:00.000Z"
    }
  ]
  ```
</Accordion>

### 后续提示搜索

使用 `additional_prompt` 字段在同一会话中提出后续问题：

```bash theme={null}
curl -X POST \
  "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_m7aof0k82r803d5bjm&format=json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{"url": "https://chatgpt.com/", "prompt": "Top hotels in New York", "additional_prompt": "Which of these are pet-friendly?"}]'
```

<Accordion title="Example response">
  ```json theme={null}
  [
    {
      "url": "https://chatgpt.com/",
      "prompt": "Top hotels in New York",
      "answer_text": "Here are some of the top-rated hotels in New York City...",
      "additional_answer_text": "Among the hotels listed, the following are pet-friendly...",
      "model": "gpt-4o",
      "web_search_triggered": true,
      "citations": [
        {
          "title": "Pet-Friendly Hotels NYC",
          "url": "https://example.com/pet-friendly-nyc",
          "position": 1
        }
      ],
      "prompt_sent_at": "2026-04-08T12:10:00.000Z"
    }
  ]
  ```
</Accordion>

[完整 ChatGPT 搜索响应架构](/cn/api-reference/scrapers/ai-search-apis/chatgpt-search-by-prompt)

## 快速参考：数据集 ID

| Endpoint       | Dataset ID              | Input            |
| :------------- | :---------------------- | :--------------- |
| ChatGPT Search | `gd_m7aof0k82r803d5bjm` | `url` + `prompt` |

## 输入字段

| Field               | Required | Description                |
| :------------------ | :------- | :------------------------- |
| `url`               | Yes      | 始终为 `https://chatgpt.com/` |
| `prompt`            | Yes      | 搜索提示（最多 4,096 个字符）         |
| `country`           | No       | 国家代码，用于位置定向结果              |
| `index`             | No       | 唯一追踪 ID（数字）                |
| `require_sources`   | No       | 如果未找到来源则返回错误（布尔值）          |
| `additional_prompt` | No       | 同一会话中的后续提示                 |
| `web_search`        | No       | 启用或禁用网络搜索（默认值：`true`）      |

## 输出格式

使用 `format` 查询参数控制响应格式：

| Value    | Description       |
| :------- | :---------------- |
| `json`   | JSON 数组（默认）       |
| `ndjson` | 换行分隔的 JSON，每行一条记录 |
| `csv`    | 逗号分隔值             |

## 相关内容

<CardGroup cols={2}>
  <Card title="异步批处理请求" icon="layer-group" href="/products/scrapers/scrapers-library/async-requests">
    在单个批处理作业中使用数百个提示搜索 ChatGPT。
  </Card>

  <Card title="API 参考" icon="code" href="/api-reference/scrapers/ai-search-apis/chatgpt-search-by-prompt">
    完整的参数和响应字段参考。
  </Card>
</CardGroup>
