Skip to content

Databases API ​

PostgreSQL and MariaDB databases. Authenticate with a Personal Access Token carrying the database:read, database:write or database:firewall scope.

Endpoints ​

MethodPathDescription
GET/v1/databasesList databases
POST/v1/databasesCreate database
GET/v1/databases/tiersList tiers
GET/v1/databases/{db_type}/{db_name}Get database
DELETE/v1/databases/{db_type}/{db_name}Delete database
GET/v1/databases/{db_type}/{db_name}/firewallList firewall rules
POST/v1/databases/{db_type}/{db_name}/firewallAdd firewall rule
DELETE/v1/databases/{db_type}/{db_name}/firewall/{rule_id}Remove firewall rule

GET /v1/databases ​

List databases

List the databases on your account. Requires the database:read scope.

Response:

FieldTypeDescription
databasesarray
totalinteger

Example:

bash
curl https://api.wayscloud.services/v1/databases \
  -H "X-API-Key: YOUR_API_KEY"

POST /v1/databases ​

Create database

Create a PostgreSQL or MariaDB database. The password is returned once, in this response. Requires the database:write scope.

Request Body:

FieldTypeDescription
db_namestringRequired. Database name: lowercase letters, digits and underscore
db_typestringRequired. Values: postgresql, mariadb
descriptionstring
tierstringencrypted runs on encrypted storage at the protected storage backend Values: standard, encrypted

Example:

json
{
  "db_name": "webapp_prod_db",
  "db_type": "postgresql",
  "description": "Production database",
  "tier": "standard"
}

Response:

FieldTypeDescription
okboolean
createdboolean
friendly_namestring
technical_namestring
db_typestringValues: postgresql, mariadb
hoststring
portinteger
usernamestring
passwordstring
connection_stringstring

Example:

bash
curl -X POST https://api.wayscloud.services/v1/databases \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{...}'

GET /v1/databases/tiers ​

List tiers

List the tiers you can create databases in. Requires the database:read scope.

Response:

Example:

bash
curl https://api.wayscloud.services/v1/databases/tiers \
  -H "X-API-Key: YOUR_API_KEY"

GET /v1/databases/{db_type}/ ​

Get database

Get a database with its host, port, status and size. Requires the database:read scope.

Response:

FieldTypeDescription
db_namestringTechnical name
friendly_namestringThe name you chose at creation
technical_namestring
db_typestringValues: postgresql, mariadb
hoststring
portinteger
statusstringAs the database node reports it; unknown when the node does not answer
size_mbnumber
created_atstring
descriptionstring

Example:

bash
curl https://api.wayscloud.services/v1/databases/{db_type}/{db_name} \
  -H "X-API-Key: YOUR_API_KEY"

DELETE /v1/databases/{db_type}/ ​

Delete database

Delete a database and all its data. This cannot be undone. Requires the database:write scope.

Response:

FieldTypeDescription
okboolean
deletedboolean
db_namestringTechnical name
messagestring

Example:

bash
curl -X DELETE https://api.wayscloud.services/v1/databases/{db_type}/{db_name} \
  -H "X-API-Key: YOUR_API_KEY"

GET /v1/databases/{db_type}/{db_name}/firewall ​

List firewall rules

List the IP addresses allowed to connect. Requires the database:firewall scope.

Response:

FieldTypeDescription
rulesarrayThe rules as the database node reports them: rule_id, ip_address, port, description and created_at, with the database name and type
totalinteger

Example:

bash
curl https://api.wayscloud.services/v1/databases/{db_type}/{db_name}/firewall \
  -H "X-API-Key: YOUR_API_KEY"

POST /v1/databases/{db_type}/{db_name}/firewall ​

Add firewall rule

Allow an IPv4 address to connect. The rule applies immediately. Requires the database:firewall scope.

Request Body:

FieldTypeDescription
ip_addressstringRequired. IPv4 address to allow
descriptionstring

Response:

FieldTypeDescription
rule_idstring
ip_addressstring
portinteger
descriptionstring
created_atstring

Example:

bash
curl -X POST https://api.wayscloud.services/v1/databases/{db_type}/{db_name}/firewall \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{...}'

DELETE /v1/databases/{db_type}/{db_name}/firewall/ ​

Remove firewall rule

Remove an allowed IP address. Requires the database:firewall scope.

Response:

FieldTypeDescription
okboolean
messagestring
rule_idstring

Example:

bash
curl -X DELETE https://api.wayscloud.services/v1/databases/{db_type}/{db_name}/firewall/{rule_id} \
  -H "X-API-Key: YOUR_API_KEY"