REST API
The optional self-hosted HTTP API.
Enterprise
Enable the API
AddNetlyDBAPI(port) starts a self-hosted HTTP API (default port 9020) in your process. It serves NetlyDB's
endpoints only, on its own port, behind NetlyDBOptions.Security.
builder.Services.AddNetlyDB(options =>
{
options.Security.ApiKeyHashes = [apiKeyHash]; // or ApiKeys, or JWT bearer (Enterprise)
});
builder.Services.AddNetlyDBAPI(port: 9020);
- Authentication is required by default, and startup fails if no API key or JWT configuration is present. See Authentication.
- The API binds to
localhost. Expose it beyond the machine only through a reverse proxy you secure. - HTTPS is off by default; enable it with
Security.EnableTlsand a certificate. - Swagger UI is off by default.
Endpoints
| Area | Routes |
|---|---|
| Collections | GET /Collections/names, GET /Collections/infos, GET /Collections/{name}/count, POST /Collections/file/{name}, collection delete |
| Documents | Read, insert, replace, patch and delete documents; top/{n} |
| Queries | Filter queries, select projections, and POST /Collections/{name}/explain |
| Indexes | Create, update and drop indexes |
| Operations | /Snapshots (save, load, last), /Cluster, /Database/events/history, /health probes |
A write that violates a collection's schema is answered with
400 and the field violations.