ScaleBox Docs

Users API

Complete API reference for managing users and user profiles. Handle user creation, updates, password management, and profile information within your ScaleBox account.

Authentication Required: All API requests require authentication using the X-API-Key header with your API key.

User Concepts

Users in ScaleBox represent individual people or service accounts that can access and manage resources within an account.

User Management Features

  • Profile Management - Update display names, descriptions, and contact information
  • Password Security - Secure password management with reset capabilities
  • Role-Based Access - Root users and regular users with different permission levels
  • Account Hierarchy - Users belong to accounts and can manage resources within their scope

User Roles

ScaleBox supports different user roles with varying levels of access and permissions:

RoleDescription
userRegular user with standard access to their own resources
adminSystem administrator with elevated privileges across all accounts

Root User Privileges: Root users can manage all users within their account, including creating, updating, and deleting other users. Regular users can only manage their own profile.

User Statuses

Users can be in different states that control their access to the system:

StatusDescription
activeUser account is active and can access the system
pending_verificationUser account is created but email verification is pending
suspendedUser account is temporarily suspended
disabledUser account is disabled and cannot access the system

API Endpoints

Get Profile

GET /v1/users/me

Get current user profile information.

Example

curl -X GET https://api.scalebox.dev/v1/users/me \
  -H "X-API-Key: sk-1234567890abcdef1234567890abcdef12345678"

Response

{
  "user_id": "usr-abc123def456789",
  "username": "john.developer",
  "email": "john@example.com",
  "display_name": "John Developer",
  "description": "Full-stack developer specializing in cloud applications",
  "account_id": "acc-123456789",
  "is_root_user": true,
  "role": "user",
  "status": "active",
  "email_verified": true,
  "created_at": "2024-01-10T09:30:00Z",
  "updated_at": "2024-01-15T14:22:00Z",
  "last_login_at": "2024-01-15T08:45:00Z"
}

Update Profile

PUT /v1/users/me

Update current user profile fields (display_name, description).

Request Parameters

NameTypeRequiredDescription
display_namestringNoUpdated display name for the user
descriptionstringNoUpdated user description or bio

Example

curl -X PUT https://api.scalebox.dev/v1/users/me \
  -H "X-API-Key: sk-1234567890abcdef1234567890abcdef12345678" \
  -H "Content-Type: application/json" \
  -d '{
    "display_name": "John Developer",
    "description": "Full-stack developer specializing in cloud applications"
  }'

List Users

GET /v1/user-management/users

List all users in account (root users only).

Request Parameters

NameTypeRequiredDefaultDescription
limitintegerNo50Number of users to return (1-100)
offsetintegerNo0Number of users to skip for pagination

Example

curl -X GET "https://api.scalebox.dev/v1/user-management/users?limit=20" \
  -H "X-API-Key: sk-1234567890abcdef1234567890abcdef12345678"

Response

{
  "users": [
    {
      "user_id": "usr-abc123def456789",
      "username": "john.developer",
      "email": "john@example.com", 
      "display_name": "John Developer",
      "account_id": "acc-123456789",
      "is_root_user": true,
      "role": "user",
      "status": "active",
      "email_verified": true,
      "created_at": "2024-01-10T09:30:00Z",
      "last_login_at": "2024-01-15T08:45:00Z"
    },
    {
      "user_id": "usr-def456ghi789012",
      "username": "jane.developer",
      "email": "jane@example.com",
      "display_name": "Jane Developer", 
      "account_id": "acc-123456789",
      "is_root_user": false,
      "role": "user",
      "status": "active",
      "email_verified": true,
      "created_at": "2024-01-12T11:15:00Z",
      "last_login_at": "2024-01-14T16:30:00Z"
    }
  ],
  "pagination": {
    "offset": 0,
    "limit": 20,
    "total": 2,
    "has_more": false
  }
}

Create User

POST /v1/user-management/users

Create a new user in account (root users only).

Request Parameters

NameTypeRequiredDefaultDescription
usernamestringYes-Unique username (3-50 characters)
emailstringYes-Valid email address for the user
display_namestringNo-Display name for the user
passwordstringNo-Initial password (if not provided, user will need to set via email verification)
is_root_userbooleanNofalseWhether user should have root privileges in the account

Example

curl -X POST https://api.scalebox.dev/v1/user-management/users \
  -H "X-API-Key: sk-1234567890abcdef1234567890abcdef12345678" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "jane.developer",
    "email": "jane@example.com",
    "display_name": "Jane Developer",
    "is_root_user": false
  }'

