Skip to content

ResponseExample

When showing developers what an API request returns, it’s helpful to wrap the JSON snippet in a dedicated visual container that clearly states the HTTP response code.

import ResponseExample from '@/components/docs/ResponseExample.astro';
<ResponseExample status="200 OK" title="User Object">
```json
{
"id": "usr_12345",
"email": "[email protected]",
"active": true
}

</ResponseExample>

## Preview
<ResponseExample status="200 OK" title="User Object">
{`{
"id": "usr_12345",
"email": "[email protected]",
"active": true
}`}
</ResponseExample>
<ResponseExample status="404 Not Found" title="Error Payload">
{`{
"error": {
"code": "not_found",
"message": "The requested user ID does not exist."
}
}`}
</ResponseExample>
## Properties
| Prop | Type | Required | Description |
|---|---|---|---|
| `status` | `string` | **Yes** | The HTTP status code and message. If it starts with "2", the badge turns green. Otherwise, it turns red. |
| `title` | `string` | No | A custom title for the header. Defaults to "Response". |