Skip to content

Membership Plans 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 Membership Plans API allows you to retrieve information about subscription options available to students in your school. Each plan has specific features, pricing, and duration settings.

Available Queries

membershipPlans

Returns a paginated list of membership plans for the authenticated school.

Parameters:

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

Returns:

  • AdminMembershipPlanPage object with:
    • nodes: Array of AdminMembershipPlan 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 {
membershipPlans(
filter: {
active: true
},
page: 1,
perPage: 10
) {
nodes {
id
name
description
price
currency
interval
intervalCount
active
visible
createdAt
updatedAt
subscriptionsCount
totalRevenue
}
currentPage
hasNextPage
hasPreviousPage
nodesCount
totalPages
}
}

Membership Plan Object

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

FieldTypeDescription
idID!Unique identifier
nameString!Plan name
descriptionStringPlan description
priceFloat!Price of the plan
currencyString!Currency code (e.g., USD, EUR) in ISO 4217 format
intervalString!Billing interval (month, year, day)
intervalCountInt!Number of intervals (e.g., 1, 3, 6)
activeBoolean!Whether the plan is active
visibleBoolean!Whether the plan is visible to students
createdAtISO8601DateTime!When the plan was created
updatedAtISO8601DateTime!When the plan was last updated
soldItemsCountIntNumber of sold subscriptions
subscriptionsCountInt!Total number of subscriptions
totalRevenueFloatTotal revenue generated by this plan
subscriptionsAdminSubscriptionPagePaginated list of subscriptions for this plan

Detailed Query Structure

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

query {
membershipPlans(
filter: {
id: { eq: "plan-123" },
active: true,
visible: true
},
page: 1,
perPage: 20
) {
nodes {
id # Unique identifier (ID!)
name # Plan name (String!)
description # Plan description (String)
# Plan pricing details
price # Price amount (Float!)
currency # Currency code (String!)
# Subscription details
interval # Billing interval (String!)
intervalCount # Number of intervals (Int!)
# Plan status
active # Whether the plan is active (Boolean!)
visible # Whether the plan is visible (Boolean!)
# Timestamps
createdAt # When the plan was created (ISO8601DateTime!)
updatedAt # When the plan was last updated (ISO8601DateTime!)
# Statistics
soldItemsCount # Number of sold subscriptions (Int)
subscriptionsCount # Total number of subscriptions (Int!)
totalRevenue # Total revenue generated (Float)
# Related subscriptions
subscriptions(page: 1, perPage: 5) { # Subscriptions for this plan (AdminSubscriptionPage)
nodes {
id
state
startAt
endAt
currentPeriodStart
currentPeriodEnd
isCanceling
isCancellable
user {
id
name
email
}
}
currentPage
hasNextPage
nodesCount
}
}
# Pagination information
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 membershipPlans query accepts a filter parameter of type AdminMembershipPlanFilter. This allows you to narrow down results based on various criteria.

Available Filters

Filter FieldTypeDescription
idStringOperatorFilter by plan ID
activeBooleanFilter by active status
visibleBooleanFilter by visibility

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 active membership plans:

query {
membershipPlans(
filter: {
active: true
}
) {
nodes {
id
name
price
currency
}
nodesCount
}
}

Find visible membership plans:

query {
membershipPlans(
filter: {
visible: true
}
) {
nodes {
id
name
price
currency
}
nodesCount
}
}

Find membership plans by ID:

query {
membershipPlans(
filter: {
id: { eq: "plan-123" }
}
) {
nodes {
id
name
price
currency
}
nodesCount
}
}