Skip to content

Queries

The following examples are adapted from Workout.graphql (iOS sample app).

The public iOS and Android sample apps use the same GraphQL query structure for workout discovery and launch-session retrieval.

These examples are intentionally reduced to the most common fields. For complete schema exploration, use the GraphQL Playground available in the Admin Console or perform a fully authenticated schema introspection in your environment.

There is no separate public versioned URL per schema revision. Instead, schema evolution is monitored internally with Apollo Studio, including breaking-change detection.

Each client environment exposes its own endpoint. Use the endpoint and schema-access settings provided for your B2B integration.

List workouts

graphql
query GetSessions {
  publicWorkouts(filters: { tag: "demo" }, configuration: { difficulty: EASY }) {
    edges {
      node {
        ...WorkoutPreviewItem
      }
    }
  }
}

Get one workout preview

graphql
query GetSession($id: ID!) {
  publicWorkout(globalId: $id) {
    ...WorkoutPreviewItem
  }
}

Get session payload for launch

graphql
query GetSessionContent($id: ID!) {
  publicWorkoutSession(globalId: $id, configuration: { difficulty: EASY }) {
    ... on WorkoutBlockSession {
      ...WorkoutBlockSessionItem
    }
    ... on WorkoutVideoSession {
      ...WorkoutVideoSessionItem
    }
  }
}

For launch flows, this query is the important one: it returns the session payload consumed by the SDK. In production, start with the sample fragments and then trim or extend the selection to match your app's needs.

For SDK launch safety, treat the sample session fragments as the reference contract. The documentation intentionally shows reduced examples for readability, but the sample query files remain the safest baseline for the field set expected by the SDK.

Fetch this query close to workout launch. The response may include a WorkoutKitToken that is valid for 1 day, and the safest pattern is to use the payload and signature immediately rather than precomputing launch payloads far in advance.

Core preview fragment

graphql
fragment WorkoutPreviewItem on WorkoutPreview {
  id: globalId
  type
  duration
  name
  format
  picture
}