# HTTP Request

> The HTTP Request node sends a request to a web address, with its configuration, authentication, and response branching.

## What it does

Sends an HTTP request to a URL and makes the response available to the nodes after it.

## Authentication options

One HTTP Request node covers both ways of authenticating, which you choose in the **Authentication** field:

- **Manual authentication**: the method, URL, headers, body, and credentials are configured inline. It fits any external Representational State Transfer (REST) endpoint where the credentials are managed in the node, for example an API key header or a bearer token.
- **Connector based authentication**: the request goes through a connection, so the connection handles authentication and the credentials aren't configured in the node. It fits centralized credential management against a service that is connected through Integration Service.

## Configuration reference

| Field | Required | Default | Description |
|---|---|---|---|
| **Import or export** | No | None | A menu above the fields. **Import from cURL** parses a cURL command and fills in the method, URL, headers, and body automatically. |
| **Authentication** | Yes | **Manual authentication** | How the request is authenticated. **Manual authentication** passes the credentials in the request headers. **Connector based authentication** sends the request through a connection, as described below. |
| **Method** | Yes | `GET` | HTTP method for the request. Supported values are `GET`, `POST`, `PUT`, `PATCH`, and `DELETE`. |
| **URL** | Yes | None | Full URL to send the request to, including the `https://` scheme. In a **Fixed value** field, a value is inserted with double curly braces, for example `https://api.example.com/users/{{ $vars.userId }}`. |
| **Headers** | No | None | Key-value pairs sent as HTTP request headers. Header names and values support variable expressions. |
| **Query parameters** | No | None | Key-value pairs appended to the URL as a query string. Names and values support variable expressions. |
| **Content Type** | No | `application/json` | Multipurpose Internet Mail Extensions (MIME) type of the request body. Supported values are `application/json`, `application/xml`, `text/plain`, and `application/x-www-form-urlencoded`. |
| **Body** | No | Empty | Request body for `POST`, `PUT`, and `PATCH` requests. Enter the value directly in the code editor or use variable expressions. |
| **Branching** tab | No | Default output only | Response branches that route the workflow based on response properties. Each branch has a name and condition expression. |
| **Timeout** (**Advanced** tab) | No | `PT15M` | Maximum time to wait for a response, in International Organization for Standardization (ISO) 8601 duration format. |
| **Retry count** (**Advanced** tab) | No | `0` | Number of times to retry the request if it fails. Retries use the timeout value as the backoff interval. |

