DuckDB HTTP API Server Extension
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 |
|---|---|---|---|---|---|
| Linux AMD64 | |||||
| Linux ARM64 | |||||
| macOS AMD64 | |||||
| macOS ARM64 | |||||
| Windows AMD64 | |||||
| Windows ARM64 | |||||
| WebAssembly |
Installing and Loading
INSTALL httpserver FROM community;
LOAD httpserver;
Example
-- Start a DuckDB HTTP API Server with parameters
D SELECT httpserve_start('0.0.0.0', 9999, 'user:pass');
┌───────────────────────────────────────────────┐
│ httpserve_start('0.0.0.0', 9999, 'user:pass') │
│ varchar │
├───────────────────────────────────────────────┤
│ HTTP server started on 0.0.0.0:9999 │
└───────────────────────────────────────────────┘
-- Browse to your DuckDB HTTP API endpoint to Query using the embedded interface
-- Query your DuckDB HTTP API Server using curl or any other client w/ HTTP Basic Auth
curl -X POST -d "LOAD chsql; SELECT *, uuid() FROM numbers(10)" "http://user:pass@localhost:9999/"
-- Query your DuckDB HTTP API Server using curl or any other client w/ X-API-Key header
curl -X POST --header "X-API-Key: secretkey" -d "LOAD chsql; SELECT *, uuid() FROM numbers(10)" "http://localhost:9999/"
-- Query your DuckDB HTTP API Server using DuckDB HTTPFS extension w/ Header Authentication
D CREATE SECRET extra_http_headers (
TYPE HTTP,
EXTRA_HTTP_HEADERS MAP{
'X-API-Key': 'secretkey'
}
);
-- DuckDB API Server settings
* If you want no authentication, just pass an empty string as parameter.
* If you want the API run in foreground set `DUCKDB_HTTPSERVER_FOREGROUND=1`
* If you want logs set `DUCKDB_HTTPSERVER_DEBUG=1` or `DUCKDB_HTTPSERVER_SYSLOG=1`

About httpserver
For more information regarding usage, see the documentation.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| httpserve_start | scalar | NULL | NULL | |
| httpserve_stop | scalar | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
This extension does not add any settings.