Skip to content

User Query

Note: The Teachify 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
idID!Unique identifier (UUID)
nameString!Full name of the user
emailString!Email address of the user
phoneNumberStringPhone number of the user

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 (ID!)
name # Full name (String!)
email # Email address (String!)
phoneNumber # Phone number (String)
# 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: "[email protected]" }
}
) {
nodes {
id
name
email
}
}
}

Subscriptions Fields

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

FieldTypeDescription
idID!Unique identifier for the subscription
planIdString!Identifier of the subscription plan
stateString!Current state of the subscription
createdAtDateTime!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
}
}