PgBeam Docs
Databases

Add a database

POST
/v1/projects/{project_id}/databases

Registers a new upstream PostgreSQL database for the project.

Authorization

AuthorizationBearer <token>

JWT issued by Better Auth. Verified via JWKS.

In: header

Path Parameters

project_id*string

Unique project identifier (prefixed, e.g. prj_xxx).

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Request body for registering an upstream database.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/projects/string/databases" \  -H "Content-Type: application/json" \  -d '{    "host": "db.example.com",    "port": 5432,    "name": "mydb",    "username": "pgbeam",    "password": "pa$$word"  }'
{  "id": "db_01h455vb4pex5vsknk084sn02q",  "project_id": "prj_01h455vb4pex5vsknk084sn02q",  "connection_string": "postgresql://myuser:YOUR_PASSWORD@myproject.proxy.pgbeam.app:5432/mydb",  "host": "db.example.com",  "port": 5432,  "name": "mydb",  "username": "pgbeam",  "ssl_mode": "require",  "role": "primary",  "pool_region": "us-east-1",  "query_timeout_ms": 0,  "auto_read_routing": false,  "cache_config": {    "enabled": true,    "ttl_seconds": 60,    "max_entries": 10000,    "swr_seconds": 30  },  "pool_config": {    "pool_size": 20,    "min_pool_size": 5,    "pool_mode": "transaction",    "max_active": 200  },  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}
{  "error": {    "code": "string",    "message": "string"  }}
{  "error": {    "code": "string",    "message": "string"  }}
{  "error": {    "code": "string",    "message": "string"  }}
{  "error": {    "code": "string",    "message": "string"  }}
{  "error": {    "code": "string",    "message": "string"  }}