Governing Bodies, leagues, and franchises have complex hierarchies. SportsEngine affiliations will help you navigate their structures in real-time. Some affiliations only contain a few organizations, while others will contain thousands. In all queries, if the organizationPath attribute is empty, that organization is the highest-level root organization in the affiliation.
Browse an Entire Affiliation
Start here when accessing an affiliation for the first time. You can return every organization that is part of the structure regardless of hierarchical position or status. The only thing required is an affiliation ID, provided at onboarding, or you can find the ID by querying your organization’s data (if you have data access to that org).
query Affiliation {
affiliations(affiliationId: 42) {
pageInformation {
count
page
pages
perPage
}
results {
classification
code
id
name
status
}
}
}
In the response, you will find an affiliation object alongside pageInformation. This object contains all the top-level information, such as the logo, website, and a complete list of classifications used in the affiliation structure. Please take note of the classifications array, as it will be beneficial in the following queries.
"data": {
"affiliations": {
"affiliation": {
"classifications": [
"State",
"Club"
],
"id": "42",
"label": "League Name",
"logoUrl": " https://leaguewebsite.org/logo.png",
"logoWebsite": "https://leaguewebsite.org"
},
"pageInformation": {
"count": 6354,
"page": 1,
"pages": 255,
"perPage": 25
},
"results": [ ]
}
}
All Organizations at a Specific Level
Navigating an entire organization hierarchy can be difficult, so the affiliations query supports filtering by classification (e.g., region, state, district, etc.) so you can focus on one level at a time. Classifications are unique to each affiliation, require an exact match, and are case-insensitive.
query Affiliation {
affiliations(affiliationId: 42, classification: "region") {
pageInformation {
count
page
pages
perPage
}
results {
classification
code
id
name
status
}
}
}
Viewing Affiliated Organizations
In many situations, you know the organization ID or code and need to check their status or get the child organizations connected to them. Add organizationId or code to the query to narrow your results.
Codes are configured specific to an affiliation and are NOT guaranteed to be unique within or across affiliations.
query Affiliation{
affiliations(affiliationId: 42, organizationId: 12345) {
pageInformation {
count
page
pages
perPage
}
results {
classification
code
id
name
status
}
}
}
query Affiliation{
affiliations(affiliationId: 42, code: "TPS") {
pageInformation {
count
page
pages
perPage
}
results {
classification
code
id
name
status
}
}
}
Understanding an Organization's Affiliations
If you have data access to an organization, you can add the affiliations attribute to the organization query. The top-level affiliation information, like the name, logo, website, and levels, is also available. Use the affiliation.id to learn more about the entire affiliation structure in other queries. The organizationPath attribute represents where in the affiliation the organization is located and in ascending order to the root organization.
Affiliations are an array because an organization can be part of multiple leagues, franchises, or governing bodies on the platform.
query Organization {
organization(id: 12345) {
id
name
affiliations {
classifications
id
label
logoUrl
logoWebsite
organizationPath {
classification
code
id
name
status
}
}
}
}