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

# 第一次 API 请求

> 调用 AI 对话问题挖掘服务，完成第一条 AIBase API 请求。

下面使用当前已上线的“AI 对话问题挖掘”服务完成第一次调用。该服务的 `apiCode` 为 `geo.questions_corr_recommend`。

## 1. 准备请求

所有开放 API 共用以下地址：

```http theme={null}
POST https://api.aibase.cn/v1/openapi/tasks
```

请求体包含 `apiCode` 和 `data`。当前接口只需要一个关键词。

```json theme={null}
{
  "apiCode": "geo.questions_corr_recommend",
  "data": {
    "keyword": "多智能体系统"
  }
}
```

## 2. 发送请求

先把 API Key 写入当前终端会话的环境变量，避免把真实密钥保存到脚本中。

<Tabs>
  <Tab title="PowerShell">
    ```powershell theme={null}
    $env:AIBASE_API_KEY = "AIBase_xxxxxxxxxxxxxxxx"
    ```
  </Tab>

  <Tab title="macOS / Linux">
    ```bash theme={null}
    export AIBASE_API_KEY="AIBase_xxxxxxxxxxxxxxxx"
    ```
  </Tab>
</Tabs>

```bash theme={null}
curl --location 'https://api.aibase.cn/v1/openapi/tasks' \
  --header "AIBase-API-Key: ${AIBASE_API_KEY}" \
  --header 'AIBase-Request-Id: req-20260908-000001' \
  --header 'Content-Type: application/json' \
  --data '{
    "apiCode": "geo.questions_corr_recommend",
    "data": {
      "keyword": "多智能体系统"
    }
  }'
```

<Note>
  上述 cURL 命令适用于 macOS、Linux、Git Bash 和 WSL。Windows PowerShell 的完整命令见 [cURL 调用](/examples/curl)。
</Note>

## 3. 判断结果

请求成功后，平台返回统一外层结构，具体问题列表位于 `data.result`。

```json theme={null}
{
  "code": 200,
  "msg": "成功",
  "data": {
    "result": {
      "aiQuestions": [],
      "baiduQuestions": []
    },
    "requestId": "599b2f8f39078d"
  },
  "timeStamp": 1788830174812
}
```

<Check>
  首次调用完成后，请确认 HTTP 状态正常、业务 `code = 200`，并保存 `data.requestId`。
</Check>

## 4. 首次调用验收

* 返回体可以解析为 JSON。
* HTTP 状态符合预期，并且业务 `code` 为 `200`。
* `data.result.aiQuestions` 和 `data.result.baiduQuestions` 按数组读取。
* 日志中保存了 `data.requestId`，且没有记录完整 API Key。

<Columns cols={2}>
  <Card title="查看完整接口定义" icon="messages-square" href="/api-reference/question-discovery">
    查看全部请求参数、响应字段和语言示例。
  </Card>

  <Card title="处理错误响应" icon="triangle-alert" href="/quickstart/response-errors">
    区分参数、认证、权限、限流和平台错误。
  </Card>
</Columns>
