# Update every message in a thread

Updates every message in a thread. Fields you leave out keep their current values.

```http
PATCH https://api.pozy.ai/v1/email/threads/{threadId}
```

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

## Path parameters

- `threadId` (string, required)

## Request body

Content type: `application/json`

- `accountId`, string, required
- `unread`, boolean
- `starred`, boolean
- `folder`, string

## Example request

```bash
curl -X PATCH "https://api.pozy.ai/v1/email/threads/60186572e25ff711298bf12e" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "accountId": "696e0b682d0a31188e7a2ba9"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/email/threads/60186572e25ff711298bf12e", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    accountId: "696e0b682d0a31188e7a2ba9"
  }),
});
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.patch(
    "https://api.pozy.ai/v1/email/threads/60186572e25ff711298bf12e",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "accountId": "696e0b682d0a31188e7a2ba9",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `data`, 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

```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"
  }
}
```
