# List email threads

Returns email threads, one page at a time.

```http
GET https://api.pozy.ai/v1/email/threads
```

- Area: Email, calendar & files / Email
- Auth: Authorization: Bearer pz_live_...

## Query parameters

- `accountId` (string, required)
- `folder` (string)
- `unread` (boolean)
- `starred` (boolean)
- `hasAttachment` (boolean)
- `subject` (string)
- `from` (string)
- `to` (string)
- `cc` (string)
- `bcc` (string)
- `anyEmail` (string)
- `after` (string (date-time))
- `before` (string (date-time))
- `searchQueryNative` (string)
- `sortOrder` (string): one of asc, desc
- `cursor` (string)
- `limit` (integer)

## Example request

```bash
curl -X GET "https://api.pozy.ai/v1/email/threads?accountId=696e0b682d0a31188e7a2ba9&limit=50" \
  -H "Authorization: Bearer $POZY_API_KEY"
```

```ts
const res = await fetch("https://api.pozy.ai/v1/email/threads?accountId=696e0b682d0a31188e7a2ba9&limit=50", {
  headers: { Authorization: `Bearer ${process.env.POZY_API_KEY}` },
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.get(
    "https://api.pozy.ai/v1/email/threads",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    params={
        "accountId": "696e0b682d0a31188e7a2ba9",
        "limit": 50,
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `data`, array of object
  - `id`, string
  - `accountId`, string
  - `provider`, string: One of `google`, `microsoft`
  - `subject`, string
  - `snippet`, string
  - `participants`, array of object
    - `email`, string (email), required
    - `name`, string: Can be null
  - `messageIds`, array of string
  - `draftIds`, array of string
  - `folders`, array of string
  - `hasAttachments`, boolean
  - `hasDrafts`, boolean
  - `unread`, boolean
  - `starred`, boolean
  - `earliestMessageAt`, string (date-time): Can be null
  - `latestMessageReceivedAt`, string (date-time): Can be null
  - `latestMessageSentAt`, string (date-time): Can be null
- `pagination`, object
  - `hasMore`, boolean
  - `nextCursor`, string: Can be null
- `meta`, object
  - `filteredClientSide`, array of string

```json
{
  "data": [
    {
      "id": "6bfebd43ddc270f6d2c56fc5",
      "accountId": "696e0b682d0a31188e7a2ba9",
      "provider": "google",
      "subject": "string",
      "snippet": "string",
      "participants": [
        {
          "email": "alex@example.com",
          "name": "Acme"
        }
      ],
      "messageIds": [
        "Hello from Pozy"
      ],
      "draftIds": [
        "string"
      ],
      "folders": [
        "string"
      ],
      "hasAttachments": true,
      "hasDrafts": true,
      "unread": true,
      "starred": true,
      "earliestMessageAt": "2026-10-02T09:00:00.000Z",
      "latestMessageReceivedAt": "2026-10-02T09:00:00.000Z",
      "latestMessageSentAt": "2026-10-02T09:00:00.000Z"
    }
  ],
  "pagination": {
    "hasMore": true,
    "nextCursor": "string"
  },
  "meta": {
    "filteredClientSide": [
      "string"
    ]
  }
}
```
