# HTTP API

In this article, we'll explore how you can [specify URLs in your HTTP Request](#using-the-http-api-data-source) without actually having to connect the data source or [connect your own](#configuring-your-own-http-api-data-source) HTTP API data source. We will also review the data source's [usage](#usage).&#x20;

## Using the HTTP API data source

Without connecting your own HTTP API, you can still run your requests with UI Bakery.\
In this case, you simply need to create a new action, select the *HTTP API* data source, and the *HTTP Request* action will be selected automatically. After that, just specify the *URL* of your request directly in the action. \
This is the main required parameter for the [HTTP Request](https://docs.uibakery.io/reference/working-with-actions/http-request) action type.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FoHwqJf4e4iT5WUnZnUFv%2FCleanShot%202025-04-30%20at%2017.11.31%402x-min.png?alt=media&#x26;token=0f288ad6-7c28-42c4-8404-3d89a3594a97" alt=""><figcaption></figcaption></figure>

You can also specify additional parameters which may be required depending on the API:

* **Method** - the HTTP Request method (GET, POST, PUT, etc.)
* **Base URL** - When a data source is connected to the action, Base API URL can be provided not to specify the whole URL for each action. You can change it once on the data source level for all actions.
* **URL** - the URL or path of the API endpoint
* **Headers** - the HTTP Request headers (string key-value pairs)
* **Body** - For *POST/PUT/DELETE/PATCH* methods, you can specify the HTTP body as a JSON object or as plain text.
* **Query Params** - the URL params added to the Request URL
* **Transform result** toggle - You can pass a JS function to transform execution result or fix an error. The `{{data}}`, `{{error}}`, and `{{res}}` variables represents the result of the request.

{% hint style="warning" %}
If the HTTP data source server sets the cookies, these cookies will be passed for the subsequent requests to the server as well but will not be visible in `{{res}}`.\
You can locate them in the *network tab* of the Chrome dev tool for the request that was sent to execute the HTTP step.\
Please note that to make the cookies work, you have to [configure your HTTP API as a data source](#configuring-your-own-http-api-data-source) first.
{% endhint %}

For example, you can pass a JSON object in the *Body* of your request by adding a `Content-Type` header to it:

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2F4MdEMyP7UIDDIYDHJaO9%2FCleanShot%202025-04-16%20at%2016.09.12%402x-min.png?alt=media&#x26;token=2c46edf3-4357-4ab8-b8f6-a91b4c7b4433" alt=""><figcaption></figcaption></figure>

## Configuring your own HTTP API data source

### Prerequisites

If your API is hosted behind a Firewall, you need to add our [IP addresses](https://docs.uibakery.io/concepts/data-sources#whitelisting-ip-addresses) to the Firewall whitelist.

### Connecting the data source

If your HTTP Requests share similar settings such as Base URL or Auth headers or your API requires authentication, you can configure your own HTTP API as a data source. To do so, follow the instruction below:

1. On the **Data sources** page, click **Connect**, and select *HTTP API* in the Data sources list.
2. Specify the **Base URL** and any additional parameters if necessary.\
   To set up authentication, refer to [this guide](https://docs.uibakery.io/reference/data-sources/http/api-authentication).
3. Click **Connect Datasource** to save the configuration.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FMuH9kGkER7nifwrlmmWN%2FCleanShot%202025-04-17%20at%2011.51.00%402x-min.png?alt=media&#x26;token=0f276d2c-c9ed-41ad-9934-bd668628afc9" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
Please note that the settings defined on the data source level are sent from the back-end proxy and are not exposed to the front-end user.
{% endhint %}

## Usage

Once you've established the connection to the data source, you can start interacting with its data via API. For this purpose, you can use the [HTTP Request](https://docs.uibakery.io/reference/working-with-actions/http-request) action step and configure the HTTP parameters applicable to your API. \
UI Bakery supports all HTTP methods, Headers, Body, and Query Parameters.
