> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiJhNmZmOGI4MC1kNTIwLTQ2ODMtOWJhYy0zOTM1ZjRlNTYxZTkiLCJleHAiOjE3Nzg0OTMwNzEsImlhdCI6MTc3ODQ5Mjc3MX0.c-IVpIjKX5ol2qUKrfu0fB45kwXHRhq_kgnlb_WE1Tw
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# 重试行为

> 使用 x-fern-retries 扩展控制 API 重试逻辑。配置端点级别的重试行为，并为支付处理和订单创建禁用重试。

<Callout intent="info">
  `x-fern-retries` 扩展仅在 Python SDK 中受支持。
</Callout>

`x-fern-retries` 扩展在您的 OpenAPI 规范中为每个端点配置重试行为，覆盖 SDK 用户配置的任何重试设置。使用它可以为非幂等操作（如支付处理或订单创建）禁用重试。

要为特定端点禁用重试，请设置 `disabled: true`。

```yaml title="openapi.yml" {4-5,15-16}
paths:
  /plants/{plantId}:
    get:
      x-fern-retries:
        disabled: true
      operationId: get_plant
      parameters:
        - name: plantId
          in: path
          required: true
          schema:
            type: string
  /plants:
    post:
      x-fern-retries:
        disabled: true
      operationId: create_plant
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                species:
                  type: string
      responses:
        '201':
          description: Plant created successfully
```

当在端点级别禁用重试时，生成的 SDK 不会重试对该端点的失败请求，无论 SDK 用户的自定义配置如何。