---
title: "Count the mail in each folder"
description: "What the sidebar of the app shows, for every folder, label and address."
url: "https://nextmail.sh/docs/api/threads/counts"
area: "API"
category: "Mailbox"
---

# Count the mail in each folder

What the sidebar of the app shows, for every folder, label and address.

`GET /threads/counts`

## GET /threads/counts

What the sidebar of the app shows, for every folder, label and address.

## Example

Needs `threads:read`. `folders` has a row for `inbox`, `sent`, `spam`, `archive`, `trash` and `snoozed`, each with how many conversations it holds and how many of them are unread, then `draft`, whose count is the drafts waiting to be sent, then `unread`, whose count is the unread conversations in the inbox. `labels` has a row for each of your labels and each folder it has conversations in. `addresses` counts the inbox conversations that arrived at each address, with `null` for mail that recorded none.

**curl**

```
curl "$OE/threads/counts?address=billing@acme.com" -H "$AUTH"
```

**Response**

```
{
  "object": "mailbox_counts",
  "folders": [
    { "label": "inbox", "count": 412, "unread": 9 },
    { "label": "sent", "count": 188, "unread": 0 },
    { "label": "spam", "count": 3, "unread": 3 },
    { "label": "archive", "count": 1270, "unread": 0 },
    { "label": "trash", "count": 41, "unread": 1 },
    { "label": "snoozed", "count": 2, "unread": 0 },
    { "label": "draft", "count": 4, "unread": 0 },
    { "label": "unread", "count": 9, "unread": 9 }
  ],
  "addresses": [{ "address": "billing@acme.com", "count": 412 }],
  "labels": [{ "id": "USER_CLIENTS", "folder": "inbox", "count": 23, "unread": 2 }],
  "categories": [
    { "category": "primary", "count": 301, "unread": 6 },
    { "category": "promotions", "count": 64, "unread": 2 },
    { "category": "updates", "count": 38, "unread": 1 },
    { "category": "social", "count": 5, "unread": 0 },
    { "category": "forums", "count": 4, "unread": 0 }
  ],
  "unlabelled": {
    "count": 389,
    "unread": 7,
    "categories": [
      { "category": "primary", "count": 278, "unread": 4 },
      { "category": "promotions", "count": 64, "unread": 2 },
      { "category": "updates", "count": 38, "unread": 1 },
      { "category": "social", "count": 5, "unread": 0 },
      { "category": "forums", "count": 4, "unread": 0 }
    ]
  },
  "team": {
    "assigned": { "count": 6, "unread": 1 },
    "unassigned": { "count": 14, "unread": 3 },
    "mentions": { "count": 5, "unread": 1, "unseen": 2 }
  }
}
```

> A key or an app limited to particular addresses counts only the mail that arrived at them and the drafts written from them. `address` narrows every count to one address, and an address outside what the key reaches counts nothing rather than failing.

> `categories` has a row for each inbox tab, `primary`, `promotions`, `updates`, `social` and `forums`, counting inbox conversations only. `primary` is everything not sorted into another tab, so the five counts add up to the inbox.

> `unlabelled` counts the inbox conversations that carry none of your labels, in total and for each tab. It is what the inbox of the app lists unless Labelled mail is ticked in its Filters menu, and a conversation labelled `BOUNCED` counts as labelled.

> `team` counts the team views for the person the key or app acts for. `assigned` and `unassigned` are the open conversations assigned to them and the ones nobody has, and `mentions` the conversations a team comment mentions them in, with `unseen` for those with a mention newer than the last time they opened its comments in the app.

## Reference

- [`GET /threads/counts`](https://nextmail.sh/docs/api/reference/threads#get-threads-counts): full reference
