Get aggregated statistics for threads based on filters.
Query parameters
Filter threads that are archived (1=true, 0=false).
Filter threads assigned to the current user (1=true, 0=false).
Filter threads with attachments (1=true, 0=false).
Filter threads with delivery pending messages: sending, retry or failed (1=true, 0=false).
Filter threads with draft messages (1=true, 0=false).
Filter threads with any mention (read or unread) for the current user (1=true, 0=false).
Filter threads with messages sent by the user (1=true, 0=false).
Filter threads with starred messages (1=true, 0=false).
Filter threads that are trashed (1=true, 0=false).
Filter threads with no active assignment from any user (1=true, 0=false).
Filter threads with unread mentions for the current user (1=true, 0=false).
Filter threads by label slug.
Filter threads by mailbox ID.
Search threads by content (subject, sender, recipients, message body).
Comma-separated list of fields to aggregate. Special values: 'all' (count all threads), 'all_unread' (count all unread threads). Boolean fields: has_trashed, has_draft, has_starred, has_attachments, has_archived, has_sender, has_active, has_delivery_pending, has_delivery_failed, is_spam, has_messages, has_unread_mention, has_mention, has_assigned_to_me, has_unassigned. Unread variants ('_unread' suffix): count threads where the condition is true AND the thread is unread. Examples: 'all,all_unread', 'has_starred,has_starred_unread', 'is_spam,is_spam_unread'
Response
A dictionary containing the aggregated counts. Keys correspond to the fields requested via the stats_fields query parameter. Each value is an integer count. Keys not requested will not be present in the response.