Loopwise Docs
Admin APIQueries

Users Query

How to query user data in the Loopwise Admin API

Note: The Loopwise Admin API is currently under development and not yet available for public use. This documentation is provided for preview purposes only.

Overview

The Users API allows you to retrieve information about users in your school. You can list all users, get details for a specific user, and access related data.

Available Queries

users

Returns a paginated list of users for the school.

Parameters:

ParameterTypeDescription
filterUserFilterFilter criteria (see Filtering)
pageIntPage number for pagination
perPageIntNumber of items per page (default: 20, max: 50)
limitIntAlternative to perPage

Returns:

  • UserPage object with:
    • nodes: Array of User objects
    • currentPage: Current page number
    • hasNextPage: Whether there are more pages
    • hasPreviousPage: Whether there are previous pages
    • nodesCount: Total number of items in the current page
    • totalPages: Total number of pages

Example:

query {
  users(
    page: 1
    perPage: 10
  ) {
    nodes {
      id
      name
      email
      phoneNumber
    }
    currentPage
    hasNextPage
    totalPages
  }
}

User Object

The User object contains the following fields based on the schema:

FieldTypeDescription
idString!Unique identifier (UUID)
nameStringFull name of the user
emailStringEmail address of the user
phoneNumberStringPhone number of the user
identities[Identity]Third-party authentication identities (see Identities)

Detailed Query Structure

Below is a comprehensive view of fields available in the users query based on the schema:

query {
  users(
    filter: {
      name: { eq: "Smith" }
    }
    page: 1
    perPage: 20
  ) {
    # User metadata
    nodes {
      id                          # Unique identifier (String!)
      name                        # Full name (String!)
      email                       # Email address (String!)
      phoneNumber                 # Phone number (String)

      # Third-party authentication identities
      identities(provider: "google_oauth2") {
        id
        provider
        uid
        name
      }

      # subscriptions of user
      subscriptions(
        filter: {
          state: { eq: "active" }
        }
      ) {
        nodes {
          id
          planId
          state
        }
      }
    }

    # Pagination metadata
    currentPage                   # Current page number (Int!)
    hasNextPage                   # Whether there are more pages (Boolean!)
    hasPreviousPage               # Whether there are previous pages (Boolean!)
    nodesCount                    # Number of items in current page (Int!)
    totalPages                    # Total number of pages (Int!)
  }
}

Filtering

The users query accepts a filter parameter of type UserFilter. This allows you to narrow down results based on various criteria.

Filter FieldTypeDescription
nameStringOperatorFilter by user name
emailStringOperatorFilter by user email

StringOperator

The StringOperator used in filters has these operations:

OperationDescription
eqEqual to
neqNot equal to
inIn a list of values
ninNot in a list of values
likeMatch text values against a pattern using wildcards (case-sensitive)

Filter Examples

Find users with a specific name pattern:

query {
  users(
    filter: {
      name: { eq: "Smith" }
    }
  ) {
    nodes {
      id
      name
      email
    }
  }
}

Find users with a specific email pattern:

query {
  users(
    filter: {
      email: { eq: "smith@example.com" }
    }
  ) {
    nodes {
      id
      name
      email
    }
  }
}

Identities Fields

The User object can include identity information through the identities field. This returns a list of the user's third-party authentication identities (e.g., Google, LINE, Facebook).

Parameters:

ParameterTypeDescription
providerStringOptional. Filter by provider (e.g., google_oauth2, line, facebook)

Identity Object:

FieldTypeDescription
idString!Unique identifier for the identity
providerString!Authentication provider (e.g., google_oauth2, line, facebook)
uidString!User identifier from the provider
nameStringDisplay name from the provider

Example with identity data:

query {
  users(page: 1, perPage: 20) {
    nodes {
      id
      name
      email
      identities {
        id
        provider
        uid
        name
      }
    }
    currentPage
    totalPages
  }
}

Subscriptions Fields

The User object can include subscription information through the subscriptions field. This returns a paginated list of the user's subscriptions.

FieldTypeDescription
idString!Unique identifier for the subscription
planIdString!Identifier of the subscription plan
stateString!Current state of the subscription
createdAtInt!When the subscription was created

StringOperator

The StringOperator used in filters has these operations:

OperationDescription
eqEqual to
neqNot equal to
inIn a list of values
ninNot in a list of values
likeMatch text values against a pattern using wildcards (case-sensitive)

Subscription Filter Parameters

ParameterTypeDescription
idStringOperatorFilter by subscription ID
planIdStringOperatorFilter by subscription plan ID
stateStringOperatorFilter by subscription state

Example with subscription data:

query {
  users(page: 1, perPage: 20) {
    nodes {
      id
      name
      subscriptions(
        filter: {
          planId: {
            eq: "abc123-983dsf8"
          }
        }
      ) {
        nodes {
          id
          planId
          state
          createdAt
        }
      }
    }
    currentPage
    totalPages
  }
}

On this page