Create database
curl --request POST \
--url https://api.example.com/api/v1/databasesimport requests
url = "https://api.example.com/api/v1/databases"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/databases', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/databases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/databases"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/databases")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/databases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyDatabases
Create database
Provision a new PostgreSQL database.
POST
/
api
/
v1
/
databases
Create database
curl --request POST \
--url https://api.example.com/api/v1/databasesimport requests
url = "https://api.example.com/api/v1/databases"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/databases', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/databases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/databases"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/databases")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/databases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyCreates a new PostgreSQL database with its own user, password, and PgBouncer pool entry.
Database names must match
^[a-z][a-z0-9-]{1,48}[a-z0-9]$ — lowercase letters, numbers, and hyphens, 3-50 characters.Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Database identifier (becomes DB name and username) |
displayName | string | Yes | Human-friendly label |
{
"name": "my-app",
"displayName": "My Application"
}
Example
curl -X POST https://dbhost.app/api/v1/databases \
-H "Authorization: Bearer dbh_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"name":"my-app","displayName":"My Application"}'
Response
201 Created
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "my-app",
"displayName": "My Application",
"host": "db.dbhost.app",
"port": 6432,
"database": "my-app",
"username": "my-app",
"password": "generated-secret-token",
"status": "active",
"connectionString": "postgresql://my-app:generated-secret-token@db.dbhost.app:6432/my-app?sslmode=verify-full"
}
Errors
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Request body is missing fields or the name is invalid |
| 401 | UNAUTHORIZED | Missing or invalid API key |
| 403 | KEY_SCOPE_DENIED | The API key is valid but does not have full account access |
| 403 | PLAN_LIMIT | Your plan does not allow API access or more databases |
| 500 | AGENT_ERROR | The VPS agent failed to create the database |
⌘I