Users

Manage organization users and team members

Overview

Users represent team members in your organization. Each user has a role that determines their access level and permissions. Users can be assigned to appointments, services, and other organizational tasks.

User Roles

RoleDescription
ADMINFull access to all features including organization settings, billing, and user management
USERStandard access for technicians and team members

User Scopes

Scopes provide fine-grained access control for users. Each user can have multiple scopes assigned that determine what actions they can perform within the application.

Appointment Scopes

ScopeDescription
read:own:appointmentView appointments assigned to the user
read:all:appointmentView all appointments in the organization
write:appointmentCreate and update appointments
delete:appointmentDelete appointments
communication:appointmentSend communications related to appointments

Customer Scopes

ScopeDescription
read:customerView customer information
read:customer-detailsView detailed customer information
read:customer:telephone-numberView customer phone numbers
write:customerCreate and update customers
delete:customerDelete customers

Service Scopes

ScopeDescription
read:serviceView service records
read:pricing:serviceView service pricing information
write:serviceCreate and update services
delete:serviceDelete services
communication:serviceSend communications related to services
upload-from-gallery:serviceUpload photos from device gallery for services

Invoice Scopes

ScopeDescription
read:invoiceView invoices
read:pricing:invoiceView invoice pricing details
write:invoiceCreate and update invoices
delete:invoiceDelete invoices

Inventory Scopes

ScopeDescription
read:inventoryView inventory items and stock levels
write:inventoryCreate and update inventory items
delete:inventoryDelete inventory items

Organization Scopes

ScopeDescription
update:organizationUpdate organization settings
write:reportsGenerate and export reports

List Users

Retrieve a list of users in the organization.

query InfiniteUsers($first: Int!, $after: String, $filter: UserFilter) {
  infiniteUsers(first: $first, after: $after, filter: $filter) {
    edges {
      node {
        id
        email
        firstName
        lastName
        role
        status
        lastLoginAt
      }
      cursor
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}

# Variables
{
  "first": 20,
  "filter": {
    "role": "USER",
    "status": "ACTIVE"
  }
}

Response:

{
  "data": {
    "infiniteUsers": {
      "edges": [
        {
          "node": {
            "id": "user_789",
            "email": "mike@example.com",
            "firstName": "Mike",
            "lastName": "Johnson",
            "role": "USER",
            "status": "ACTIVE",
            "lastLoginAt": "2024-01-20T08:00:00Z"
          },
          "cursor": "eyJpZCI6InVzZXJfNzg5In0="
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "endCursor": "eyJpZCI6InVzZXJfNzg5In0="
      }
    }
  }
}

Get Current User

Retrieve the currently authenticated user.

query Me {
  me {
    id
    email
    firstName
    lastName
    phone
    role
    status
    avatar
    timezone
    organization {
      id
      name
    }
    lastLoginAt
    createdAt
  }
}

Response:

{
  "data": {
    "me": {
      "id": "user_001",
      "email": "admin@example.com",
      "firstName": "Admin",
      "lastName": "User",
      "phone": "555-0100",
      "role": "ADMIN",
      "status": "ACTIVE",
      "avatar": "https://storage.example.com/avatars/user_001.jpg",
      "timezone": "America/Chicago",
      "organization": {
        "id": "org_001",
        "name": "Austin Pool Services"
      },
      "lastLoginAt": "2024-01-20T09:00:00Z",
      "createdAt": "2023-01-15T10:00:00Z"
    }
  }
}

Create User

Invite a new user to the organization.

mutation CreateUser($input: CreateUserInput!) {
  createUser(input: $input) {
    id
    email
    firstName
    lastName
    role
    status
    createdAt
  }
}

# Variables
{
  "input": {
    "email": "newtech@example.com",
    "firstName": "Sarah",
    "lastName": "Williams",
    "phone": "555-0201",
    "role": "USER"
  }
}

Response:

{
  "data": {
    "createUser": {
      "id": "user_010",
      "email": "newtech@example.com",
      "firstName": "Sarah",
      "lastName": "Williams",
      "role": "USER",
      "status": "PENDING",
      "createdAt": "2024-01-20T14:00:00Z"
    }
  }
}

Update User

Update user information or role.

mutation UpdateUser($id: ID!, $input: UpdateUserInput!) {
  updateUser(id: $id, input: $input) {
    id
    firstName
    lastName
    role
    status
    updatedAt
  }
}

# Variables
{
  "id": "user_010",
  "input": {
    "role": "ADMIN",
    "phone": "555-0202"
  }
}

Response:

{
  "data": {
    "updateUser": {
      "id": "user_010",
      "firstName": "Sarah",
      "lastName": "Williams",
      "role": "ADMIN",
      "status": "ACTIVE",
      "updatedAt": "2024-01-25T10:00:00Z"
    }
  }
}

Delete User

Deactivate a user (soft delete).

mutation DeleteUser($id: ID!) {
  deleteUser(id: $id) {
    success
    message
  }
}

# Variables
{
  "id": "user_010"
}

Response:

{
  "data": {
    "deleteUser": {
      "success": true,
      "message": "User deactivated successfully"
    }
  }
}

Field Reference

FieldTypeDescription
idID!Unique identifier
emailString!Email address (unique)
firstNameString!First name
lastNameString!Last name
phoneString(nullable)Phone number
roleUserRole!Role (ADMIN, USER)
statusUserStatus!Status (ACTIVE, INACTIVE, PENDING)
avatarString(nullable)Profile picture URL
timezoneString(nullable)User's timezone
lastLoginAtDateTime(nullable)Last login timestamp
organizationOrganization!Associated organization
createdAtDateTime!Creation timestamp
updatedAtDateTime!Last update timestamp