Logo

Command Palette

Search for a command to run...

GET/stacks/:stack_id/server_groups/:server_group_id/databases

Optional Parameters

stack_id
Stack ID
server_group_id
Server group ID
page
Page number for pagination (defaults to 1, minimum 1)

Returns a paginated collection of databases associated with the specified server group.

This endpoint triggers an asynchronous info retrieval operation to ensure database information is current before returning the results. Only works with server groups that support database operations.

Response Status Codes
Status CodeDescription
200Success - Returns paginated list of databases
400Bad Request - Server group does not support database operations
401Unauthorized - Authentication failed or missing OAuth token
403Forbidden - OAuth token lacks required `public` scope
404Not Found - Stack or server group not found

Request

GET
/stacks/:stack_id/server_groups/:server_group_id/databases
curl -X GET \
  "https://app.cloud66.com/api/3/stacks/:stack_id/server_groups/:server_group_id/databases" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Response

{
  "response": [
    {
      "uid": "db_abc123",
      "name": "app_production",
      "charset": "utf8mb4",
      "collation": "utf8mb4_unicode_ci",
      "size_bytes": 104857600,
      "created_at": "2023-01-15T10:30:00Z",
      "users": [
        "app_user",
        "readonly_user"
      ]
    },
    {
      "uid": "db_def456",
      "name": "analytics_db",
      "charset": "utf8mb4",
      "collation": "utf8mb4_unicode_ci",
      "size_bytes": 52428800,
      "created_at": "2023-01-10T14:20:00Z",
      "users": [
        "analytics_user"
      ]
    }
  ],
  "count": 2,
  "pagination": {
    "previous": null,
    "next": null,
    "current": 1,
    "per_page": 30,
    "count": 2,
    "pages": 1
  }
}
POST/stacks/:stack_id/server_groups/:server_group_id/databases

Optional Parameters

stack_id
Stack ID
server_group_id
Server group ID
database_name
Name for the new database
database_user_ids
Array of database user UIDs to grant access to the new database

Creates a new database with the specified name and optionally assigns database users to it.

This operation is performed asynchronously and returns an async action object to track progress. Only works with server groups that support database operations.

The async action can be monitored using the Get Stack Action endpoint to track the creation progress.

Response Status Codes
Status CodeDescription
200Success - Returns async action to track database creation
400Bad Request - Invalid database name or server group does not support database operations
401Unauthorized - Authentication failed or missing OAuth token
403Forbidden - OAuth token lacks required `admin` scope or insufficient permissions
404Not Found - Stack or server group not found

Request

POST
/stacks/:stack_id/server_groups/:server_group_id/databases
curl -X POST \
  "https://app.cloud66.com/api/3/stacks/:stack_id/server_groups/:server_group_id/databases" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Response

{
  "response": {
    "id": 792,
    "status": "queued",
    "action_type": "database_create",
    "resource_type": "database",
    "resource_id": null,
    "started_via": "api",
    "started_at": null,
    "finished_at": null,
    "finished_success": null,
    "finished_message": null,
    "created_at": "2023-01-15T10:30:00Z",
    "updated_at": "2023-01-15T10:30:00Z"
  }
}
DELETE/stacks/:stack_id/server_groups/:server_group_id/databases/:id

Optional Parameters

stack_id
Stack ID
server_group_id
Server group ID
id
Database UID

Permanently removes the specified database and all its data.

The async action can be monitored using the Get Stack Action endpoint to track the deletion progress.

Response Status Codes
Status CodeDescription
200Success - Returns async action to track database deletion
400Bad Request - Server group does not support database operations
401Unauthorized - Authentication failed or missing OAuth token
403Forbidden - OAuth token lacks required `admin` scope or insufficient permissions
404Not Found - Stack, server group, or database not found

Request

DELETE
/stacks/:stack_id/server_groups/:server_group_id/databases/:id
curl -X DELETE \
  "https://app.cloud66.com/api/3/stacks/:stack_id/server_groups/:server_group_id/databases/:id" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Response

{
  "response": {
    "id": 793,
    "status": "queued",
    "action_type": "database_delete",
    "resource_type": "database",
    "resource_id": "db_abc123",
    "started_via": "api",
    "started_at": null,
    "finished_at": null,
    "finished_success": null,
    "finished_message": null,
    "created_at": "2023-01-15T10:35:00Z",
    "updated_at": "2023-01-15T10:35:00Z"
  }
}