Skip to main content
This API is available on self-hosted deployments only. See Self-Hosting for setup instructions and User Management: OIDC Integration for authentication configuration.

How This Helps

The User Management API provides programmatic control over user accounts on self-hosted deployments. Create users, assign roles, reset passwords, manage sessions, and control workspace membership — all through REST endpoints backed by Keycloak.

Prerequisites

  • A self-hosted Visual Layer deployment with authentication enabled (DISABLE_AUTH: false).
  • An authenticated session with a user that has the Keycloak manage-users realm role (for write operations) or view-users role (for read operations).
  • User management enabled (automatic when RUN_MODE=ONPREM and auth is not disabled).

List Users

Retrieve all users registered in the system.
GET /api/v1/keycloak/admin/users

Query Parameters

ParameterTypeRequiredDescription
searchstringNoFilter by username or name.
max_resultsintegerNoMaximum results to return (1–1000, default: 100).
firstintegerNoOffset for pagination (default: 0).

Example

curl "https://<your-vl-domain>/api/v1/keycloak/admin/users?search=rachel&max_results=50"

Response

{
  "users": [
    {
      "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
      "username": "rachel",
      "firstName": "Rachel",
      "lastName": "Cheyfitz",
      "enabled": true,
      "createdTimestamp": 1765725376466,
      "roles": ["manage-users", "view-users"],
      "lastAccess": 1774785258000
    }
  ],
  "total": 1
}

User Object Fields

FieldTypeDescription
idstringKeycloak user ID.
usernamestringLogin username.
firstNamestring or nullFirst name.
lastNamestring or nullLast name.
enabledbooleanWhether the account is active. Disabled users cannot log in.
createdTimestampinteger or nullAccount creation time in milliseconds since epoch.
rolesarray of stringsKeycloak realm roles assigned to the user.
lastAccessinteger or nullMost recent session activity in milliseconds since epoch.

Get User

Retrieve details for a specific user.
GET /api/v1/keycloak/admin/users/{user_id}

Path Parameters

ParameterTypeRequiredDescription
user_idstringYesKeycloak user ID or Visual Layer user ID (UUID). Auto-resolved if a VL user ID is provided.

Example

curl "https://<your-vl-domain>/api/v1/keycloak/admin/users/<user_id>"

Response

Returns a single User object.

Create User

Create a new user account. This is an atomic operation — the user is created in both Keycloak and the Visual Layer database. If either step fails, the operation is rolled back.
POST /api/v1/keycloak/admin/users
Content-Type: application/json

Request Body

FieldTypeRequiredDescription
usernamestringYesLogin username (3–255 characters, no whitespace).
passwordstringYesInitial password (minimum 8 characters).
firstNamestringYesFirst name (1–255 characters).
lastNamestringYesLast name (1–255 characters).
enabledbooleanNoWhether the account is active (default: true).
workspace_rolestringNoWorkspace role to assign: admin, editor, or viewer (default: viewer).

Example

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "username": "alex.dev",
    "password": "secureP@ss123",
    "firstName": "Alex",
    "lastName": "Developer",
    "workspace_role": "editor"
  }' \
  "https://<your-vl-domain>/api/v1/keycloak/admin/users"

Response (201 Created)

Returns the created User object.
Promoting a user to the admin role in single-workspace mode demotes all existing admins to editor. Only one admin is allowed per workspace. The demoted admins are logged out and must re-authenticate.

Update User

Update the username or enabled status of an existing user.
PATCH /api/v1/keycloak/admin/users/{user_id}
Content-Type: application/json

Path Parameters

ParameterTypeRequiredDescription
user_idstringYesKeycloak user ID or Visual Layer user ID.

Request Body

FieldTypeRequiredDescription
usernamestringNoNew username (3–255 characters, no whitespace).
enabledbooleanNoSet to false to disable the account.
Include at least one field.

Example

curl -X PATCH \
  -H "Content-Type: application/json" \
  -d '{"enabled": false}' \
  "https://<your-vl-domain>/api/v1/keycloak/admin/users/<user_id>"

Response

Returns the updated User object.

Delete User

Permanently remove a user account. This is an atomic operation that cleans up all associated data.
DELETE /api/v1/keycloak/admin/users/{user_id}

Path Parameters

ParameterTypeRequiredDescription
user_idstringYesKeycloak user ID or Visual Layer user ID.

Example

curl -X DELETE \
  "https://<your-vl-domain>/api/v1/keycloak/admin/users/<user_id>"

Response

{
  "message": "User deleted successfully"
}
The deletion process:
  1. Transfers ownership of all datasets owned by the deleted user to the admin performing the deletion.
  2. Removes all workspace membership records.
  3. Deletes the user from Keycloak.
  4. Deletes the shadow user record from the Visual Layer database.
You cannot delete your own account. Attempting to do so returns a 400 error. In single-workspace mode, you also cannot delete the last remaining admin — promote another user first.

Reset Password

Reset a user’s password. The new password is set as temporary — the user must change it on next login.
POST /api/v1/keycloak/admin/users/{user_id}/reset-password
Content-Type: application/json

