How to get contacts in children of a parent group using the API
You can use the 'group' filter on the Contact api to get members of parent groups.  

$result = civicrm_api3('Contact', 'get', array(
  'sequential' =&gt; 1,
  'group' =&gt; XX,
  'options' =&gt; array('limit' =&gt; 0),
));


where XX is the id of the parent group (A).