---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://docs.sendcorex.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://docs.sendcorex.com/llms.txt"
---

Source: https://docs.sendcorex.com/it/api-reference/receive-emails/reading/get-thread

Ricevi email: lettura

# Get Thread

Apri un'intera conversazione: il riepilogo e ogni messaggio in ordine cronologico, facoltativamente con i corpi.

POST `https://g.sendcorex.com/v1` command: get_thread

## Argomenti

- `thread_id` string facoltativo
L'id della conversazione.
- `id` string facoltativo
L'id di qualsiasi messaggio della conversazione. Usa questo o `thread_id`.
- `include_body` boolean facoltativo
`true` aggiunge `body` (`html` e `text`) a ogni messaggio.

## Avvio rapido

```
import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1',
  {
    commands: [
      {
        command: "get_thread",
        args: {
          id: "Vj0xQUJDMTIz",
          include_body: true
        }
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_TOKEN } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);
```

## Risposta

```
{
  "type": "SUCCESS",
  "results": [
    {
      "command": "get_thread",
      "id": "0",
      "type": "SUCCESS",
      "data": {
        "thread": {
          "thread_id": "thr_9a1c4e72",
          "subject": "Invoice for September",
          "participants": [
            "ana@client.com",
            "you@yourdomain.com"
          ],
          "last_senders": [
            "ana@client.com"
          ],
          "message_count": 2,
          "unread_count": 1,
          "folders": [
            "INBOX",
            "Sent"
          ]
        },
        "messages": [
          {
            "message_uid": "Vj0xQUJDMDA5",
            "message_id": "<4c1d…@mail.client.com>",
            "in_reply_to": null,
            "parent_uid": null,
            "depth": 0,
            "folders": [
              "INBOX"
            ],
            "from_name": "Ana Costa",
            "from_email": "ana@client.com",
            "direction": "inbound",
            "to": [
              {
                "email": "you@yourdomain.com"
              }
            ],
            "reply_to": [],
            "subject": "Invoice for September",
            "preview": "Hi, attached is the invoice for September…",
            "is_read": true,
            "is_starred": false,
            "is_important": false,
            "has_attachments": false,
            "received_at": "2026-10-09T09:02:41Z",
            "body": {
              "html": "<p>Hi, attached is the invoice for September.</p>",
              "text": "Hi, attached is the invoice for September."
            }
          }
        ]
      }
    }
  ]
}
```

### Campi della risposta

- `thread`
Il riepilogo della conversazione: `thread_id`, `subject`, `participants`, `last_senders`, `message_count`, `unread_count` e `folders`.
- `messages[]`
Messaggi in ordine cronologico.
- `messages[].message_uid / message_id`
L'id nella casella e il Message-ID SMTP.
- `messages[].in_reply_to / parent_uid / depth`
Dove si trova il messaggio nell'albero delle risposte.
- `messages[].direction`
`inbound` o `outbound`.
- `messages[].from_name / from_email / to / reply_to`
Dati della busta.
- `messages[].subject / preview`
Oggetto e anteprima.
- `messages[].is_read / is_starred / is_important / has_attachments`
Stato del messaggio.
- `messages[].received_at`
Quando il messaggio è stato ricevuto o inviato.
- `messages[].body`
Solo con `include_body: true`: `{ html, text }`.

## Errori

Gli errori a livello HTTP restituiscono `type`, `code` e `message`. Gli errori marcati CMD tornano dentro il risultato del comando, con HTTP 200.

- 401`TOKEN_EXPIRED`
L'access token è scaduto. Chiama Refresh Token e ripeti la richiesta.
- 401`INVALID_TOKEN`
Il token è malformato, sconosciuto o revocato.
- 429`RATE_LIMITED`
Più di 15 richieste/s o 15 in corso per la stessa IP + casella. Attendi i secondi indicati in Retry-After.
- CMD`INVALID_ARGS`
Un argomento obbligatorio manca o non è valido.
- CMD`NOT_FOUND`
Il messaggio, il thread o la cartella non esiste per questo token.
- CMD`INTERNAL`
Errore del server. Il dettaglio viene scritto solo nel log del server.
