Databases API
PostgreSQL and MariaDB databases. Authenticate with a Personal Access Token carrying the database:read, database:write or database:firewall scope.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /v1/databases | List databases |
POST | /v1/databases | Create database |
GET | /v1/databases/tiers | List 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}/firewall | List firewall rules |
POST | /v1/databases/{db_type}/{db_name}/firewall | Add 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:
| Field | Type | Description |
|---|---|---|
databases | array | |
total | integer |
Example:
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:
| Field | Type | Description |
|---|---|---|
db_name | string | Required. Database name: lowercase letters, digits and underscore |
db_type | string | Required. Values: postgresql, mariadb |
description | string | |
tier | string | encrypted runs on encrypted storage at the protected storage backend Values: standard, encrypted |
Example:
{
"db_name": "webapp_prod_db",
"db_type": "postgresql",
"description": "Production database",
"tier": "standard"
}Response:
| Field | Type | Description |
|---|---|---|
ok | boolean | |
created | boolean | |
friendly_name | string | |
technical_name | string | |
db_type | string | Values: postgresql, mariadb |
host | string | |
port | integer | |
username | string | |
password | string | |
connection_string | string |
Example:
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:
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:
| Field | Type | Description |
|---|---|---|
db_name | string | Technical name |
friendly_name | string | The name you chose at creation |
technical_name | string | |
db_type | string | Values: postgresql, mariadb |
host | string | |
port | integer | |
status | string | As the database node reports it; unknown when the node does not answer |
size_mb | number | |
created_at | string | |
description | string |
Example:
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:
| Field | Type | Description |
|---|---|---|
ok | boolean | |
deleted | boolean | |
db_name | string | Technical name |
message | string |
Example:
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:
| Field | Type | Description |
|---|---|---|
rules | array | The rules as the database node reports them: rule_id, ip_address, port, description and created_at, with the database name and type |
total | integer |
Example:
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:
| Field | Type | Description |
|---|---|---|
ip_address | string | Required. IPv4 address to allow |
description | string |
Response:
| Field | Type | Description |
|---|---|---|
rule_id | string | |
ip_address | string | |
port | integer | |
description | string | |
created_at | string |
Example:
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:
| Field | Type | Description |
|---|---|---|
ok | boolean | |
message | string | |
rule_id | string |
Example:
curl -X DELETE https://api.wayscloud.services/v1/databases/{db_type}/{db_name}/firewall/{rule_id} \
-H "X-API-Key: YOUR_API_KEY"