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

# idempotency_key_reuse

> 解决 HTTP 409 冲突：区分请求仍在处理中与 Idempotency-Key 被用于不同输入的情况。

| | |
| - | - |
| **代码** | `idempotency_key_reuse` |
| **HTTP 状态** | `409 Conflict` |
| **是否可重试** | 请读取响应中的 `retryable` |

## 选择正确的恢复方式

同一个错误代码对应两种不同的情况。请先检查 `retryable`，再采取操作；仅凭 HTTP 状态无法判断是否应该重试。

| 响应 | 含义 | 后续步骤 |
| - | - | - |
| `retryable: false` | 该密钥已对应一个输入不同的请求。 | 将请求正文与原始请求进行比较。仅在有意执行不同操作时才使用新密钥。 |
| `retryable: true` | 使用该密钥的另一个请求仍在处理中。 | 保持密钥和请求不变。至少等待 `Retry-After` 秒，然后在有限的时间预算内重试。 |

### 输入不同

```json theme={null}
{
  "type": "https://docs.livingsecurity.com/developers/v1/errors/idempotency_key_reuse",
  "title": "Conflict",
  "status": 409,
  "detail": "Idempotency-Key was already used with a different request.",
  "code": "idempotency_key_reuse",
  "request_id": "req_0199a1e0-7c00-7000-8000-000000000001",
  "doc_url": "https://docs.livingsecurity.com/developers/v1/errors/idempotency_key_reuse",
  "retryable": false,
  "param": "Idempotency-Key"
}
```

### 请求仍在处理中

此示例还包含 HTTP 响应标头 `Retry-After: 1`。

```json theme={null}
{
  "type": "https://docs.livingsecurity.com/developers/v1/errors/idempotency_key_reuse",
  "title": "Conflict",
  "status": 409,
  "detail": "A concurrent request is still processing this Idempotency-Key. Retry shortly.",
  "code": "idempotency_key_reuse",
  "request_id": "req_0199a1e0-7c00-7000-8000-000000000001",
  "doc_url": "https://docs.livingsecurity.com/developers/v1/errors/idempotency_key_reuse",
  "retryable": true,
  "param": "Idempotency-Key"
}
```

## 保持重试标识稳定

对于已记载支持幂等性的操作，密钥的作用范围为组织、服务账户、HTTP 方法、资源路径以及解析后的 API 版本。更改其中任何一项都会产生不同的重试标识，而不会恢复原始操作。在同一服务账户下轮换凭据不会改变该标识，但替换后的凭据仍必须具有相应权限。

从超时中恢复时，请保持原始密钥、正文、路径和版本不变。不要仅仅为了绕过冲突而生成新密钥：原始写入操作可能已经成功。如果已知资源 ID，请检索该资源，并使用该操作文档中记载的恢复流程。对于文档中说明支持响应重放的操作，已完成的重放会携带 `Idempotent-Replayed: true`。

发送 `Idempotency-Key` 并不会使操作具备幂等性，除非其参考文档明确支持该标头。重试保护受该操作保留策略的限制，并不是防止重复的永久保证。

如果处理问题仍未解决，请联系 [Living Security 支持团队](mailto:support@livingsecurity.com)，并提供 `request_id`、UTC 时间戳、方法、路径和 API 版本。切勿包含 API 密钥、客户端密钥或访问令牌。


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