Skip to content

Users 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.

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.

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
}
}

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

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)
# 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!)
}
}

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

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)

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
}
}
}

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

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)
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
}
}