Most staff questions — 'what is our leave policy?', 'which form do I use for a refund?' — already have answers in a document somewhere. AI Box can answer them with citations, and its API lets you put that answer inside the tools people already use.
Two endpoints to know
| Endpoint | Use it for | Key type |
|---|---|---|
| POST /api/query | Grounded answers with page citations from one folder | Folder key |
| POST /v1/chat/completions | Drop-in for tools that already speak the OpenAI format | Developer key |
A minimal Python example
import requests — then: r = requests.post('http://aibox.local:8000/api/query', headers={'Authorization': 'Bearer aib_live_...'}, json={'question': 'How many leave days do new staff get?'}); print(r.json()['answer']). The response also contains a citations list with document, page and snippet, which your bot can show as links.
Using the OpenAI SDK
Point the official OpenAI library at the box by setting base_url to http://aibox.local:8000/v1 and api_key to your developer key. Existing code, LangChain chains or LiteLLM configs then work with little change.
Good practice
- Create one folder key per integration so you can rotate or revoke it alone.
- Keep keys on your server, never in browser code.
- Show citations to users so they can check the source page.
- Test requests first in the in-app API tester before writing code.
The public Developer API page lists every endpoint with curl, Python and JavaScript examples.