Loop through the terms of a custom taxonomy and get their stuff. This outputs a list of terms from a custom taxonomy and lists their “ID’s”.
// loop through terms of a custom Taxonomy
$getArgs = array(
'parent' => 0,
'order' => 'DESC',
'orderby' => 'count',
'hide_empty' => false,
);
$taxonomy = get_terms('MY_TAX', $getArgs);
foreach ($taxonomy as $term) {
echo '<li>' . $term->term_id . '</li>';
}