Skip to main content

GraphQL queries

Queries read MLH data. Every list query supports the same filter, order, and pagination arguments; single-record queries fetch by ID (some also by slug).

List queries

challenges, events, programs, series, mlh_sponsorships, promo_codes, promo_code_pools, projects, participations, users, companies, and schools each return a list and accept:

  • filter — a per-type filter input (see below).
  • order — sort ascending or descending by an orderable field.
  • limit — results per page.
  • page — which page (offset-based pagination — page + limit, not cursors).
query {
events(
filter: { name: { contains: "hack" } }
order: { desc: STARTS_AT }
limit: 20
page: 1
) {
id
name
startsAt
}
}

Filtering

Each type has a generated filter input. Depending on the field you can filter strings (eq, contains), dates/numbers (comparison operators), booleans, enums, and associations.

Ordering

order takes { asc: FIELD } or { desc: FIELD }, where FIELD is one of the type's orderable fields.

Single-record queries

  • challenge(id), program(id), promo_code(id), promo_code_pool(id), project(id), participation(id), school(id) — fetch by ID.
  • event(id | slug), series(id | slug), mlh_sponsorship(id | slug), company(id | slug) — fetch by ID or slug.
  • user(id) — if no id is given and the token belongs to a user, returns the logged-in user.

Other queries

  • countries(alpha2) — list countries, or look one up by its alpha-2 code.
  • oauth_application(client_id, redirect_uri, response_type, scope) — look up an OAuth application and optionally validate RFC 6749 parameters.
  • social_profile_provider(provider) — get an authorization URL for a social provider (requires a signed-in user).
  • node(id) / nodes(ids) — Relay-style lookup by global ID.