# Knowledge

| Method | Path | What it does |
| --- | --- | --- |
| GET | `/v1/knowledge/answer?q=` | One question about Vocatech's service, answered |
| POST | `/v1/knowledge/answer` | The same, with `{"q": "..."}` or `{"question": "..."}` |

The answer comes from Vocatech's published facts only, in one to three short sentences, the way a person at our front desk would say it. Nothing about your account is in it. When the knowledge base does not cover the question, `found` is `false` and nothing is guessed.

**curl**

```bash
curl -G https://api.vocatech.com/v1/knowledge/answer \
  -H "Authorization: Bearer $VOCATECH_API_KEY" \
  --data-urlencode "q=Is there a contract?"
```

**Node**

```javascript
import { vt } from './vocatech.mjs';

const q = new URLSearchParams({ q: 'Is there a contract?' });
const a = await vt('GET', `/v1/knowledge/answer?${q}`);
console.log(a.found ? a.answer : a.note);
```

**Python**

```python
from vocatech import vt

a = vt("GET", "/v1/knowledge/answer", params={"q": "Is there a contract?"})
print(a["answer"] if a["found"] else a["note"])
```

**PHP**

```php
<?php
require __DIR__ . '/vocatech.php';

$a = vt('GET', '/v1/knowledge/answer?' . http_build_query(['q' => 'Is there a contract?']));
echo $a['found'] ? $a['answer'] : $a['note'], PHP_EOL;
```

**Response200 OKCopy**

```json
{
  "question": "Is there a contract?",
  "found": true,
  "answer": "No. Service is month-to-month, and there is no contract to sign.",
  "section": "Contracts and billing",
  "note": "Answer the caller from this in your own words; state only what it says."
}
```

`q` is 3 to 500 characters. `source`, optional, names the system that asks, for our log. Each key may ask 30 questions a minute and 2,000 a day.

[Knowledge in the API reference](https://vocatech.com/developers/reference/knowledge)
