Provision a Per-App Database
Give a backend app (type managed, fullstack or function) its own MariaDB database in one call. In one step Ngris creates a database in your account (listed by GET /v1/databases), named after the app — <name>-2, <name>-3 … when the account already has a database of that name — with a read-write user named app, and connects the app to it as that user with no prefix, so the app gets DB_HOST … DATABASE_URL. One per application.
The variables are built when the app starts: nothing is written into the app's environment variables, and the password is never returned. To get one, reset the app user's password (connected apps restart). From then on it is an ordinary database: rename it, add users, connect other apps, or disconnect it. It stays when you delete the app, with its users and data; only a WordPress site's own database is deleted with the site. While the app is connected to it, the app's backups cover it.
Environment variables
The connection gives the app these variables. They show in the app's env list as source: "database" rows, and reach the backend once the database and its app user are ready — a running app then restarts to pick them up:
3306 for MySQL / MariaDB.app user's login (u_<6 characters>_app).mysql://user:pass@host:3306/db). Also a masked secret.Response (202 Accepted)
Provisioning is asynchronous. The database is created with status: "provisioning"; poll GET /database until it is ready. The response body is the database object itself (it is not wrapped), with no password. Calling again while it is provisioning answers 202 with it again; a failed one is retried.
-2, -3 … when taken). You can rename it.provisioning → ready (or failed).app_<slug>_<8 characters>).app user the app connects as.Deprecated: until the sunset the database object also carries the legacy integer id and *_id fields. Don't use them; read uuid and the *_uuid fields.
Errors
code: "env_conflict" and names: the app already uses one of the names (its own environment variable, or a database connected without a prefix).Get the Per-App Database
Read the app's own database: the one the call above created (or a WordPress site's), otherwise the database behind the app's DB_HOST … DATABASE_URL — a connection with no prefix that reaches production. Every database connected to the app is listed by GET /v1/applications/{uuid}/database-connections. Returns its status and the connection identifiers (db_name, db_user — the login the app connects as — and db_host). The password is never included: it is stored encrypted and reaches the backend as DB_PASSWORD; reset the user's password to get a new one. Poll this after provisioning until status is ready.
Response (200 OK)
null when no database has been provisioned; otherwise the database.provisioning, ready, or failed.