---
title: Try it and proxy
subtitle: Readers can send real requests right from the docs. Hosted sites forward them through a restricted proxy that gets around browser CORS limits without becoming an open proxy.
description: The "Try it" explorer in the ButterIX API reference, in-page RunnableEndpoint, local storage of credentials, and the security rules and CORS setup for the /_biti/proxy try-it proxy.
---

## The "Try it" panel

Every endpoint's request example card has a **Try it** button. Clicking it opens the explorer (the URL gets `?explorer=true`, so it can be shared; close it with the browser's Back button or <kbd>Esc</kbd>):

- On the left you can search for and switch to other endpoints in the same API; credentials you've entered are kept.
- The auth bar at the top shows the credentials the current endpoint needs; credentials are **stored only in the reader's own browser** (isolated per site) and are never sent to ButterIX.
- The form is generated from the schema: strings and numbers are inputs, enums are dropdowns, booleans are switches, objects expand, and arrays let you add and remove items. Optional fields are collapsed under "More optional parameters", and you can load the spec's example with one click.
- The request code updates live with the form, and you can switch languages and copy it. The languages match the request examples on the page and follow [`code-languages`](./code-samples.mdx#choose-which-languages-to-show); credentials appear as dots, and copying uses the real values.
- After sending, the status code, duration, and response size are shown; the response body is formatted, and you can switch between the body and the response headers.

## In-page explorer: RunnableEndpoint

To embed a runnable request in the middle of a guide, use `<RunnableEndpoint>`:

```mdx
<RunnableEndpoint endpoint="GET /whoami" collapsed />
```

<RunnableEndpoint endpoint="GET /whoami" collapsed />

| Prop | Description |
|---|---|
| `endpoint` | `METHOD /path`; with multiple APIs, `api-name::METHOD /path` |
| `example` | Name of the example to prefill |
| `collapsed` | Collapsed by default |
| `defaultEnvironment` | Server URL selected by default |
| `readonly` | Read-only fields |

## How requests are sent

<Steps>
  <Step title="Try a direct request first">
    The browser `fetch`es the target API directly. If your API allows cross-origin requests (returns a suitable `Access-Control-Allow-Origin`), the request completes here.
  </Step>
  <Step title="Fall back to the proxy on CORS failure">
    Sites hosted on the ButterIX platform hand the request to the same-origin `/_biti/proxy`, which forwards it from the server and returns the response to the panel.
  </Step>
</Steps>

## Proxy security rules

`/_biti/proxy` exists only for "Try it" and has the following restrictions so it can't be used as an open proxy:

| Rule | Description |
|---|---|
| Host allowlist | Only forwards to `servers` origins declared in the site's OpenAPI spec (including operation-level and path-level `servers`); other addresses return 403 |
| No private networks | Requests are rejected when the target host resolves to a private, loopback, link-local, or similar address, including in the `biti dev` preview |
| Sensitive headers stripped | `Cookie`, `Host`, `Origin`, `Referer`, `X-Forwarded-For`, and similar headers are not forwarded; `Set-Cookie` in responses is dropped |
| No redirect following | 3xx responses are returned as-is |
| Size and timeout | Response bodies up to 2 MB (the rest is truncated and marked `truncated`), 30-second timeout |
| Rate limit | 60 requests per minute per IP |

See [API try-it proxy](/api-reference/runtime/proxy) in the API reference for the request and response format.

<Warning>
  The proxy allowlist comes from the spec's `servers`. If your spec uses a placeholder like `https://api.example.com` for `servers`, readers' requests will be sent there. Use your real address, or use server variables to let readers choose an environment.
</Warning>

## Configure CORS for your API

To let readers call your API directly from the browser without the proxy, allow the docs site's origin on your API gateway, for example:

```http title="Preflight response"
Access-Control-Allow-Origin: https://docs.acme.com
Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Max-Age: 86400
```

## Multiple environments

Declare multiple `servers` in the spec and readers can switch between them at the endpoint URL; use server variables for configurable parts:

```yaml
servers:
  - url: https://api.acme.com/v1
    description: Production
  - url: https://sandbox.acme.com/v1
    description: Sandbox
  - url: "https://{region}.api.acme.com/v1"
    variables:
      region:
        default: cn-east
        enum: [cn-east, us-west]
```

Server variables are expanded with their `default` values in examples and in the proxy allowlist.
