Skip to main content
An end-to-end example for APIs that need persistent storage: provision PostgreSQL and attach it to an app as DATABASE_URL.

1. Create the database

From the response, keep database.id and database.connectionString.

2. Set the app variable

3. Restart and verify

Confirm the app is up with GET /api/apps/app_001 and the database is running with GET /api/databases/db_001.
Environment variables are injected at startup. Without the restart, the app never sees DATABASE_URL.

Next steps

Provision a database

The full database lifecycle guide.

Manage secrets

Keep credentials safe.
Last modified on September 1, 2026