Path Parameters

ParameterTypeRequiredDescription
user_idstringYesKeycloak user ID or Visual Layer user ID.

Request Body

FieldTypeRequiredDescription
passwordstringYesNew temporary password (minimum 8 characters).

Example

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"password": "newTempP@ss456"}' \
  "https://<your-vl-domain>/api/v1/keycloak/admin/users/<user_id>/reset-password"

Response

{
  "message": "Password reset successfully"
}
The user is automatically logged out from all active sessions and must re-authenticate with the new temporary password.

Logout User

Terminate all active sessions for a user, forcing them to re-authenticate.
POST /api/v1/keycloak/admin/users/{user_id}/logout

Path Parameters

ParameterTypeRequiredDescription
user_idstringYesKeycloak user ID or Visual Layer user ID.

Example

curl -X POST \
  "https://<your-vl-domain>/api/v1/keycloak/admin/users/<user_id>/logout"

Response

{
  "message": "User logged out successfully"
}

Get User Sessions

List all active sessions for a user.
GET /api/v1/keycloak/admin/users/{user_id}/sessions

Path Parameters

ParameterTypeRequiredDescription
user_idstringYesKeycloak user ID or Visual Layer user ID.

Example

curl "https://<your-vl-domain>/api/v1/keycloak/admin/users/<user_id>/sessions"

Response

{
  "sessions": [
    {
      "id": "session-uuid-here",
      "username": "rachel",
      "ipAddress": "192.168.1.100",
      "start": 1774785258000,
      "lastAccess": 1774786000000,
      "clients": {}
    }
  ],
  "total": 1
}

Update User Roles

Replace all realm roles assigned to a user.
PUT /api/v1/keycloak/admin/users/{user_id}/roles
Content-Type: application/json

Path Parameters

ParameterTypeRequiredDescription
user_idstringYesKeycloak user ID or Visual Layer user ID.

Request Body

FieldTypeRequiredDescription
rolesarray of stringsYesComplete list of realm role names to assign. Replaces all existing roles.

Example

curl -X PUT \
  -H "Content-Type: application/json" \
  -d '{"roles": ["view-users", "query-users"]}' \
  "https://<your-vl-domain>/api/v1/keycloak/admin/users/<user_id>/roles"

Response

Returns the updated User object with the new roles.
This endpoint replaces all existing roles. Include every role the user should have, not just the ones you want to add. Invalid role names are silently ignored.

Roles Reference

Workspace Roles

Workspace roles control what a user can do within Visual Layer. Assign these via the workspace_role field when creating users, or through the Workspace Members API.
RolePermissions
AdminFull control — manage users, change roles, create and delete datasets, configure settings.
EditorCreate and edit datasets, run enrichment, export data. Cannot manage users or settings.
ViewerRead-only access — explore datasets, run searches, view results. Cannot modify data.

Keycloak Realm Roles

These roles control access to the User Management API itself. They are managed through Keycloak and determine which API endpoints a user can call.
RoleGrants Access To
manage-usersCreate, update, delete users. Reset passwords. Manage roles.
view-usersList users, get user details, view sessions.
query-usersQuery users (required for full user management).
query-groupsQuery user groups (required for full user management).

Python Example

import requests

VL_BASE_URL = "https://<your-vl-domain>"
session = requests.Session()
# Authenticate via OIDC flow first, then use the session cookie

# List all users
resp = session.get(f"{VL_BASE_URL}/api/v1/keycloak/admin/users")
resp.raise_for_status()
users = resp.json()
print(f"Total users: {users['total']}")
for user in users["users"]:
    status = "active" if user["enabled"] else "disabled"
    print(f"  {user['username']} ({status}) — roles: {', '.join(user['roles'])}")

# Create a new editor
resp = session.post(
    f"{VL_BASE_URL}/api/v1/keycloak/admin/users",
    json={
        "username": "new.analyst",
        "password": "initialP@ss789",
        "firstName": "New",
        "lastName": "Analyst",
        "workspace_role": "editor",
    },
)
resp.raise_for_status()
new_user = resp.json()
print(f"\nCreated user: {new_user['username']} (ID: {new_user['id']})")

# Disable a user account
resp = session.patch(
    f"{VL_BASE_URL}/api/v1/keycloak/admin/users/{new_user['id']}",
    json={"enabled": False},
)
resp.raise_for_status()
print(f"Disabled user: {resp.json()['username']}")

Response Codes

See Error Handling for the error response format.
HTTP CodeMeaning
200Request successful.
201User created successfully.
400Validation error, self-deletion attempt, or last admin deletion attempt.
401Unauthorized — no valid session or token.
403Forbidden — user management not enabled, or insufficient Keycloak roles.
404User not found.
500Internal Server Error — contact support if this persists.

OIDC Integration

Configure your Identity Provider for Single Sign-On with Visual Layer.

Workspaces & Organizations

Manage workspace membership and roles programmatically.

Admin Settings

View and update runtime configuration on self-hosted deployments.

Self-Hosting Setup

Install and configure a self-hosted Visual Layer deployment.