![The properties panel of an HTTP Request node with the Import or export menu open, listing Import from cURL, Import from OpenAPI definition, and Export as cURL.](https://dev-assets.cms.uipath.com/assets/images/maestro-automate/14a-http-request-import-export-52d2501f.webp)

### Connector based authentication

When **Authentication** is **Connector based authentication**, the panel shows these fields instead of the manual ones:

| Field | Required | Description |
|---|---|---|
| **Connector** | Yes | The connector to send the request through, for example Slack. |
| Connection (named after the connector, for example **Slack connection**) | Yes | The connection to use. |
| **Method** | Yes | The HTTP method for the request. |
| **Base URL** | No | The connector's base URL, shown as a placeholder such as `https://slack.com/api`. |
| **Path** | No | The endpoint path for the REST API request. |
| **Headers** | No | Key-value pairs, up to 20. The connector adds its own `Authorization`, `Accept`, and `Content-Type` headers automatically. |
| **Query parameters** | No | Key-value pairs, up to 20. |

The editor suggests common header names such as `Authorization`, `Content-Type`, `Accept`, `X-Api-Key`, and others. For query parameters, adding a parameter with name `page` and value `2` sends the request to `https://api.example.com/items?page=2`.

The node evaluates branch conditions in order and follows the first match. If no branch matches, the workflow follows the **Default** output.

Branch condition expressions use the same JavaScript syntax as Decision and Switch nodes:

```
$vars.httpRequest1.output.code === 200
```

```
$vars.httpRequest1.output.code >= 400
```

Each branch appears as a separate output handle on the right side of the node on the canvas, alongside the **Default** handle.

![An HTTP Request node on the canvas with three output handles: Success, Not found, and Default.](https://dev-assets.cms.uipath.com/assets/images/maestro-automate/14b-http-request-automate-76451bd4.webp)

Common timeout values:

- `PT30S`: 30 seconds.
- `PT5M`: 5 minutes.
- `PT15M`: 15 minutes.
- `PT1H`: 1 hour.

## Credentials

You can authenticate requests in two ways.

### Manual authentication

Pass credentials directly in request headers. For API key authentication, add a header with name `X-Api-Key` and value set to your key. For bearer token authentication, add an `Authorization` header with a value like `Bearer <your-token>`.

Store sensitive values such as tokens and API keys in secret variables rather than hardcoding them.

### Connector based authentication

Select a connection in the properties panel. The connection injects credentials into the request automatically, so you don't need to manage headers yourself.

A connection fits centralized credential management, automatic token refresh, and cases where several workflows share the same API credentials.

:::note
[Create a connection](create-a-connection.md) describes how to create one.
:::

## Examples

### Example 1: Basic GET request

Fetch a single resource from a public API.

The node is configured with **Method** set to `GET` and **URL** set to `https://jsonplaceholder.typicode.com/posts/1`. All other fields remain at their defaults.

The response is available in a downstream Script node:

```javascript
const body = $vars.httpRequest1.output.body;
const status = $vars.httpRequest1.output.code;

return {
  title: body.title,
  userId: body.userId,
  status: status
};
```

The response object is available at `$vars.httpRequest1.output` and contains three fields:

- `$vars.httpRequest1.output.body`: the parsed response body.
- `$vars.httpRequest1.output.code`: the HTTP status code, for example `200`.
- `$vars.httpRequest1.output.headers`: an object containing the response headers.

### Example 2: POST request with a JSON body

Create a new resource by sending a JSON payload.

The node is configured with **Method** set to `POST`, **URL** set to `https://api.example.com/orders`, an `Authorization` header with the value `Bearer {{ $vars.apiToken }}`, and **Content Type** left as `application/json`. The body:

```json
{
  "product": "Widget",
  "quantity": 5,
  "customer_id": "cust_12345"
}
```

The created resource's ID is available in a downstream node:

```javascript
const orderId = $vars.httpRequest1.output.body.id;
return { orderId: orderId };
```

If the request fails and you've connected an error handle, the error details are available at `$vars.httpRequest1.error`:

```javascript
// In a Script node connected to the error handle
const errorMessage = $vars.httpRequest1.error.message;
const errorStatus = $vars.httpRequest1.error.status;

return {
  failed: true,
  reason: errorMessage,
  httpStatus: errorStatus
};
```

The error object contains:

- `code`
- `message`
- `detail`
- `category`
- `status`

### Example 3: Route responses with branches

Response branches let the workflow follow different paths based on the API's response without a separate Decision node.

The node is configured with **Method** set to `GET`, **URL** set to `https://api.example.com/users/{{ $vars.userId }}`, and two branches on the **Branching** tab: `Success` with condition `$vars.httpRequest1.output.code === 200` and `Not Found` with condition `$vars.httpRequest1.output.code === 404`.

![The Branching tab of an HTTP Request node, with a Success branch on code === 200, a Not found branch on code === 404, and the Default branch.](https://dev-assets.cms.uipath.com/assets/images/maestro-automate/14b-branching-conditions-automate-001ffa26.webp)

The node now has three output handles on the canvas:

- Success: connects to the nodes that process the user data.
- Not Found: connects to the nodes that handle the missing user.
- Default: connects to a fallback path for any other status code.

Each downstream path receives the full response. For example, on the Success branch:

```javascript
const user = $vars.httpRequest1.output.body;
return { name: user.name, email: user.email };
```

## Choosing between HTTP Request and an integration node

Use the HTTP Request node as a general-purpose tool for calling any API. Use a dedicated integration node when one exists for the service you're calling.

| Use HTTP Request when... | Use an integration node when... |
|---|---|
| The API has no dedicated connector in the **Add node** panel | A connector exists for the service, such as [Slack](connector-slack.md), [Salesforce](connector-salesforce.md), or [HubSpot CRM](connector-hubspot-crm.md) |
| You need full control over headers, query parameters, and body format | You want pre-built typed inputs and outputs with no manual configuration |
| You're prototyping against a new API or internal service | You want a connection to handle sign-in and token refresh for you |
| The API uses a non-standard authentication scheme | You want a maintainable workflow that won't break if the API changes its contract |

As a rule, searching the **Add node** panel for a connector first is the better order, with HTTP Request as the fallback when nothing exists for the target service.

## Next steps
- [Script node](node-script.md): transforming and processing HTTP response data.
- [Decision node](node-decision.md): branching on conditions, as an alternative to response branches.
- [Variables and data flow](variables-and-data-flow.md): `$vars`, expression syntax, and variable scoping.
- [Community](community.md): ask questions and share workflows with other builders on the UiPath Forum.
