Documentation
Build on DBlob.
One HTTP API for your data, users, permissions, files and live updates. Everything speaks JSON, and every filter is BQL.
Quick start
DBlob is a single binary. Run it, open the admin, and create your first superuser.
# Download links for each platform arrive with the public release.
$ dblob serve
# API: http://127.0.0.1:8090/api/
# Admin: http://127.0.0.1:8090/_/- Data lives in
./dblob_data: your app database plus DBlob's private project store and auth vault. - The first visit to
/_/asks you to create a superuser. If the server is reachable beyond localhost, setup also asks for a one-time token printed in the server log. - Self-hosting on SQLite is free. Set
DBLOB_LICENSE_KEYto unlock Pro features; see pricing.
Moving an existing project? Follow the PocketBase migration guide or compare the two backends.
Conventions Available
- All request and response bodies are JSON. Apps authenticate with bearer tokens; the admin uses cookie sessions.
- Timestamps are UTC strings that sort as text:
"2026-10-29 14:00:00.000Z". Inputs also accept2026-10-29and ISOT…Z. - Record ids are 15 characters,
[a-z0-9]. - No hidden caps: leave out
limitand you get every row. Limits are the operator's choice.
Errors share one shape. data is keyed by field name, by schema path, by filter (with a character span pointing into your BQL), or by batch request index.
{ "status": 400, "message": "invalid record: title: cannot be blank",
"data": { "title": { "code": "invalid", "message": "cannot be blank" } } }Collections Available
A collection is a table with typed fields. Field types include text, editor, number, bool, email, url, date, autodate, select, file, relation, json, password and geoPoint. Every collection gets id, created and updated, and fields keep their id when you rename them.
| Method | Path | What it does |
|---|---|---|
| GET | /api/collections | List collections |
| POST | /api/collections | Create; add ?dryRun=1 to preview |
| GET | /api/collections/{name} | Read one |
| PATCH | /api/collections/{name} | Replace the definition; ?dryRun=1 to preview |
| DELETE | /api/collections/{name} | Delete |
Preview before you migrate. With dryRun=1 the response contains a plan: the SQL statements, a human-readable summary and a destructive flag. Show the summary, confirm anything destructive, then send the same request without dryRun.
POST /api/collections?dryRun=1
{ "name": "posts", "type": "base",
"fields": [ { "name": "title", "type": "text", "required": true },
{ "name": "status", "type": "select", "values": ["draft", "published"] } ] }Records Available
| Method | Path | Notes |
|---|---|---|
| GET | /api/collections/{c}/records | filter, order, limit, offset, total=1, p.name parameters |
| POST | /api/collections/{c}/records | Create a record |
| GET | /api/collections/{c}/records/{id} | Read one |
| PATCH | /api/collections/{c}/records/{id} | Update only the given fields |
| DELETE | /api/collections/{c}/records/{id} | Delete |
| POST | /api/batch | Several writes, all or nothing |
Lists return { items, total, limit, offset }. Sort with order=-views,title (a leading - means descending). Bind values with p.status=published and refer to them as :status in the filter, so user input is never spliced into query text.
GET /api/collections/posts/records?filter=status = :status&p.status=published&order=-created&limit=20
POST /api/batch
{ "requests": [
{ "method": "PATCH", "url": "/api/collections/posts/records/k3j9x2m4qa7b1cd", "body": { "status": "published" } },
{ "method": "DELETE", "url": "/api/collections/posts/records/p0q8w7e6r5t4y3u" } ] }Nested selection Coming next
Ask for exactly the shape you want. Relations are replaced by the related records, computed in one SQL statement: select=title,status,author{id,name},tags{id,name}. Use * for all fields and author{*} for all fields of a relation.
Filters (BQL) Available
BQL is DBlob's query language. It reads like SQL, is type-checked against your schema, and means the same thing on every database. Quote strings with single quotes ('' escapes one) and odd field names with backticks.
status = 'published'
title CONTAINS 'rust' IGNORE CASE
views >= 10 AND published_at > @now - 7d
'web' IN platforms
ANY(tags, name = 'news')
author.email = 'ana@example.com'
COUNT(comments VIA post) > 3
slug IS EMPTY
meta IS NULL- Multi-value fields must be quantified with
ANY,ALLorNONE. Ambiguous filters are compile errors that suggest a fix. =and!=are null-safe.IS NULLandIS EMPTYare different questions.- Follow relations with dots, and back-relations with
VIA. - Filters may only use fields the caller is allowed to read.
Admin session Available
Superusers sign in to the admin with a cookie session (HttpOnly, SameSite=Strict, Secure over HTTPS). Cookie-authenticated writes must send X-DBlob-CSRF: 1.
| Method | Path | What it does |
|---|---|---|
| GET | /api/admin/setup | Whether the first superuser still needs to be created |
| POST | /api/admin/setup | Create the first superuser |
| POST | /api/admin/session | Sign in |
| GET | /api/admin/session | Current superuser, or 401 |
| DELETE | /api/admin/session | Sign out |
App auth Password sign-in available
Auth collections hold your users. Passwords are stored in DBlob's separate auth vault, never in your app data, and changing a password signs the user out everywhere.
| Method | Path | What it does |
|---|---|---|
| POST | /api/auth/{c}/login | Email + password → access token, refresh token, record |
| POST | /api/auth/{c}/refresh | New token pair; the refresh token rotates |
| POST | /api/auth/{c}/logout | End the session |
| GET | /api/auth/{c}/me | The signed-in record |
| GET | /.well-known/jwks.json | Public keys to verify tokens in your own services |
- Access tokens are Ed25519-signed JWTs that last 15 minutes. Refresh sessions last 30 days idle, 90 days at most.
- Replaying an old refresh token revokes the whole session: if a token is stolen, the thief and the user both get signed out.
- Sign-in is rate limited per IP and per account.
- One-time codes, OAuth2, passkeys, MFA and email flows are Planned.
Access: grants & roles Available
Guests and app users are limited by grants; with no matching grant, the answer is no. Roles are your own (editor, support, …) plus the built-ins everyone, authenticated and verified.
| Method | Path | What it does |
|---|---|---|
| GET · POST | /api/roles | List, create or update roles |
| DELETE | /api/roles/{name} | Delete a role with its members and grants |
| GET · POST · DELETE | /api/roles/{name}/members | Manage members (auth records) |
| GET · POST | /api/grants | List or add grants; conditions are checked on save |
| PATCH · DELETE | /api/grants/{id} | Change or remove a grant |
{ "actions": ["UPDATE"], "collection": "posts", "columns": ["title", "body"],
"role": "authenticated", "where": "author = @auth.id",
"text": "GRANT UPDATE (title, body) ON posts TO authenticated WHERE author = @auth.id" }Deny beats allow; allows are OR'ed; every written column needs a grant whose conditions hold. To check what someone can see, superusers can send X-DBlob-View-As: guest or X-DBlob-View-As: users:<id>. Read the security model for the details.
Files Available
File fields store uploads on local disk or any S3-compatible service (AWS S3, Cloudflare R2, Backblaze B2, DigitalOcean Spaces, MinIO). Uploading needs update access to the field; downloading needs read access to the record and field.
| Method | Path | What it does |
|---|---|---|
| POST | /api/collections/{c}/records/{id}/files/{field} | Multipart upload, one or more files |
| DELETE | /api/collections/{c}/records/{id}/files/{field}/{name} | Remove a file |
| GET | /api/files/{c}/{id}/{name} | Download; ?thumb=300x0 for thumbnails |
| GET · PUT | /api/settings/storage | Storage settings; saving tests the connection first |
Thumbnails: 100x100 crops, 300x0 or 0x300 keeps the aspect ratio, 600x600f fits. Downloads are sandboxed, so an uploaded HTML or SVG file can't run scripts on your domain.
Realtime: live queries Available
Open one Server-Sent Events stream, then subscribe any number of queries to it. You get a snapshot first, then patches as data changes. Every query runs as the caller, so grants apply, and a revoked session closes the stream.
GET /api/live
POST /api/live/{stream}/subscribe
{ "id": "latest", "query": { "collection": "posts", "filter": "status = 'published'", "order": ["-created"], "limit": 10 } }
POST /api/live/{stream}/unsubscribe
{ "id": "latest" }Events: connected, snapshot (rows), patch (upserted rows, removed ids, new order) and closed. Writes made outside DBlob are not picked up yet.
Webhooks & scheduled jobs Available
Set them up in the admin under Settings → Webhooks and Settings → Jobs. A webhook sends record events (created, updated, deleted), sign-ups, verified accounts and published content to your URL as JSON. By default it sends the record as a role you choose sees it, so columns that role can't read never leave the server. Failed deliveries are retried with backoff. A hook that keeps failing is turned off and the admin shows why. Delivery is at least once and not ordered: drop repeats by X-DBlob-Event-Id.
Every request is signed. X-DBlob-Signature: t=<unix seconds>,v1=<hex> is an HMAC-SHA256 of <t>.<raw body>, keyed with the hook's secret. Verify it against the raw body, compare in constant time, and refuse old timestamps:
import crypto from 'node:crypto';
export function verifyDBlob(rawBody, header, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(String(header ?? '').split(',').map((p) => { const i = p.indexOf('='); return [p.slice(0, i), p.slice(i + 1)]; }));
const t = Number(parts.t);
if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
const expected = crypto.createHmac('sha256', secret).update(`${t}.`).update(rawBody).digest();
const given = Buffer.from(parts.v1 ?? '', 'hex');
return given.length === expected.length && crypto.timingSafeEqual(given, expected);
}Webhook targets must be public addresses. Every address a name resolves to is checked, and checked again when the request connects. Redirects are only followed when you turn that on. Scheduled jobs use cron syntax in a time zone. They can call a webhook (for example, to rebuild a static site), run a SQL maintenance statement, or purge old records.