> ## 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.

# requestId 请求追踪

> 生成、保存和使用 requestId 定位一次具体的 API 调用。

`requestId` 用于标识和追踪一次具体 API 调用。当接口异常、返回数据异常或超时时，可以使用它辅助定位问题。

## 如何获得 requestId

* 调用方可以通过 `AIBase-Request-Id` Header 传入自定义请求 ID。
* 未传入时，AIBase 平台会自动生成请求 ID。
* 成功响应会在 `data.requestId` 中返回本次请求的追踪标识。

```json theme={null}
{
  "data": {
    "result": {},
    "requestId": "599b2f8f39078d"
  }
}
```

## 生产环境建议

将 `requestId` 与调用时间、HTTP 状态、业务 `code`、`msg` 和内部业务流水号一起记录。请勿在日志中记录完整 API Key 或包含敏感业务数据的完整请求体。

<Warning>
  Request ID 用于链路追踪，不等同于幂等键。相同的 `AIBase-Request-Id` 是否会触发重复处理，应以具体接口后续公布的幂等规则为准。
</Warning>

<Card title="查看安全建议" icon="shield-check" href="/platform/security" horizontal>
  了解凭证保存和异常日志的安全边界。
</Card>
