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

# Create Request & Response Examples

> Save, manage, and reuse examples in Requestly. Create snapshots of your API requests with different configurations for quick reuse.

Examples are a pairing of a request and its corresponding response. Each example captures the complete state of an API call, including the request details (method, URL, parameters, headers, and body) and the response details (status code, body, and headers).

You can attach multiple examples to a single request, all organized under that parent request in the sidebar. This makes it easy to navigate between different scenarios without duplicating or modifying the original request.

Having multiple examples for one request helps you represent how an API behaves in different situations. For instance, you can save examples for successful responses, error states like 400 or 404, or cases where the response data changes.

## Why Use Examples

* **Test multiple scenarios**\
  Save different configurations like valid inputs, edge cases, and error states, and switch between them instantly.
* **Collaborate with your team**\
  Examples are shared within your project so others can view and use the exact configurations.
* **Retain request and response data**\
  Each example stores both the request and its response, making it easy to revisit past executions.

## Save a request & responses as an example

You can create an example from any HTTP or GraphQL request that has been sent at least once.

Examples are not limited to those two protocols. Right-click a [gRPC](https://docs.requestly.com/api-client/send-api-request/grpc-request.md), [WebSocket](https://docs.requestly.com/api-client/send-api-request/websocket-request.md), [Socket.IO](https://docs.requestly.com/api-client/send-api-request/socketio-request.md) or [MQTT](https://docs.requestly.com/api-client/send-api-request/mqtt-request.md) request in the sidebar and choose **Add Example** to snapshot its configuration.

The steps below use the **Save** dropdown, which HTTP, GraphQL, gRPC and MQTT requests have. WebSocket and Socket.IO requests have no such dropdown item, so the sidebar **Add Example** is the only route for those two.

> [!NOTE]
>
> WebSocket, Socket.IO and MQTT hold an open connection rather than returning a single response, so their examples capture the request side only.

**1. Open a request**

Navigate to an existing API request in your project or send a new request.

**2. Save as example**

Click the **Save** dropdown in the request view and select **Save as example**. \
This stores the current configuration including URL, method, headers, parameters, and body.

![Save Examplesinrequestly](https://mintcdn.com/requestly/JKGigZziFcip1RUm/images/SaveExamplesinrequestly.png?fit=max\&auto=format\&n=JKGigZziFcip1RUm\&q=85\&s=4fa59a78a2576858fe354388673c0e0d)

**3. View the example**

The example opens in a new tab. The parent request in the sidebar expands to show the newly created example beneath it.

![View Examples](https://mintcdn.com/requestly/JKGigZziFcip1RUm/images/ViewExamples.png?fit=max\&auto=format\&n=JKGigZziFcip1RUm\&q=85\&s=f9c14056ed28f2d1539e782559257aac)

> [!TIP]
>
> You can also save examples from the request's context menu in the sidebar by right-clicking the request and selecting the save option.

## Manage examples in the sidebar

Examples appear as collapsible children under their parent request in the sidebar. Click the expand arrow next to any request to reveal its examples.

### Open an example

Click on an example in the sidebar to open it in a new tab. The example loads with the saved request configuration and response data.

![Openanexample(1)](https://mintcdn.com/requestly/ngLDafOW0LQ7Vo0B/images/Openanexample\(1\).png?fit=max\&auto=format\&n=ngLDafOW0LQ7Vo0B\&q=85\&s=4c7978793af1a8864067386d9bceb178)

### Rename an example

Right-click the example in the sidebar and select **Rename**, or double-click the example name. Type the new name and press **Enter** to save.

![Renameanexample](https://mintcdn.com/requestly/JKGigZziFcip1RUm/images/Renameanexample.png?fit=max\&auto=format\&n=JKGigZziFcip1RUm\&q=85\&s=b587a2b55acc1ec82a964fe42469293e)

### Duplicate an example

Right-click the example in the sidebar and select **Duplicate**. A copy of the example is created under the same parent request.

![Duplicateanexample](https://mintcdn.com/requestly/JKGigZziFcip1RUm/images/Duplicateanexample.png?fit=max\&auto=format\&n=JKGigZziFcip1RUm\&q=85\&s=b33c88f0200617358b102efe7ba284b8)

### Delete an example

Right-click the example in the sidebar and select **Delete**. Confirm the action in the prompt that appears.

![Deleteanexample](https://mintcdn.com/requestly/JKGigZziFcip1RUm/images/Deleteanexample.png?fit=max\&auto=format\&n=JKGigZziFcip1RUm\&q=85\&s=0d5c801aff5c307d542ca8ee91575028)

> [!WARNING]
>
> Deleting an example is permanent and cannot be undone.

## Use an example as a template

When viewing a saved example, click **Try it** in the URL bar to open a new draft request pre-filled with the example's configuration (URL, method, headers, parameters, and body). This lets you start a new request based on an existing example without modifying the original. The example's saved response is not carried into the draft.

![Useanexampleasatemplate](https://mintcdn.com/requestly/JKGigZziFcip1RUm/images/Useanexampleasatemplate.png?fit=max\&auto=format\&n=JKGigZziFcip1RUm\&q=85\&s=e84ae3de8a9b7857d9b3feb4e4b7bf67)

## What's next?

> [card] [API Collections](https://docs.requestly.com/api-client/api-collections.md)
>
> Organize your requests into collections and folders

> [card] [Variables](https://docs.requestly.com/api-client/environments-and-variables.md)
>
> Use variables to make requests reusable across environments

> [card] [Scripts & Tests](https://docs.requestly.com/api-client/scripts.md)
>
> Add pre-request scripts and tests to automate your workflow


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.