Skip to main content
Retrieve menu categories for a restaurant chain. Use this to build category navigation in your menu UI.

Query

query SmartMenuCategories($restaurantId: String) {
  categories(restaurantId: $restaurantId) {
    name
    count
    ordinal
    imageUrl
  }
}
Chain and session context come from your headers (X-Session-ID). You don’t need to pass them in the query.

Parameters

ParameterTypeRequiredDescription
restaurantIdStringNoSpecific location for multi-location chains

Response

type Category {
  name: String!
  count: Int!        # Number of dishes in category
  ordinal: Int!      # Display order (0 = first)
  imageUrl: String   # Optional category image
}

Example

query {
  categories {
    name
    count
    ordinal
  }
}

Filtering by Category

Use the category parameter in the search query to filter dishes:
query SaladDishes {
  search(
    category: "Salads"
    preferences: {
      diets: [VEGETARIAN]
    }
  ) {
    matches {
      dish {
        id
        name
        category
      }
    }
    counts { matches, total }
  }
}

Category Counts with Preferences

Category counts returned by categories represent total dishes, not dishes matching any preference filters. For filtered counts, use the search query with a category filter.
To get counts that respect preferences, query each category:
query CategoryCounts {
  salads: search(
    category: "Salads"
    preferences: { diets: [VEGETARIAN] }
  ) {
    counts { matches }
  }

  bowls: search(
    category: "Bowls"
    preferences: { diets: [VEGETARIAN] }
  ) {
    counts { matches }
  }
}

Display Recommendations

Use Ordinal for Order

Display categories in ordinal order to match the restaurant’s intended menu layout.

Show Match Counts

Consider showing “X matches” next to each category when filters are active.

Hide Empty Categories

Optionally hide categories with 0 matches when dietary filters are applied.

Sticky Navigation

For long menus, consider a sticky category bar for easy navigation.