Skip to content
BunBase BunBase BunBase Docs Alpha v0.1.0

API Reference

A machine-readable OpenAPI 3.1 spec is available at:

GET /api/v1/openapi.json

No authentication required. Import it into Postman, Insomnia, Swagger UI, or any OpenAPI-compatible tooling to explore all endpoints interactively.


All endpoints are under /api/v1. Authenticated endpoints require Authorization: Bearer <access-token> or X-API-Key: bb_....

Admin endpoints require Authorization: Bearer <admin-secret>.

MethodPathAuthDescription
POST/auth/registerRegister with email + password
POST/auth/loginLogin; returns tokens or totp_required
POST/auth/refreshExchange refresh token for new pair
POST/auth/logoutBearerRevoke current session
POST/auth/logout-allBearerRevoke all sessions
GET/auth/meBearerGet current user
DELETE/auth/meBearerDelete account
POST/auth/forgot-passwordSend password reset email
POST/auth/reset-passwordReset password with token
POST/auth/verify-emailVerify email with token
POST/auth/resend-verificationBearerResend verification email
POST/auth/magic-linkSend magic link email
POST/auth/magic-link/verifyVerify magic link, create session
POST/auth/api-keysBearerCreate API key
GET/auth/api-keysBearerList API keys
DELETE/auth/api-keys/:idBearerRevoke API key
POST/auth/2fa/setupBearerGenerate TOTP secret
POST/auth/2fa/enableBearerEnable 2FA with TOTP code
DELETE/auth/2fa/disableBearerDisable 2FA with TOTP code
POST/auth/2fa/verifyComplete login with TOTP code
MethodPathAuthDescription
GET/:collectionVariesList records (supports ?search= for full-text search)
POST/:collectionVariesCreate record
GET/:collection/:idVariesGet record
PATCH/:collection/:idVariesUpdate record
DELETE/:collection/:idVariesSoft-delete record
POST/:collection/:id/restoreBearerRestore soft-deleted record
GET/:collection/countVariesCount records
GET/:collection/aggregateVariesAggregate (sum/avg/min/max/count)
POST/:collection/bulkVariesBulk-create records (atomic, max 500)
POST/:collection/batchBearerAtomic batch create/update/delete (max 100 ops)
MethodPathAuthDescription
POST/storage/uploadBearerUpload a file (multipart/form-data)
GET/storageBearerList files owned by current user
GET/storage/:idVariesDownload file
GET/storage/:id/:filenameVariesDownload file (cosmetic — carries original filename for browser; same auth rules as /:id)
DELETE/storage/:idBearerDelete file
POST/storage/signBearerGenerate signed upload URL
FieldRequiredDescription
fileYesThe file to upload
bucketNoTarget bucket (default: default)
is_publicNotrue or 1 for public files
collectionNoAssociated collection name
record_idNoAssociated record ID
MethodPathDescription
GET/admin/collectionsList all collections
POST/admin/collectionsCreate collection
PATCH/admin/collections/:nameUpdate access rules
DELETE/admin/collections/:nameDrop collection and all data
GET/admin/collections/:name/schemaGet schema info
DELETE/admin/collections/:name/schema/:columnDrop a column
GET/admin/collections/:name/recordsList records (admin, includes deleted)
POST/admin/collections/:name/recordsCreate record
GET/admin/collections/:name/records/:idGet any record
PATCH/admin/collections/:name/records/:idUpdate any record
DELETE/admin/collections/:name/records/:idHard-delete record
PUT/admin/collections/:name/rulesSet field validation rules
GET/admin/collections/:name/indexesList indexes
POST/admin/collections/:name/indexesCreate index on a column
DELETE/admin/collections/:name/indexes/:columnDrop an index
MethodPathDescription
GET/admin/usersList all users
DELETE/admin/users/:idDelete a user
PATCH/admin/users/:id/rolesSet user roles
POST/admin/users/:id/impersonateIssue 15-min token as user
MethodPathDescription
GET/admin/sessionsList all sessions
DELETE/admin/sessions/:idRevoke a session
POST/admin/sessions/purgeDelete all expired sessions
MethodPathDescription
GET/admin/storageList all files
POST/admin/storage/uploadUpload without user ownership
DELETE/admin/storage/:idDelete any file
MethodPathDescription
GET/admin/bucketsList buckets
POST/admin/bucketsCreate bucket
PATCH/admin/buckets/:nameUpdate bucket settings
DELETE/admin/buckets/:nameDelete bucket
MethodPathDescription
GET/admin/relationsList relations
POST/admin/relationsCreate relation
DELETE/admin/relations/:idDelete relation
MethodPathDescription
GET/admin/hooksList all hooks (filter with ?collection=name)
POST/admin/hooksCreate hook
GET/admin/hooks/:idGet hook
PATCH/admin/hooks/:idUpdate hook (code, enabled)
DELETE/admin/hooks/:idDelete hook

See Lifecycle Hooks for full documentation.

MethodPathDescription
GET/admin/settingsGet all runtime settings
PATCH/admin/settingsUpdate one or more settings (takes effect within 60 s)
GET/admin/settings/auditSettings change audit log (?limit=50&offset=0)
GET/admin/settings/exportDownload all settings as a JSON file
POST/admin/settings/importBulk-import settings from a JSON object
POST/admin/settings/test-emailSend a test email using current provider config
POST/admin/restartGracefully restart the server process

Available setting keys (see Configuration for full table):

KeyTypeDefaultDescription
maintenance_modebooleanfalseReturn 503 for all non-admin requests
registration_openbooleantrueAllow new user registrations
single_session_modebooleanfalseRevoke other sessions on new login
lockout_max_attemptsnumber10Max failed logins before lockout
lockout_duration_msnumber900000Lockout duration in ms
auto_create_bucketsbooleanfalseCreate missing buckets on first upload
auto_create_collectionsbooleantrueCreate missing collections on first write
email_providerstringconsoleconsole, resend, or smtp
email_fromstringSender address
app_namestringApp name shown in emails
app_urlstringFrontend origin for email callback links
MethodPathDescription
GET/admin/healthHealth check (public)
GET/admin/statsAggregate server metrics
POST/admin/backupHot backup (VACUUM INTO), streams .db file
MethodPathDescription
GET/metricsPrometheus text format metrics
CodeMeaning
200OK
201Created
204No content
304Not modified (conditional GET)
400Bad request / validation error
401Authentication required
403Forbidden
404Not found
409Conflict
413File too large
415Unsupported MIME type
429Rate limit exceeded
500Internal server error

All error responses use the same format:

{ "error": "Human-readable error message." }