Skip to content

DuckDB Extension

HTTP Client

Make HTTP requests from DuckDB SQL and read the response as JSON. Use it to fetch a small API response or enrich a small set of rows.

277,182
extension loads Β· last 90 days
On this page

Bring a small API response into a SQL query

HTTP Client adds functions for making HTTP requests from DuckDB. A call returns the response status, headers, and body, which you can inspect and parse with SQL before storing or joining the result.

Use it to look up API metadata, inspect an endpoint, or enrich a small set of records. Calls wait for the response and buffer it in memory. Check the status before reading the body, and save responses to a table when later queries should reuse the same data.

Example

Fetch a repository from the GitHub API

This request needs no API key. It returns the HTTP status and repository name; the response body is parsed as JSON before extracting the name.

Tested with DuckDB 1.5.6. Run this example in the DuckDB CLI or a native client.

SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
  WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL http_client FROM query_farm;
LOAD http_client FROM query_farm;

WITH response AS MATERIALIZED (
  SELECT http_get(
    'https://api.github.com/repos/duckdb/duckdb'
  ) AS res
)
SELECT
  (res->>'status')::INTEGER AS status,
  ((res->>'body')::JSON)->>'full_name' AS repository
FROM response;

Expected result

status repository
200 duckdb/duckdb

The result above assumes a successful request. Check the HTTP status before using the body: GitHub can return an error or rate-limit the request. Calls are synchronous and the response is buffered in memory.

Common tasks

Deep Dive

Technical Details

Reference

Extension Contents

Quick reference to all available functions and settings organized by category.

Configuration
http_client_max_redirects Object type: Setting How many redirects the http_client functions follow (0 returns the 3xx response)
http_client_max_response_size Object type: Setting Largest HTTP response body, in bytes, that the http_client functions will accept
Requests
http_delete() Object type: Scalar function New in the DuckDB 2.0 build. Issue an HTTP DELETE request (without a body).
http_get() Object type: Scalar function Issue an HTTP GET against url and return the response as JSON.
http_head() Object type: Scalar function Issue an HTTP HEAD request.
http_post() Object type: Scalar function Issue an HTTP POST with a JSON request body.
http_post_form() Object type: Scalar function Issue an HTTP POST with the params map encoded as application/x-www-form-urlencoded β€” the body shape used by HTML forms, many older REST APIs, and OAuth 2.0 token endpoints.
http_put() Object type: Scalar function New in the DuckDB 2.0 build. Issue an HTTP PUT with a JSON request body β€” for REST APIs that create or replace a resource at a known URL.

API Reference

Function Reference

Configuration

Settings

Configure the http client extension behavior using these settings.

http_client_max_redirects

Default Value: 10

http_client_max_response_size

Default Value: 104857600

Practical Examples

Cookbook

Real-world recipes and patterns for common use cases.

Platform Support

Compatibility

Extension availability may vary by platform and DuckDB version. Check below to ensure this extension supports your environment before installation.

Quick Facts

Release status Experimental
Software License MIT
Pricing Free
Written In C++
Source Available Yes
View on GitHub
Usage
277,182
loads Β· last 90 days

Platforms

DuckDB 2.0.0

  • Linux x86_64aarch64
  • Linux (musl) Not available
  • macOS Apple Silicon
  • Windows x86_64
  • WASM Not available
Compiled binary sizes
Platform Architecture Size
Linux x86_64 6.88 MB
Linux aarch64 6.51 MB
macOS Apple Silicon 5.24 MB
Windows x86_64 12.18 MB

Compressed download sizes for the release shown above.

DuckDB & Haybarn

Release calendar
  • DuckDB v2.0.0 Query.Farm repository Supported
  • Haybarn v1.5.6 Built-in community repository Supported

Browser examples use Haybarn-Wasm 2.0.0-rc12.

Checked .