POST
/
api
/
postgres_databases
curl --request POST \
  --url https://api.sequinstream.com/api/postgres_databases \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --data '{
    "name": "example-db",
    "url": "postgresql://postgres:secret-password@db.example.com:5432/postgres",
    "ssl": true,
    "replication_slots": [
      {
        "publication_name": "sequin_pub",
        "slot_name": "sequin_slot"
      }
    ]
  }'
{
  "id": "db_01HRMW3ZNE5EFGW9SDXW01TT92",
  "name": "example-db",
  "hostname": "db.example.com",
  "database": "postgres",
  "username": "postgres",
  "password": "************",
  "port": 5432,
  "ssl": true,
  "use_local_tunnel": false,
  "ipv6": false,
  "replication_slots": [
    {
      "id": "rs_01HRMW3ZNE5EFGW9SDXW01TT93",
      "publication_name": "sequin_pub",
      "slot_name": "sequin_slot",
      "status": "active"
    }
  ]
}

Request body

For creates, the replication_slots array must exist and contain exactly one replication slot object.

name
string
required

A name for this database connection. You can use this name to identify the database across the API.

url
string

The full connection URL for the database, e.g. postgresql://postgres:secret-password@db.example.com:5432/postgres.

Pass in either this parameter or database, hostname, port, username, password.

To specify SSL, use the separate ssl field.

hostname
string
required

The database server hostname.

database
string
required

The name of the logical database in Postgres.

username
string
required

The database username.

password
string
required

The database password.

port
integer

The database server port. Defaults to 5432.

ssl
boolean

Whether to use SSL for the connection. Defaults to true.

ipv6
boolean

Whether to use IPv6 for the connection. Defaults to false.

primary
object

Connection details for the primary database, only needed when connecting to a replica.

replication_slots
array
required

Response

A database object is returned in the response.

curl --request POST \
  --url https://api.sequinstream.com/api/postgres_databases \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --data '{
    "name": "example-db",
    "url": "postgresql://postgres:secret-password@db.example.com:5432/postgres",
    "ssl": true,
    "replication_slots": [
      {
        "publication_name": "sequin_pub",
        "slot_name": "sequin_slot"
      }
    ]
  }'
{
  "id": "db_01HRMW3ZNE5EFGW9SDXW01TT92",
  "name": "example-db",
  "hostname": "db.example.com",
  "database": "postgres",
  "username": "postgres",
  "password": "************",
  "port": 5432,
  "ssl": true,
  "use_local_tunnel": false,
  "ipv6": false,
  "replication_slots": [
    {
      "id": "rs_01HRMW3ZNE5EFGW9SDXW01TT93",
      "publication_name": "sequin_pub",
      "slot_name": "sequin_slot",
      "status": "active"
    }
  ]
}