# Use API as Proxy

When working with an existing API it can be useful to pass some requests through to it for testing, while serving mock responses for others.

For instance, if an API is not yet fully implemented then testing progress can still be made for the calling application by mocking the parts not yet completed.

Additionally, proxying all but a selection of APIs enables testing of edge and failure cases that would be hard to replicate predictably in the target API.

### How to configure proxy settings

![](/files/-LronXuSq-ARQwByE1WM)

You can configure proxy settings for each of your mock API. All you have to do is click the **Configure proxy server** icon and provide the the proxy url you want to forward your mock API request.

![](/files/-LromOXTd_AX9rgtJxj5)

Once you are done with configuring your proxy settings, you can now enable **Use API as Proxy** settings to start proxing your call to the provided url.

![](/files/-LrooYjwRYK-31znduZM)

Once a mock API is configured and enabled to serve a proxy response, all of the normal request matching rules apply, but instead of returning a saved response, the request is forwarded to the target url.

The endpoint of a request’s URL will be replaced by the proxy url i.e. `if` a request made to `https://api.mocklets.com/mock12675/pets` would result in a proxy request to `https://your.server.com/pets`.

Whenever a request is proxied, Mocklets adds 2 headers to the response with the details about the proxied request.

```
x-mocklets-proxy-url: https://your.server.com/pets
x-mocklets-type: proxy
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mocklets.com/managing-mock-apis/use-api-as-proxy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
