# HTTP request

Sends a request to an external API and puts the response into variables: pass an order to a CRM, check a promo code, get the delivery status.

![HTTP request block settings](https://support.watbot.org/_media/en/02-mini-apps/_images/http.webp?v=1791781230)

## Settings

- **"URL"** and the method: GET, POST, PUT, PATCH, DELETE. You can insert variables into the URL: `{{ name }}`.
- **"Timeout, seconds"** — how long to wait for a response. 15 by default. A request from the server waits no longer than 30 seconds, even if the field says more.
- **"Where to run the request"**:
  - "On the server" — the URL and headers stay on the server, API keys in them are safe;
  - "On the client device" — the request goes from the person's browser or messenger. The service must allow such requests (CORS), and the person will be able to see the URL and headers — do not put secret keys there. The response is parsed into variables the same way as for a request from the server.
- **"Headers"** — up to 30.
- **"Request body"**: "None", JSON, "Form" or "Raw".
- **"Response"**: "Whole response into a variable", "Status code into a variable" and "Response parsing" — a path in the JSON, for example `data.user.name`, into a variable. Up to 50 parsing rules.

A request from the server has a "Request server": "Default", "Europe" or "SOCKS5 proxy" — your own proxy with a host, port, user and password. A proxy in an internal network will not work.

## Exits

- **"Success"** — the service replied with a 200–299 code.
- **"Error"** — another response code, the service did not reply in time, or the URL failed the check.

## Specifics

- Requests to local and internal addresses are forbidden — the service needs a public address.
- Failed requests get into the [error log](https://support.watbot.org/mini-apps/users#error-log).
- A status code written to a variable can be checked by the next ["Condition"](https://support.watbot.org/mini-apps/blocks/logic/condition) block.
