Skip to content

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.

Arduino Library PlatformIO Registry Language Coverage License Stars Downloads


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:

int userId;
float temperature;
char city[32];

client.get("/report")
      .query("format", "compact")
      .getBody("userId", &userId)
      .getBody("sensor.temp", &temperature)
      .getBody("0.address.city", city, sizeof(city));

Connect to enterprise SOAP web services with automated envelope generation, SOAPAction / Content-Type handling, streaming XML token parsing, and native SOAP Fault inspection:

float price = 0.0f;
SoapFault fault;

client.soap("/ws")
      .soapAction("http://example.org/GetPrice")
      .body("<m:GetPrice xmlns:m=\"http://example.org\"><m:Item>ESP32</m:Item></m:GetPrice>")
      .getFault(&fault)
      .getBody("Price", &price);

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:

ESP32HTTPClient client("https://api.example.com");
client.bearer("token_xyz");
client.setTimeout(5000);
client.setMaxRetry(2);

// Reuse client seamlessly for REST or SOAP endpoints
client.get("/api/v1/health");
client.soap("/ws/service");

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.

Add ESP32-HTTP-Client to your platformio.ini:

lib_deps =
    PedroFnseca/ESP32-HTTP-Client@^1.4.0

Download the latest release and place the folder inside your Arduino/libraries/ directory.

Full installation guide


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() {}

See all examples


If this library saved you time, consider leaving a ⭐ on GitHub.