> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# request

> Send a HTTP request to a remote URL.

Send a GET, POST, PUT, or DELETE request to a remote URL.

## **Properties**

An object containing the following properties.

URL to send the HTTPS request to. Authentication can also be set in the url in the format of `username:password@url`.

Request type. `GET`|`POST`|`PUT`|`DELETE`

Object containing HTTP headers to set. Valid header values are `Accept`, `Authorization`, `Content-Type`, `Range`, and custom `X-` headers

Request body. `Content-Type` header should be explicitly set, but if not set, the most likely type will be set based on the first non-whitespace character.

Maximum time in seconds to wait for a connection. Default is `0` (no timeout).

Maximum time in seconds to wait for a response. Default is `0` (no timeout).

Store parsed JSON response as variables

## **Variables**

Set by the method:

* **request\_url:** (out) URL the request was sent to.
* **request\_result:** (out) `success` | `failed`.
* **return\_value:** (out) The same value as the `request_result`.
* **request\_response\_code:** (out) HTTP response code from the request.
* **request\_response\_headers.`<header name lowercase>`:** (out) HTTP response headers. Header names should be normalized to lowercase and trimmed of whitespace. A maximum of 64 headers are saved. Ex: `${request_response_headers.content-type}`.
* **request\_response\_body:** (out) Raw HTTP response body. This is limited to 64KB.
* **request\_response.`<object_field>`:** (out) Variables saved from the response if `save_variables` is true and parsed as JSON.

For example, if the server responds with the following JSON:

```JSON
  { "status": "created", "time": "2 seconds ago", "number": { "home": "n/a" } }
```

The variables `request_response.status`, `request_response.time`, and `request_response.number.home` are set.

## **Examples**

### Making a GET Request

```yaml
version: 1.0.0
sections:
  main:
    - answer: {}
    - request:
        url: 'https://jsonplaceholder.typicode.com/todos/1'
        method: GET
        save_variables: true
        timeout: 10
    - play:
        url: 'say: the title is: ${request_response.title}'
```

```json
{
  "version": "1.0.0",
  "sections": {
    "main": [
      {
        "answer": {}
      },
      {
        "request": {
          "url": "https://jsonplaceholder.typicode.com/todos/1",
          "method": "GET",
          "save_variables": true,
          "timeout": 10
        }
      },
      {
        "play": {
          "url": "say: the title is: ${request_response.title}"
        }
      }
    ]
  }
}
```