> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify-docs-automation-github-pr-review.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 多种响应

> 为 API 端点记录多种响应变体，包括成功和错误情况，并附带状态码和示例 payload。

如果你的 API 会根据输入参数、用户上下文或请求的其他条件返回不同的响应，你可以使用 `examples` 属性来记录多个响应示例。

将此属性添加到任意响应中。它具有以下架构。

```yaml theme={null}
responses:
  "200":
    description: 成功响应
    content:
      application/json:
        schema:
          $ref: "#/components/schemas/YourResponseSchema"
        examples:
          us:
            summary: 美国的响应
            value:
              countryCode: "US"
              currencyCode: "USD"
              taxRate: 0.0825
          gb:
            summary: 英国的响应
            value:
              countryCode: "GB"
              currencyCode: "GBP"
              taxRate: 0.20
```

Playground 还会根据内容类型，以不同方式处理非 JSON 响应。

<div id="audio-response-examples">
  ## 音频响应示例
</div>

对于返回音频文件的端点，请将响应内容类型设置为 `audio/*`，并提供音频文件的 URL 作为示例值。playground 显示的是交互式音频播放器，而不是代码片段。

```yaml theme={null}
responses:
  "200":
    description: Audio file generated successfully
    content:
      audio/mpeg:
        schema:
          type: string
          format: binary
        examples:
          sample:
            summary: Sample audio output
            value: "https://example.com/sample-audio.mp3"
```
