One call, one number
GmailLabel.getUnreadCount() queries Gmail's index directly. It returns the integer unread message count for that label in a single API call, the same count you see in the Gmail sidebar. There is no pagination, no thread fetching, nothing to aggregate.
Getting there takes two steps: GmailApp.getUserLabelByName('your-label') returns a GmailLabel object (or null if the label does not exist), and then .getUnreadCount() on that object gives you the number. The null check matters — a missing label silently returns null, and calling .getUnreadCount() on null throws a TypeError that looks completely unrelated to a label name typo.
For sublabels, pass the full path with a forward slash: getUserLabelByName('support/open'). That is how Gmail stores nested labels internally, and the string must match exactly, including case.