> ## 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 请求追踪

> 使用 AIBase-Request-Id 标识与追踪每一次 GEOBase API 调用。

`requestId` 用于标识和追踪一次具体 API 调用，对应请求头 `AIBase-Request-Id`。未传时由系统自动生成 UUID。

<ParamField header="AIBase-Request-Id" type="string">
  开发者自定义请求 ID。建议使用「业务前缀 + 时间戳 + 序号」的形式，例如 `req-20260924-001`。
</ParamField>

## 为什么需要传

* **串联调用链**：一次业务操作可能连续调用多个 `apiCode`，使用同一个业务前缀可以串起完整链路。
* **快速定位**：出现接口异常、返回数据异常或超时时，提供 `requestId` 可显著加快排查。
* **幂等与去重**：客户端可基于自己的 ID 规则识别重复提交。

## 使用建议

1. **生产环境必传**：建议在生产环境中由调用方生成并持久化该值。
2. **保证可读性**：使用稳定前缀，避免纯随机串，便于日志检索。
3. **全局唯一**：同一时间点不同请求不要复用同一个 ID。
4. **与响应一起落库**：将 `requestId`、`apiCode`、请求参数摘要、响应 `code` 与耗时一并记录。

```bash theme={null}
curl --location 'https://geobaseapi.aibase.com/v1/openapi/execute' \
  --header 'Content-Type: application/json' \
  --header "AIBase-API-Key: ${AIBASE_API_KEY}" \
  --header 'AIBase-Request-Id: order-sync-20260924-0007' \
  --data '{"apiCode": "geo.brand", "data": {}}'
```

<Note>
  GEOBase 统一响应体的外层字段为 `code` / `msg` / `data` / `timeStamp`，响应体中不返回 `requestId`。排查问题时请提供你自行传入的 `AIBase-Request-Id`；若未传入，则需要提供调用时间、`apiCode` 与客户端出口 IP 以辅助定位。
</Note>

<Card title="异常排查清单" icon="list-checks" href="/geobase-api/platform/troubleshooting" horizontal>
  按参数、认证、权限和响应解析逐项定位问题。
</Card>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.