PgBeam Docs
Databases

createDatabase

Add a database

Registers a new upstream PostgreSQL database for the project.

Usage

const result = await api.databases.createDatabase({
    body: {
      host: "...",
      port: 5432,
      name: "...",
      username: "...",
      password: "...",
    },
  });

Parameters

ParameterTypeRequiredDescription
body.hoststringYesPostgreSQL host.
body.portnumberYesPostgreSQL port.
body.namestringYesPostgreSQL database name.
body.usernamestringYesPostgreSQL username.
body.passwordstringYesPostgreSQL password. Stored encrypted at rest.
body.ssl_modeSSLModeNo
body.roleDatabaseRoleNo
body.pool_regionstringNoRegion where the connection pool is maintained (near the database). When set and different from the client's edge region, queries are relayed through the pool region's data plane. Empty means direct connection.
body.cache_configCacheConfigNo
body.pool_configPoolConfigNo

Response

Promise<Database> — database created.

Example

import { PgBeamClient } from "pgbeam";

const client = new PgBeamClient({
  token: "pbk_...",
  baseUrl: "https://api.pgbeam.com",
});

const result = await client.api.databases.createDatabase({
  body: {
      host: "...",
      port: 5432,
      name: "...",
      username: "...",
      password: "...",
    },
});

Errors

StatusDescription
400Invalid request parameters.
401Missing or invalid authentication.
403Operation not allowed by current plan limits.
404Resource not found.
429Rate limited. Try again later.

On this page