Database Users
Manage per-database user accounts with fine-grained permission levels.
What are Database Users?
Database Users are individual access accounts scoped to a specific database. They allow team members or services to connect with appropriate permissions without sharing the admin credentials.
Permission Levels
| Permission | Description | Capabilities |
|---|---|---|
| Read Only | View data only | SELECT on all tables |
| Read/Write | View and modify data | SELECT, INSERT, UPDATE, DELETE |
| Admin | Full control | All privileges including schema changes |
Creating a User
Via the API
curl -X POST https://api.lordbase.com/e/v1/developer/databases/{database_id}/users/ \
-H "Authorization: Bearer lb_pat_your_token" \
-H "Content-Type: application/json" \
-d '{
"username": "app_readonly",
"permissions": "read"
}'
A secure password will be auto-generated and returned in the response.
Response:
{
"id": "770e8400-e29b-41d4-a716-446655440002",
"database": "660e8400-e29b-41d4-a716-446655440001",
"database_name": "my-app-db",
"username": "app_readonly",
"permissions": "read",
"is_active": true,
"created_at": "2026-01-15T11:00:00Z"
}
Username Rules
- Minimum 2 characters
- Letters, numbers, and underscores only
- Case-insensitive (stored lowercase)
- Must be unique within the database
Resetting a Password
Generate a new password for an existing user:
curl -X POST https://api.lordbase.com/e/v1/developer/databases/{database_id}/users/{user_id}/reset-password/ \
-H "Authorization: Bearer lb_pat_your_token"
The new password is returned in the response. Previous password is immediately invalidated.
Updating Permissions
curl -X PUT https://api.lordbase.com/e/v1/developer/databases/{database_id}/users/{user_id}/ \
-H "Authorization: Bearer lb_pat_your_token" \
-H "Content-Type: application/json" \
-d '{"permissions": "write"}'
Deactivating a User
curl -X PUT https://api.lordbase.com/e/v1/developer/databases/{database_id}/users/{user_id}/ \
-H "Authorization: Bearer lb_pat_your_token" \
-H "Content-Type: application/json" \
-d '{"is_active": false}'
Deactivated users cannot connect to the database but their account is preserved.
Deleting a User
curl -X DELETE https://api.lordbase.com/e/v1/developer/databases/{database_id}/users/{user_id}/ \
-H "Authorization: Bearer lb_pat_your_token"
attention
Deleting a user permanently removes their database access. Active connections will be terminated.
Best Practices
| Practice | Description |
|---|---|
| Least privilege | Grant the minimum permissions required |
| One user per service | Create separate users for each application or service |
| Use read-only where possible | Analytics, reporting, and dashboards should use read-only users |
| Rotate passwords | Regularly reset passwords for security |
| Monitor usage | Review last_used_at to identify unused accounts |
Next Steps
- Connection Details — Connect using your new user credentials
- Extensions — Enable PostgreSQL extensions