Projects
createReplica
Add a replica
Adds a read replica to a database.
Usage
const result = await api.projects.createReplica({
pathParams: { database_id: "db_xxx" },
body: {
host: "replica.us-west-2.rds.amazonaws.com",
port: 5432,
},
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| pathParams.database_id | string | Yes | Unique database identifier (prefixed, e.g. db_xxx). |
| body.host | string | Yes | PostgreSQL replica host. |
| body.port | number | Yes | PostgreSQL replica port. |
| body.ssl_mode | SSLMode | No |
Response
Promise<Replica> — replica created.
Example
import { PgBeamClient } from "pgbeam";
const client = new PgBeamClient({
token: "pbk_...",
baseUrl: "https://api.pgbeam.com",
});
const result = await client.api.projects.createReplica({
pathParams: { database_id: "db_xxx" },
body: {
host: "replica.us-west-2.rds.amazonaws.com",
port: 5432,
},
});Errors
| Status | Description |
|---|---|
| 400 | Invalid request parameters. |
| 401 | Missing or invalid authentication. |
| 403 | Operation not allowed by current plan limits. |
| 404 | Resource not found. |
| 429 | Rate limited. Try again later. |