Managed Database
Managed Database provides each tenant with a fully managed SQLite database powered by Turso/libSQL. Store custom data, run SQL queries, and integrate with your workflows.
AltScore's Managed Database feature gives you a dedicated SQLite database for your tenant. You can use it to store custom data, create reports, or extend the platform's functionality with your own tables and queries.
Key Features
- Fully Managed: Automatic provisioning, backups, and maintenance
- SQLite Compatible: Use standard SQL syntax
- Secure Access: Token-based authentication with configurable expiration
- Global Distribution: Low-latency access from anywhere via Turso's edge network
Getting Started
1. Create Your Database
To provision your managed database, make a POST request to the tenant databases endpoint:
The response includes your database details and an initial access token:
2. Generate Access Tokens
Access tokens are short-lived credentials for connecting to your database. Generate a new token when needed:
Response:
Available options:
- expiration: Token lifetime (e.g.,
30m,1h,24h). Maximum is 24 hours. - authorization:
full-access(read/write) orread-only
3. Connect to Your Database
Use the connection URL and token to connect to your database.
Using the HTTP API
Using libSQL SDK (TypeScript)
Using libSQL SDK (Python)
Managing Your Database
Check Database Status
Response:
Suspend Database
If you need to temporarily disable access to your database:
Activate Database
Resume a suspended database:
Best Practices
- Token Management: Generate tokens with the shortest practical expiration time
- Use Read-Only Tokens: For reporting or analytics, use
read-onlyauthorization - Connection Pooling: Reuse database connections when possible
- Error Handling: Handle token expiration gracefully and regenerate when needed
Limitations
- Each tenant is limited to one managed database
- Token expiration maximum is 24 hours
- Database size limits may apply based on your plan
Next Steps
- Managed Database API Reference - Complete API documentation
- Turso Documentation - Learn more about the underlying database technology