Starting the Server
Options
string
Hostname to bind the API server to (default:
localhost)Use all for no hostname binding (bind to all interfaces).number
Port to run the API server on (default:
8087)boolean
Allow requests with Origin header
Examples
Server Configuration
When serve mode starts, it automatically sets:Origin Protection
By default, the server blocks requests with anOrigin header to prevent CSRF attacks:
Advanced Hostname Options
Serve mode supports several hostname formats: File descriptor (connected socket):API Endpoints
All endpoints return JSON responses. Most require an unlocked vault.Status and Authentication
GET /status
Get server and vault status.POST /unlock
Unlock the vault.For security,
passwordFile and passwordEnv query parameters are blocked in serve mode.POST /lock
Lock the vault.POST /sync
Sync vault data from server.Vault Object Operations
GET /list/object/:object
List vault objects. Parameters::object- Object type:items,folders,collections,org-collections,org-members,organizations,send
search- Search filterurl- URL filter (for items)folderid- Folder ID filtercollectionid- Collection ID filterorganizationid- Organization ID filtertrash- Show trash items (boolean)archived- Show archived items (boolean, requires feature flag)
GET /object/:object/:id
Get a specific object. Parameters::object- Object type:item,folder,collection,org-collection,organization,send:id- Object ID or search term
itemid- Item ID (for attachments)organizationid- Organization ID (for org objects)
POST /object/:object
Create a new object. Parameters::object- Object type:item,folder,org-collection,send
organizationid- Organization ID (for org objects)
PUT /object/:object/:id
Update an existing object. Parameters::object- Object type:item,folder,org-collection,send:id- Object ID
DELETE /object/:object/:id
Delete an object. Parameters::object- Object type:item,folder,org-collection,send:id- Object ID
itemid- Item ID (for attachments)organizationid- Organization ID (for org objects)permanent- Permanently delete (boolean, for items)
Attachments
POST /attachment
Create an attachment. Content-Type:multipart/form-data
Form fields:
file- File to uploaditemid- Item ID to attach to
Send Operations
GET /send/list
List all Sends.POST /send/:id/remove-password
Remove password from a Send. Parameters::id- Send ID
Organization Operations
POST /move/:id/:organizationId
Move item to organization. Parameters::id- Item ID:organizationId- Organization ID
POST /confirm/:object/:id
Confirm organization member. Parameters::object- Object type (currently onlyorg-member):id- Member ID
organizationid- Organization ID (required)
POST /restore/:object/:id
Restore item from trash or archive. Parameters::object- Object type (currently onlyitem):id- Item ID
POST /archive/:object/:id
Archive an item. Parameters::object- Object type (currently onlyitem):id- Item ID
Requires PM19148_InnovationArchive feature flag.
Utilities
GET /generate
Generate password or passphrase. Query parameters:uppercase- Include uppercase (boolean)lowercase- Include lowercase (boolean)number- Include numbers (boolean)special- Include special chars (boolean)passphrase- Generate passphrase (boolean)length- Password length (number)words- Passphrase words (number)separator- Word separator (string)capitalize- Capitalize words (boolean)includeNumber- Include number in passphrase (boolean)
Response Format
All endpoints return a consistent response structure:Success Response
Error Response
200 OK- Success400 Bad Request- Error (vault locked, invalid input, etc.)403 Forbidden- Origin protection violation
Locked Vault Errors
Endpoints that require an unlocked vault return:400
Not Logged In Errors
400
Environment Variables
Serve mode automatically sets:string
Always set to
"true" in serve modestring
Always set to
"true" to disable interactive promptsstring
Commands respect this for JSON formatting
BW_SESSION when starting the server.
Usage Examples
Complete Workflow
Python Client Example
JavaScript/Node.js Example
Security Considerations
- Bind to localhost: Default
localhostbinding ensures only local access - Use HTTPS reverse proxy: For remote access, use nginx/Apache with TLS
- Enable origin protection: Keep
--disable-origin-protectiondisabled - Network isolation: Run on isolated networks or use firewall rules
- Lock when done: Always lock the vault after operations
- Avoid public exposure: Never expose serve mode directly to the internet
Reverse Proxy Example (nginx)
Architecture
Serve mode is implemented with:- Koa: Web framework (src/commands/serve.command.ts:31)
- @koa/router: Routing (oss-serve-configurator.ts:221-439)
- koa-bodyparser: JSON body parsing
- koa-json: JSON response formatting
- @koa/multer: Multipart form data (attachments)
src/oss-serve-configurator.ts, which can be extended by commercial builds.
Next Steps
Commands Reference
Full CLI commands documentation
Overview
CLI overview and installation