Documentation
quickstart · base URL · auth · endpoints
Quickstart and API reference for the Layerbase Cloud API. A dedicated docs site is on the way - for now, this single page covers everything from sign-up to first request.
# List databases on your account
$ curl https://cloud.layerbase.dev/v1/databases \
-H "Authorization: Bearer $LAYERBASE_API_KEY"
# Returns JSON
{ "databases": [ ... ] }
Quickstart
Three steps. No CLI install required - you can run your first query from any HTTP client or your existing database driver.
Sign in with GitHub or Google. We don't require a credit card up-front - paid plans only kick in once you provision your first database.
From the dashboard, click New Database, pick an engine (PostgreSQL is a solid first pick), and Layerbase provisions it in under a minute. The resulting page has Quick Connect snippets for psql, Node, Python, and the HTTP query API.
Three shapes - pick whichever fits your stack. The HTTP query API is the easiest path for serverless and edge runtimes; the connection string works with any standard driver.
$ curl https://cloud.layerbase.dev/v1/databases/<id>/query \
-H "Authorization: Bearer $LAYERBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "SELECT 1"}'
Prefer a connection string? Each database page exposes the full URL (e.g. postgresql://admin:••••@your-db.cloud.layerbase.dev/db?sslmode=require) plus copy-paste snippets for the most common drivers under Quick Connect.
From here, the rest of this page is the full API reference - base URL, authentication, env-var conventions, and every endpoint we expose.
01 / Base URL
All API requests use HTTPS. The base URL is the same for every endpoint.
https://cloud.layerbase.dev02 / Authentication
All /v1/* endpoints (except /v1/engines) require a personal API key passed in the Authorization header.
Authorization: Bearer sk_<your-key>Manage keys at layerbase.com/cloud/settings under Personal API keys. The full secret is shown once at creation - store it in a password manager or secret store.
03 / Environment variables
Names we use in our own examples and SDKs. Use whatever you like - but consistency makes copy-paste examples just work.
LAYERBASE_API_URLBase URL of the cloud API - https://cloud.layerbase.dev
LAYERBASE_API_KEYYour personal API key (sk_...) - used as the Bearer token
DATABASE_URLPer-database connection string returned by POST /v1/databases or visible on the database detail page
04 / Endpoints
Every endpoint accepts and returns JSON. Bodies use camelCase. Errors are returned as { error: string } with a relevant HTTP status.
/v1/enginesPublic engine registry (no auth)
/v1/databasesList databases on your account
/v1/databasesCreate a database
/v1/databases/:idGet a single database
/v1/databases/:id/queryRun a query over HTTP
/v1/api-keysList your personal API keys
/v1/api-keysCreate a new personal API key
/healthHealth probe (no auth)
05 / Quick example
Set your environment variables and curl your first request. The same Bearer token works against every /v1/* endpoint.
$ export LAYERBASE_API_URL=https://cloud.layerbase.dev
$ export LAYERBASE_API_KEY=sk_xxxxxxxxxxxx
$ curl $LAYERBASE_API_URL/v1/databases \
-H "Authorization: Bearer $LAYERBASE_API_KEY"
Got an unexpected 404 or unhelpful error? Open an issue.