← Back to Documentation Home
Overview
Get Project Info
Get Settings
Get Settings by App URL
Update Settings
Get Email Branding
Test Email Configuration
Reload Settings Cache
Delete Tenant Settings
Database Settings Reference
Environment Variables Reference
The Settings API provides configuration management for the BAASIX application. Settings can be stored in the database (for runtime configuration) or set via environment variables (for server configuration).
Base URLs: / and /settings
Get basic project information. This is a public endpoint.
URL: / or POST /
Method: GET or POST
Auth required: No (Public endpoint)
{
"data" : {
"project_name" : "My Application" ,
"title" : "My App" ,
"project_color" : "#007bff" ,
"secondary_color" : "#6c757d" ,
"description" : "Application description" ,
"project_url" : "https://api.myapp.com" ,
"app_url" : "https://myapp.com"
}
}
curl -X GET "http://localhost:3000/"
Retrieve application settings. Returns global or tenant-specific settings.
URL: /settings
Method: GET
Auth required: No (Public endpoint, but some fields may require admin)
Parameter Type Description tenant_id string Get settings for specific tenant (optional)
{
"data" : {
"project_name" : "My Application" ,
"title" : "My App Title" ,
"project_color" : "#007bff" ,
"secondary_color" : "#6c757d" ,
"description" : "Application description" ,
"keywords" : "baasix, backend, api" ,
"project_url" : "https://api.myapp.com" ,
"app_url" : "https://myapp.com" ,
"timezone" : "UTC" ,
"language" : "en" ,
"date_format" : "YYYY-MM-DD" ,
"currency" : "USD" ,
"from_email_name" : "My App" ,
"email_signature" : "Best regards, \n My App Team" ,
"mobile_session_limit" : -1 ,
"web_session_limit" : -1
}
}
# Get global settings
curl -X GET "http://localhost:3000/settings"
# Get tenant-specific settings
curl -X GET "http://localhost:3000/settings?tenant_id=tenant-123"
Retrieve settings for a specific application URL. Useful for multi-tenant frontends.
URL: /settings/by-app-url
Method: GET
Auth required: No (Public endpoint)
Parameter Type Required Description app_url string Yes The application URL to match
{
"data" : {
"project_name" : "Tenant App" ,
"title" : "Tenant Application" ,
"project_color" : "#ff5722" ,
"app_url" : "https://tenant.myapp.com" ,
"tenant_Id" : "tenant-uuid"
}
}
curl -X GET "http://localhost:3000/settings/by-app-url?app_url=https://tenant.myapp.com"
Update application settings. Admin only.
URL: /settings
Method: PATCH
Auth required: Yes (Admin permissions required)
Settings are updated as key-value pairs directly:
{
"project_name" : "New App Name" ,
"project_color" : "#ff5722" ,
"timezone" : "America/New_York" ,
"mobile_session_limit" : 3 ,
"web_session_limit" : 5
}
{
"data" : {
"id" : "settings-uuid" ,
"project_name" : "New App Name" ,
"project_color" : "#ff5722" ,
"timezone" : "America/New_York" ,
"mobile_session_limit" : 3 ,
"web_session_limit" : 5 ,
"updatedAt" : "2025-01-15T10:30:00.000Z"
}
}
curl -X PATCH http://localhost:3000/settings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <admin-token>" \
-d '{
"project_name": "My Updated App",
"timezone": "America/New_York",
"mobile_session_limit": 3
}'
Get email branding information for a tenant (used for email templates).
URL: /settings/branding
Method: GET
Auth required: No (but tenant_id is required)
Parameter Type Required Description tenant_id string Yes The tenant ID
{
"data" : {
"project_name" : "Tenant App" ,
"project_color" : "#007bff" ,
"email_icon_Id" : "file-uuid" ,
"email_signature" : "Best regards, \n Tenant Team"
}
}
curl -X GET "http://localhost:3000/settings/branding?tenant_id=tenant-123"
Test the email configuration by sending a test email. Admin only.
URL: /settings/test-email
Method: POST
Auth required: Yes (Admin permissions required)
Parameter Type Required Description to string Yes Email address to send test to
curl -X POST http://localhost:3000/settings/test-email \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <admin-token>" \
-d '{"to": "test@example.com"}'
Force reload of settings from database into cache. Admin only.
URL: /settings/reload
Method: POST
Auth required: Yes (Admin permissions required)
curl -X POST http://localhost:3000/settings/reload \
-H "Authorization: Bearer <admin-token>"
Delete settings for a specific tenant. Admin only.
URL: /settings/tenant
Method: DELETE
Auth required: Yes (Admin permissions required)
Parameter Type Required Description tenant_id string Yes Tenant ID to delete
curl -X DELETE "http://localhost:3000/settings/tenant?tenant_id=tenant-123" \
-H "Authorization: Bearer <admin-token>"
These settings are stored in the baasix_Settings table and can be updated via the API:
Setting Key Type Description Default project_name string Project/application name - title string Application title for display - project_color string Primary brand color (hex) - secondary_color string Secondary brand color (hex) - description string Application description (SEO) - keywords string SEO keywords - project_url string API/Backend URL - app_url string Frontend application URL -
Setting Key Type Description project_logo_light_Id UUID Light theme logo file ID project_logo_dark_Id UUID Dark theme logo file ID project_logo_full_Id UUID Full logo with text file ID project_logo_transparent_Id UUID Transparent logo file ID project_favicon_Id UUID Favicon file ID project_icon_Id UUID App icon file ID email_icon_Id UUID Email template icon file ID
Setting Key Type Description Default from_email_name string From address display name - email_signature string Email signature template - smtp_enabled boolean Enable SMTP false smtp_host string SMTP server hostname - smtp_port number SMTP server port 587 smtp_secure boolean Use TLS/SSL false smtp_user string SMTP username - smtp_pass string SMTP password - smtp_from_address string SMTP from email address -
Setting Key Type Description Default timezone string Default timezone "UTC" language string Default language "en" date_format string Date display format "YYYY-MM-DD" currency string Default currency "USD"
Setting Key Type Description Default mobile_session_limit number Max mobile sessions per user (-1=unlimited) -1 web_session_limit number Max web sessions per user (-1=unlimited) -1 session_limit_roles JSON Array of role IDs to apply limits to []
Setting Key Type Description metadata JSON Custom metadata storage modules JSON Module configuration
These settings are configured via environment variables at server startup:
Variable Description Default PORT Server port 8055 SECRET_KEY JWT signing key (required) - NODE_ENV Environment (production/dev) development
Variable Description Default DATABASE_URL PostgreSQL connection string - DATABASE_POOL_MAX Max connection pool size 20 DATABASE_POOL_IDLE Idle timeout (ms) 10000 DATABASE_POOL_ACQUIRE Acquire timeout (ms) 30000 DATABASE_LOGGING Enable SQL logging false DATABASE_SSL_CERTIFICATE Path to SSL certificate - DATABASE_READ_REPLICA_ENABLED Enable read replicas false DATABASE_READ_REPLICA_URLS Comma-separated replica URLs -
Variable Description Default CACHE_ADAPTER Cache backend (memory/redis/upstash) memory CACHE_REDIS_URL Redis connection URL - CACHE_TTL Cache TTL in seconds 30 CACHE_SIZE_GB In-memory cache size (GB) 1.0 CACHE_ENABLED Enable/disable caching true
Variable Description Default AUTH_CORS_ALLOWED_ORIGINS Comma-separated allowed CORS origins - AUTH_CORS_ALLOW_ANY_PORT Allow any port for CORS matching true AUTH_CORS_CREDENTIALS Include credentials in CORS true AUTH_APP_URL Comma-separated allowed app URLs -
Variable Description Default RATE_LIMIT Max requests per window 100 RATE_LIMIT_INTERVAL Rate limit window (ms) 5000
Variable Description Default MULTI_TENANT Enable multi-tenant mode false
Variable Description MAIL_SENDERS_ENABLED Comma-separated list of mail senders MAIL_DEFAULT_SENDER Default sender name <SENDER>_SMTP_HOSTSMTP host for sender <SENDER>_SMTP_PORTSMTP port for sender <SENDER>_SMTP_SECURETLS/SSL for sender (true/false) <SENDER>_SMTP_USERSMTP username for sender <SENDER>_SMTP_PASSSMTP password for sender <SENDER>_FROM_ADDRESSFrom email address for sender
Variable Description STORAGE_SERVICES_ENABLED Comma-separated list of storage services STORAGE_DEFAULT_SERVICE Default storage service STORAGE_TEMP_PATH Temporary file storage path <SERVICE>_STORAGE_DRIVERStorage driver (LOCAL or S3) <SERVICE>_STORAGE_PATHLocal storage path <SERVICE>_STORAGE_ACCESS_KEY_IDS3 access key <SERVICE>_STORAGE_SECRET_ACCESS_KEYS3 secret key <SERVICE>_STORAGE_REGIONS3 region <SERVICE>_STORAGE_BUCKETS3 bucket name <SERVICE>_STORAGE_ENDPOINTS3 endpoint URL
Variable Description Default SOCKET_ENABLED Enable Socket.IO false SOCKET_PATH Socket.IO connection path /socket SOCKET_CORS_ENABLED_ORIGINS CORS origins for WebSocket - SOCKET_REDIS_ENABLED Use Redis for Socket.IO clustering false SOCKET_REDIS_URL Redis URL for Socket.IO adapter -
Variable Description Default TASK_SERVICE_ENABLED Enable background task service false TASK_LIST_REFRESH_INTERVAL Task cache refresh interval (sec) 600 TASK_SHUTDOWN_WAIT_TIME Wait time for tasks on shutdown (sec) 30
Code Message Description 400 Invalid settings data Malformed settings object 401 Unauthorized Authentication required 403 Forbidden Admin permissions required 404 Settings not found No settings for given tenant 500 Settings update failed Server error during update
← Back to Documentation Home