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

# RequestExample

Pin request code examples in the right-side panel alongside API endpoint documentation.

**Interactive playground** For isolated previews, theme switching, and sandbox editing, open [the RequestExample playground on holydocs.com](https://holydocs.com/components/request-example).

## When to use

Use this component when endpoint documentation needs explicit request, response, schema, or lifecycle metadata.

This component is designed for the right-hand panel on endpoint pages. On narrow layouts it stacks later in the page, so verify both desktop and mobile behavior.

## Live Examples

Every example below renders the real component directly inside HolyDocs, followed by the exact MDX you can paste into a page.

### Basic

A cURL request example.

```bash
curl -X POST https://api.holydocs.com/v1/projects \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "My Docs"}'
```

~~~mdx
<RequestExample>
```bash
curl -X POST https://api.holydocs.com/v1/projects \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "My Docs"}'
```
</RequestExample>
~~~

### Titled

Request example with an explicit label.

**Create project request**

```json
{
  "name": "My Docs"
}
```

~~~mdx
<RequestExample title="Create project request">
```json
{
  "name": "My Docs"
}
```
</RequestExample>
~~~

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | `--` | Optional label shown above the example. |

## Usage

Start from this baseline shape and then tailor the copy, data, or nesting to the page you are writing.

~~~mdx
<RequestExample>
```bash
curl -X POST https://api.holydocs.com/v1/projects \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "My Docs"}'
```
</RequestExample>
~~~

## Tips

- Match the example exactly to the endpoint definition on the page. Drift between the request example and field definitions is high-friction.
- Keep naming and ordering consistent across fields, examples, and lifecycle notes so readers do not have to re-parse the endpoint surface on every page.
- Document the happy path and the sharp edges together. Request shape alone is not enough without auth, errors, and retry guidance.

## Related Components

**[ParamField](/components/param-field)**

Documents a request parameter — path, query, or body — with type, requirement status, and description.
**[ResponseField](/components/response-field)**

Documents a field in an API response body with its name, type, and description.
**[Expandable](/components/expandable)**

Collapsible section for nested API fields, keeping complex response shapes readable.

## More

- Interactive playground: [RequestExample on holydocs.com](https://holydocs.com/components/request-example)
- Component library index: [/components](/components)