Docs

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.

From sign-up to first query

Three steps. No CLI install required - you can run your first query from any HTTP client or your existing database driver.

1

Sign up

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.

2

Create a 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.

3

Connect and query

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.

HTTP query API
$ 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.

Where requests go

All API requests use HTTPS. The base URL is the same for every endpoint.

https://cloud.layerbase.dev

Bearer token on every request

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.

Recommended .env names

Names we use in our own examples and SDKs. Use whatever you like - but consistency makes copy-paste examples just work.

LAYERBASE_API_URL

Base URL of the cloud API - https://cloud.layerbase.dev

LAYERBASE_API_KEY

Your personal API key (sk_...) - used as the Bearer token

DATABASE_URL

Per-database connection string returned by POST /v1/databases or visible on the database detail page

Common operations

Every endpoint accepts and returns JSON. Bodies use camelCase. Errors are returned as { error: string } with a relevant HTTP status.

GET/v1/engines

Public engine registry (no auth)

GET/v1/databases

List databases on your account

POST/v1/databases

Create a database

GET/v1/databases/:id

Get a single database

POST/v1/databases/:id/query

Run a query over HTTP

GET/v1/api-keys

List your personal API keys

POST/v1/api-keys

Create a new personal API key

GET/health

Health probe (no auth)

Try it from your terminal

Set your environment variables and curl your first request. The same Bearer token works against every /v1/* endpoint.

curl
$ 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.