ESP32 HTTP Client Library¶
A lightweight, low-allocation, high-performance HTTP client library for ESP32 that binds response data directly into your variables — featuring native zero-heap streaming engines for REST APIs, SOAP 1.1 / 1.2 Web Services, and extensible HTTP communication.
What is it?¶
ESP32-HTTP-Client is a modern, modular HTTP client for the ESP32 designed to bridge web services and device memory efficiently. Instead of treating HTTP communication as raw string manipulation followed by heavy DOM document parsing, it streams and extracts response fields directly into your C++ variables on-the-fly.
Built on a shared high-efficiency transport core (TLS, connection reuse, authentication, timeouts, and retries), the client provides dedicated, fluent builders tailored for standard web communication patterns:
Consume modern RESTful endpoints with intuitive verb methods (get, post, put, patch, del), path/query parameters, and zero-allocation JSON extraction or bidirectional struct mapping:
Connect to enterprise SOAP web services with automated envelope generation, SOAPAction / Content-Type handling, streaming XML token parsing, and native SOAP Fault inspection:
A unified client instance manages persistent configuration across all requests — including TLS security, custom headers, authentication (Bearer, Basic, API Key, Cookies), network retries, and telemetry observability:
One unified client. Direct memory binding. Minimal RAM footprint.
Performance at a Glance¶
Benchmarked over 100 consecutive HTTP GET requests with JSON payloads on a real ESP32 device:
| Metric | Standard (HTTPClient + ArduinoJson) | ESP32-HTTP-Client |
|---|---|---|
| Heap allocation per request | ~58.2 KB | ~15 bytes |
| Average RAM footprint | 34.2% | 24.3% |
| Minimum free heap | 114.3 KB | 128.6 KB |
| Average execution time | ~750 ms | ~59 ms |
→ See the full performance analysis
Quick Install¶
Search for ESP32-HTTP-Client in the Arduino IDE Library Manager and click Install.
Download the latest release and place the folder inside your Arduino/libraries/ directory.
30-Second Quick Start¶
#include <WiFi.h>
#include "ESP32HTTPClient.h"
ESP32HTTPClient client("https://jsonplaceholder.typicode.com");
void setup() {
Serial.begin(115200);
WiFi.begin("YOUR_SSID", "YOUR_PASSWORD");
while (WiFi.status() != WL_CONNECTED) delay(100);
int userId = 0;
// API returns: { "userId": 1, "id": 1, "title": "...", "completed": false }
client.get("/todos/1").getBody("userId", &userId);
Serial.printf("User ID: %d\n", userId);
}
void loop() {}
#include <WiFi.h>
#include "ESP32HTTPClient.h"
ESP32HTTPClient client("https://www.dataaccess.com");
void setup() {
Serial.begin(115200);
WiFi.begin("YOUR_SSID", "YOUR_PASSWORD");
while (WiFi.status() != WL_CONNECTED) delay(100);
char result[64] = {0};
// Sends SOAP 1.1 request and extracts <m:NumberToWordsResult> tag directly
client.soap("/webservicesserver/NumberConversion.wso")
.soapAction("http://www.dataaccess.com/webservicesserver/NumberToWords")
.body("<NumberToWords xmlns=\"http://www.dataaccess.com/webservicesserver/\">"
"<ubiNum>500</ubiNum>"
"</NumberToWords>")
.getBody("NumberToWordsResult", result, sizeof(result));
Serial.printf("Result: %s\n", result);
}
void loop() {}
If this library saved you time, consider leaving a ⭐ on GitHub.