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

# API Proxies

> Learn how to setup an API Proxy in Refold

**API Proxies** allows your organization to integrate services better with the workflows in Refold by configuring your API Endpoints. These API endpoints will receive the response from a workflow in Refold.

## Creating an API Proxy

To create an API Proxy in Refold, the user needs to provide specific information detailing the desired behavior of the action. This includes the following steps:

### 1. Create Action

* Click on the `New Action` button and provide a `Name` and `Description` for the API Proxy.
* Click on the `Create Action` button.
* The API Proxy is created and the next step will be to configure it according to your needs.

<img height="200" src="https://mintcdn.com/cobalt-55/C3P12YsraPVmMY5N/images/Developer/create_proxy.png?fit=max&auto=format&n=C3P12YsraPVmMY5N&q=85&s=2dddc6601aa690a9a7e83bf36088c0b2" alt="Create an API Proxy in Refold" data-path="images/Developer/create_proxy.png" />

### 2. Configuring the API Proxy

While configuring an API Proxy, there are 3 options that can be used to configure and make changes.

The `Basic Information` option can be used to update the name or the description of the API proxy.

`Fields` tab allows you to add and update fields for your Custom Action. These fields can be utilized to pass information between different steps within the workflow.

And the `API Call` tab is used to define the API call to be executed upon triggering the action, Specify the endpoint, HTTP method, and any required request parameters.

#### 2.1 Adding a Field

* To add a new Field, click on the `+` icon in **Fields**.
* Provide information about the Field like `Type` of the field, `Label`, `Placeholder`, `Description` and whether the Field is Mandatory or not and click on `Add Field`.
  <img height="200" src="https://mintcdn.com/cobalt-55/C3P12YsraPVmMY5N/images/Developer/field_proxy.png?fit=max&auto=format&n=C3P12YsraPVmMY5N&q=85&s=493be9313b043d2873dc77c05463aad1" alt="Create an API Proxy Field" data-path="images/Developer/field_proxy.png" />

#### 2.2 API Call Configuration

* Click and open the `API Call` section of API Proxy.
* Provide the API Request which needs to be executed in this Custom Action by providing the endpoint and selecting the Request Method.

<Tip>
  API Request or endpoint can also have variables in it which can be added to the URL by using curly brackets.
</Tip>

* Also provide other details for the API like **Path** or **Query Params**, **Headers** and any **pre-request scripts** and click on `Save API Call`.
* You can add variables or the fields created by you in API Proxy in the **Body** by clicking on the `(x)` icon.

<Tip>
  Refold offers a few additional settings during API Call setup to configure how you want the response. Learn about [here](/build/basics/proxies#settings-to-configure-response).
</Tip>

<img height="200" src="https://mintcdn.com/cobalt-55/qu02QklkWCst59D2/images/Developer/call_proxy.png?fit=max&auto=format&n=qu02QklkWCst59D2&q=85&s=7f35a63d5d6218d93713f835280e33b9" alt="Create an API Call for Custom Action" data-path="images/Developer/call_proxy.png" />

### Settings to Configure Response

In the `API Call` section of your API Proxy setup, Refold offers options to change how you want to handle the response. Following are the settings available to you:

<Accordion title="Response Format">
  Refold offers two options for the format : **Default** and **Stream**.

  **Default** is how an API generally gives response and is available by default in all API Proxies.

  **Stream** format is used when you want to stream responses in chunks from the API.
</Accordion>

<Accordion title="Save Response to Bucket">
  By turning the Toggle On, instead of saving response, you can store the response of API in a S3 Bucket provided by Refold.

  This is generally used when you want to retrieve like PDFs or in a non-JSON format.
</Accordion>

<Accordion title="Use Public URL">
  <Warning>
    For `Use Public URL` to work **Save Response to Bucket** toggle should be On, else it is ignored.
  </Warning>

  Generally the S3 URL generated using `Save Response to Bucket` will be a private bucket and can only be accessed by the same AWS org. Also, this URL can be used in Refold nodes as well like PDF Node.

  But if you want to share the bucket to public, turn on `Use Public URL` toggle and you can share it easily.
</Accordion>

<Accordion title="Pagination">
  If the API supports pagination, then you can add it to your API Proxy. Go to the **API Call** section and enable the `Pagination` toggle.

  In the `Type` field, select the pagination type and provide the required fields and click on `Save API Call`.

  <img height="200" src="https://mintcdn.com/cobalt-55/C3P12YsraPVmMY5N/images/Developer/proxy_pagination.png?fit=max&auto=format&n=C3P12YsraPVmMY5N&q=85&s=ffd351914f555f1a830b58901e768534" alt="Pagination in the API Proxy" data-path="images/Developer/proxy_pagination.png" />
</Accordion>

## Utilizing the API Proxy in Workflows

Once created, API Proxies can be used in workflows within Refold by using your Custom App present within **Native Apps**. This means that one Custom Action can be executed in several workflows. Users can define trigger conditions that initiate the execution of these actions, enabling automated responses to specific events and facilitating end-to-end process automation.

<img height="200" src="https://mintcdn.com/cobalt-55/C3P12YsraPVmMY5N/images/Developer/proxy_workflow.png?fit=max&auto=format&n=C3P12YsraPVmMY5N&q=85&s=c81a889b4b744b548cfdb1ea0d27e4d4" alt="Executing Action in a Workflow" data-path="images/Developer/proxy_workflow.png" />
