# 400 错误请求：缺少必需的请求头 'X-Request-Id'

- **ID:** `api/http-400-missing-required-header`
- **领域:** api
- **类别:** request_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

API 端点需要特定的 HTTP 请求头，但客户端未在请求中包含该头。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| REST API | active | — | — |
| OpenAPI 3.0 | active | — | — |
| Express.js v4 | active | — | — |
| FastAPI v0.100 | active | — | — |

## 解决方案

1. ```
   Add the header to the request: in curl, use `-H 'X-Request-Id: abc123'`; in Python requests, use `headers={'X-Request-Id': 'abc123'}`.
   ```
2. ```
   Check the API documentation for a list of all required headers and their expected values (e.g., length, format).
   ```

## 无效尝试

- **** — The server may validate the header's format or content, not just its presence. (80% 失败率)
- **** — Headers are request-specific; response headers are ignored. (100% 失败率)
