> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mycentralino.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Conoscenza dell'agente

> I documenti di conoscenza di un Agente AI di MyFlow: testi, domande frequenti e file

# GET /v1/whatsapp/agents/\{id}/knowledge

La **conoscenza** è ciò che l'agente sa della tua azienda: orari, servizi, prezzi, procedure. A ogni messaggio l'agente cerca nei documenti le parti utili alla domanda del cliente e risponde basandosi su quelle.

Ci sono tre tipi di documento:

| Tipo | Cos'è | Dall'API |
| - | - | - |
| `text` | Un testo con un titolo | Si legge, si [aggiunge](https://docs.mycentralino.com/mycentralino-api/whatsapp-agents-knowledge-add.md), si [riscrive](https://docs.mycentralino.com/mycentralino-api/whatsapp-agents-knowledge-update.md), si [toglie](https://docs.mycentralino.com/mycentralino-api/whatsapp-agents-knowledge-delete.md) |
| `faq` | Una domanda frequente con la sua risposta | Si legge, si aggiunge, si riscrive, si toglie |
| `file` | Un file caricato dal pannello (PDF, Word…), di cui si legge il testo estratto | Si legge e si toglie. Si carica solo dal pannello |

Questa rotta elenca i documenti senza il contenuto. Il contenuto di un documento si legge con [`GET /v1/whatsapp/agents/{id}/knowledge/{doc}`](#un-documento).

## Parametri

| Parametro | Tipo | Obbligatorio | Descrizione |
| - | - | - | - |
| `id` | int | ✅ | ID dell'agente, nel percorso |

## Richiesta

```bash cURL theme={null}
curl "https://api.mycentralino.com/v1/whatsapp/agents/7/knowledge" \
  -H "X-API-KEY: sk_mycentralino_your_api_key"
```

```php PHP theme={null}
<?php
$ch = curl_init('https://api.mycentralino.com/v1/whatsapp/agents/7/knowledge');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['X-API-KEY: sk_mycentralino_your_api_key']
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));
```

```python Python theme={null}
import requests

headers = {'X-API-KEY': 'sk_mycentralino_your_api_key'}
response = requests.get('https://api.mycentralino.com/v1/whatsapp/agents/7/knowledge', headers=headers)
print(response.json())
```

## Risposta

`200 OK`

```json theme={null}
{
  "success": true,
  "data": {
    "documents": [
      {
        "id": 31,
        "type": "faq",
        "title": "Che orari fate?",
        "chars": 72,
        "file_name": null,
        "created_at": "2026-11-12T18:25:10+01:00"
      },
      {
        "id": 32,
        "type": "text",
        "title": "Servizi e prezzi",
        "chars": 1840,
        "file_name": null,
        "created_at": "2026-11-12T18:26:02+01:00"
      },
      {
        "id": 33,
        "type": "file",
        "title": "Regolamento dello Studio",
        "chars": 12450,
        "file_name": "regolamento.pdf",
        "created_at": "2026-11-13T09:40:51+01:00"
      }
    ],
    "totals": {"documents": 3, "chars": 14362},
    "limits": {"documents": 20, "chars": 200000}
  }
}
```

| Campo | Tipo | Descrizione |
| - | - | - |
| `documents[].id` | int | ID del documento |
| `documents[].type` | string | `text`, `faq` oppure `file` |
| `documents[].title` | string | Il titolo. Per una FAQ è la domanda |
| `documents[].chars` | int | Quanti caratteri occupa |
| `documents[].file_name` | string \| null | Solo per i file: il nome del file caricato |
| `documents[].created_at` | string | Quando è stato aggiunto, ISO 8601 con fuso |
| `totals` | object | Documenti e caratteri dell'agente, in tutto |
| `limits` | object | Il massimo per agente: 20 documenti e 200.000 caratteri |

## Un documento

### GET /v1/whatsapp/agents/\{id}/knowledge/\{doc}

Restituisce un documento con il suo contenuto: gli stessi campi dell'elenco, più il contenuto secondo il tipo.

| Tipo | Campi in più |
| - | - |
| `faq` | `question`, `answer` |
| `text` | `text` |
| `file` | `text`: il testo estratto dal file, quello che l'agente legge |

```bash theme={null}
curl "https://api.mycentralino.com/v1/whatsapp/agents/7/knowledge/31" \
  -H "X-API-KEY: sk_mycentralino_your_api_key"
```

```json theme={null}
{
  "success": true,
  "data": {
    "id": 31,
    "type": "faq",
    "title": "Che orari fate?",
    "chars": 72,
    "file_name": null,
    "created_at": "2026-11-12T18:25:10+01:00",
    "question": "Che orari fate?",
    "answer": "Dal lunedì al venerdì dalle 9 alle 18, il sabato dalle 9 alle 13."
  }
}
```

## Errori

### 404 - agent\_not\_found

Non c'è un agente con questo `id` su questo account.

### 404 - knowledge\_not\_found

Non c'è un documento con questo `doc` per questo agente.

Gli errori comuni a tutte le rotte sono nell'[introduzione](https://docs.mycentralino.com/mycentralino-api/whatsapp-introduction.md#codici-di-errore).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.