Files
mintlify__docs/api-playground/multiple-responses.mdx
mintlify[bot] f8e015ff62 Improve SEO descriptions across 177 pages (#4993)
* Improve SEO metadata: update descriptions to 130-155 chars across 177 pages

Generated-By: mintlify-agent

* Apply suggestion from @ethanpalm

* Apply suggestions from code review

Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com>

* 💅

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com>
2026-03-31 16:12:58 -07:00

54 lines
1.7 KiB
Plaintext

---
title: "Multiple responses"
description: "Document multiple response variations for API endpoints, including success and error cases, with status codes and example payloads."
keywords: ["response examples", "conditional responses", "response variations", "examples property"]
---
If your API returns different responses based on input parameters, user context, or other conditions of the request, you can document multiple response examples with the `examples` property.
Add this property to any response. It has the following schema.
```yaml
responses:
"200":
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/YourResponseSchema"
examples:
us:
summary: Response for United States
value:
countryCode: "US"
currencyCode: "USD"
taxRate: 0.0825
gb:
summary: Response for United Kingdom
value:
countryCode: "GB"
currencyCode: "GBP"
taxRate: 0.20
```
The playground also handles non-JSON response types differently based on their content type.
## Audio response examples
For endpoints that return audio files, set the response content type to `audio/*` and provide a URL to an audio file as the example value. The playground renders an interactive audio player instead of a code snippet.
```yaml
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"
```