DBHost is useful when the same database actions keep repeating: list databases, create a new one for a project, trigger backups, or reset a password after a release. This guide shows the shortest path to automating those tasks with the published CLI and the REST API. Best fit: Indie developers, small SaaS teams, and agencies that want repeatable database workflows from a terminal, CI job, or deployment script. Not for: Teams that only need one-off dashboard actions and do not need API access or automation yet.Documentation Index
Fetch the complete documentation index at: https://docs.dbhost.app/llms.txt
Use this file to discover all available pages before exploring further.
What you need
- A DBHost account
- API access on a Pro or Business plan
- One API key with the smallest scope that fits the job
1. Create an API key
Create the key in Settings and copy it immediately. DBHost only shows the full secret once. If the automation only needs to inspect or operate on an existing database, select that database and keep the key scoped narrowly.2. Use the CLI locally
Install or run the published CLI:3. Use environment variables in CI
For scripts and CI jobs, prefer environment variables instead of interactive login:4. Automate the common database workflows
List databases:--output, dbhost backups download saves the file to your current working directory using the same backup filename.
Reset a password:
--json flag is the safest default for automation because it gives you machine-readable output that can be parsed by your job runner.
5. Call the API directly when HTTP is simpler
If your system already works with cURL or fetch, call the API directly:7. Handle retries without changing your workflow
The CLI commands and REST endpoints keep the same authentication model and success payloads. The main Phase 1 security change for automation is that DBHost now returns:413 PAYLOAD_TOO_LARGEwhen a JSON body is too large429 RATE_LIMITEDwhen a route is being hit too aggressively or when there are too many unauthorized attempts
Retry-After header on 429 responses before retrying. If you use the CLI, treat 429 as a temporary backoff condition instead of a permanent failure.
6. Keep automation safe
- Default to selected-database keys
- Use full-account keys only for database creation or account-wide administration
- Treat database IDs as UUIDs, not row numbers
- Revoke keys you no longer need
- Keep secrets in CI secret storage, not in source control
- Keep create and mutation jobs bounded; avoid tight retry loops without delay
- Respect
Retry-Afterwhen the API returns429
DBHost’s API and CLI are designed for the same workflows as the dashboard. If you want to verify a flow by hand before automating it, the dashboard shows the same databases, backups, and API key scopes.
Example CI job
Next steps
Start for Free
Create an account now, then move to a paid plan when you need API access.
API Reference
Use the REST API directly when HTTP fits your workflow better than the CLI.
- Read the CLI reference for the full command list.
- Read the API introduction for the request and response shape.
- Read API keys if you want a deeper look at scopes and revocation.