PgBeam Docs
Projects

Add a replica

POST
/v1/databases/{database_id}/replicas

Adds a read replica to a database.

Authorization

AuthorizationBearer <token>

JWT issued by Better Auth. Verified via JWKS.

In: header

Path Parameters

database_id*string

Unique database identifier (prefixed, e.g. db_xxx).

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Request body for adding a read replica to a database.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/databases/string/replicas" \  -H "Content-Type: application/json" \  -d '{    "host": "replica.us-west-2.rds.amazonaws.com",    "port": 5432  }'
{  "id": "rep_01h455vb4pex5vsknk084sn02q",  "database_id": "db_01h455vb4pex5vsknk084sn02q",  "host": "replica.db.example.com",  "port": 5432,  "ssl_mode": "require",  "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"  }}