Logo

Command Palette

Search for a command to run...

GET/stacks/:stack_id/server_groups/:server_group_id/database_users

Optional Parameters

stack_id
Stack ID
server_group_id
Server group ID
page
Page number for pagination (defaults to 1, minimum 1)
show_password
Include password in response (requires edit permissions)

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

Optionally includes password information if the user has edit permissions and explicitly requests it via the show_password parameter. This endpoint triggers an asynchronous info retrieval operation to ensure database user information is current.

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

Request

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

Response

{
  "response": [
    {
      "uid": "user_abc123",
      "username": "app_user",
      "databases": [
        "app_production",
        "app_staging"
      ],
      "user_type": "application",
      "created_at": "2023-01-15T10:30:00Z"
    },
    {
      "uid": "user_def456",
      "username": "readonly_user",
      "databases": [
        "app_production"
      ],
      "user_type": "readonly",
      "created_at": "2023-01-10T14:20:00Z"
    }
  ],
  "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/database_users

Optional Parameters

stack_id
Stack ID
server_group_id
Server group ID
username
Database username to create
database_ids
Array of database UIDs to grant access to
user_type
User type - must be one of the supported types

Creates a new database user with the specified username and access to the selected databases.

This operation is performed asynchronously and returns an async action object to track progress. The user will be created with a randomly generated secure password. 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 user creation
400Bad Request - Invalid username, user type, 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/database_users
curl -X POST \
  "https://app.cloud66.com/api/3/stacks/:stack_id/server_groups/:server_group_id/database_users" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Response

{
  "response": {
    "id": 789,
    "status": "queued",
    "action_type": "database_user_create",
    "resource_type": "database_user",
    "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"
  }
}
POST/stacks/:stack_id/server_groups/:server_group_id/database_users/:id/regenerate_password

Optional Parameters

stack_id
Stack ID
server_group_id
Server group ID
id
Database user UID

Changes the password for the specified database user.

The new password is automatically generated and securely stored. This operation is performed asynchronously and returns an async action object to track progress. The new password will be available through the database user details once the operation completes.

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

Response Status Codes
Status CodeDescription
200Success - Returns async action to track password regeneration
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 user not found

Request

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

Response

{
  "response": {
    "id": 791,
    "status": "queued",
    "action_type": "database_user_password_change",
    "resource_type": "database_user",
    "resource_id": "user_abc123",
    "started_via": "api",
    "started_at": null,
    "finished_at": null,
    "finished_success": null,
    "finished_message": null,
    "created_at": "2023-01-15T10:40:00Z",
    "updated_at": "2023-01-15T10:40:00Z"
  }
}
DELETE/stacks/:stack_id/server_groups/:server_group_id/database_users/:id

Optional Parameters

stack_id
Stack ID
server_group_id
Server group ID
id
Database user UID

Permanently removes the specified database user from all associated databases.

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 user 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 user not found

Request

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

Response

{
  "response": {
    "id": 790,
    "status": "queued",
    "action_type": "database_user_delete",
    "resource_type": "database_user",
    "resource_id": "user_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"
  }
}