Response

{
  "user_id": "usr-def456ghi789012",
  "username": "jane.developer",
  "email": "jane@example.com",
  "display_name": "Jane Developer",
  "account_id": "acc-123456789",
  "is_root_user": false,
  "role": "user",
  "status": "pending_verification",
  "email_verified": false,
  "created_at": "2024-01-15T10:30:00Z",
  "verification_required": true,
  "verification_email_sent": true
}

Get User

GET /v1/user-management/users/{user_id}

Get detailed information about a specific user (root users only).

Example

curl -X GET https://api.scalebox.dev/v1/user-management/users/usr-abc123def456789 \
  -H "X-API-Key: sk-1234567890abcdef1234567890abcdef12345678"

Update User

PUT /v1/user-management/users/{user_id}

Update user information (root users only).

Request Parameters

NameTypeRequiredDescription
usernamestringNoUpdated username
emailstringNoUpdated email address
display_namestringNoUpdated display name
is_root_userbooleanNoUpdated root user status

Example

curl -X PUT https://api.scalebox.dev/v1/user-management/users/usr-abc123def456789 \
  -H "X-API-Key: sk-1234567890abcdef1234567890abcdef12345678" \
  -H "Content-Type: application/json" \
  -d '{
    "display_name": "Jane Smith",
    "email": "jane.smith@example.com"
  }'

Delete User

DELETE /v1/user-management/users/{user_id}

Delete a user from account (root users only).

Example

curl -X DELETE https://api.scalebox.dev/v1/user-management/users/usr-abc123def456789 \
  -H "X-API-Key: sk-1234567890abcdef1234567890abcdef12345678"

Reset User Password

POST /v1/user-management/users/{user_id}/reset-password

Reset password for a specific user (root users only).

Request Parameters

NameTypeRequiredDescription
new_passwordstringNoNew password (if not provided, user will get email verification)

Example

curl -X POST https://api.scalebox.dev/v1/user-management/users/usr-abc123def456789/reset-password \
  -H "X-API-Key: sk-1234567890abcdef1234567890abcdef12345678" \
  -H "Content-Type: application/json" \
  -d '{
    "new_password": "newSecurePassword123!"
  }'

Response

{
  "message": "Password reset successfully",
  "user_id": "usr-abc123def456789",
  "reset_method": "direct",
  "password_changed": true
}

Change Password

POST /v1/user-management/change-password

Change current user's password.

Request Parameters

NameTypeRequiredDescription
current_passwordstringYesCurrent password for verification
new_passwordstringYesNew password to set

Example

curl -X POST https://api.scalebox.dev/v1/user-management/change-password \
  -H "X-API-Key: sk-1234567890abcdef1234567890abcdef12345678" \
  -H "Content-Type: application/json" \
  -d '{
    "current_password": "currentPassword123",
    "new_password": "newSecurePassword123!"
  }'

Request Password Reset

POST /v1/user-management/request-password-reset

Request password reset via email.

Request Parameters

NameTypeRequiredDescription
emailstringYesEmail address for password reset

Example

curl -X POST https://api.scalebox.dev/v1/user-management/request-password-reset \
  -H "X-API-Key: sk-1234567890abcdef1234567890abcdef12345678" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com"
  }'

Password Management

ScaleBox provides secure password management with multiple options for password updates and resets:

FeatureDescription
Self-Service Password ChangeUsers can change their own password using their current password for verification
Admin Password ResetRoot users can reset passwords for other users in their account
Email-Based ResetRequest password reset via email for secure password recovery
Password RequirementsPasswords must meet security requirements including length and complexity

Permission Model

The user management API follows a hierarchical permission model:

PermissionDescription
Self-ManagementAll users can view and update their own profile information
Root User PrivilegesRoot users can manage all users within their account
Account IsolationUsers can only access and manage users within their own account
Admin OversightSystem administrators have elevated privileges across all accounts

Error Handling

Common error scenarios and how to handle them:

ScenarioDescription
Username/Email ConflictsReturns 409 Conflict when username or email already exists
Permission DeniedReturns 403 Forbidden when trying to access resources without proper permissions
Invalid PasswordReturns 400 Bad Request for password changes with incorrect current password
User Not FoundReturns 404 Not Found when specified user doesn't exist or isn't accessible

HTTP Status Codes

CodeDescription
200Success
201Created
400Bad Request
401Unauthorized
403Forbidden
404Not Found
409Conflict
500Internal Server Error

On this page