> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/net/http.md).

# HTTP

Returns a fluent HTTP client for making HTTP requests.

This BIF creates a new or retrieves an existing BoxHttpClient instance based on the provided connection parameters. The client can be used to fluently build and execute HTTP requests with support for various HTTP versions, redirects, timeouts, proxy configuration, and client certificates.

Example usage:

```
 // Simple GET request
 http( "https://api.example.com/data" )
     .invoke()
     .ifSuccess( result -> {
 		// Handle successful response
 	} )
     .ifError( error -> {
 		// Handle error response
 	} )

 // Invoke and get the result immediately, throwing an exception on error
 result = http( "https://api.example.com/data" )
 	.invokeAndGet().
 
```

## Method Signature

```
HTTP(URL=[string], connectionTimeout=[numeric], redirect=[boolean], httpVersion=[string], proxyServer=[string], proxyPort=[integer], proxyUser=[string], proxyPassword=[string], clientCert=[string], clientCertPassword=[string])
```

### Arguments

| Argument             | Type      | Required | Description                                                                                  | Default  |
| -------------------- | --------- | -------- | -------------------------------------------------------------------------------------------- | -------- |
| `URL`                | `string`  | `true`   |                                                                                              |          |
| `connectionTimeout`  | `numeric` | `false`  | The connection timeout in milliseconds (default: BoxHttpClient.DEFAULT\_CONNECTION\_TIMEOUT) | `15`     |
| `redirect`           | `boolean` | `false`  | Whether to automatically follow HTTP redirects (default: true)                               | `true`   |
| `httpVersion`        | `string`  | `false`  | The HTTP version to use (default: HTTP/2)                                                    | `HTTP/2` |
| `proxyServer`        | `string`  | `false`  | The proxy server address (requires proxyPort)                                                |          |
| `proxyPort`          | `integer` | `false`  | The proxy server port (requires proxyServer)                                                 |          |
| `proxyUser`          | `string`  | `false`  | The proxy authentication username (requires proxyPassword)                                   |          |
| `proxyPassword`      | `string`  | `false`  | The proxy authentication password (requires proxyUser)                                       |          |
| `clientCert`         | `string`  | `false`  | The path to the client certificate file                                                      |          |
| `clientCertPassword` | `string`  | `false`  | The password for the client certificate                                                      |          |

## Examples

## Related

* [SOAP](/boxlang-language/reference/built-in-functions/net/soap.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/net/http.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
