Get all Categories with getGroupById in Element API plugin - Craft 3 I have an endpoint created and I am getting the groupID but I am unable to get all the categories associated with the group.

This is what I have right now:

$categoriesGroup = Craft::$app-&gt;categories-&gt;getGroupById($catId);


I can't seem to get an array of entries from that.
$categories = Category::find()-&gt;groupId($id)-&gt;all();