Developer docs

Docent API

Connect your own documents, ask questions, get cited answers — as a REST API you can call from anywhere, or a one-line widget you can drop on any page.

1

Get an API key

Create an account, then open API keys in the dashboard and create one. Use a full key from your own server; use a query-only key anywhere the key will be visible publicly (like the widget below) — it can only ask questions, never add or remove your documents.

2

Add a document

Upload a file:

curl -X POST https://docent-api-itjn.onrender.com/v1/sources/file \
  -H "Authorization: Bearer dk_your_key" \
  -F "file=@handbook.pdf"

Or hand it a link:

curl -X POST https://docent-api-itjn.onrender.com/v1/sources/url \
  -H "Authorization: Bearer dk_your_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/pricing"}'
3

Ask a question

curl -X POST https://docent-api-itjn.onrender.com/v1/query \
  -H "Authorization: Bearer dk_your_key" \
  -H "Content-Type: application/json" \
  -d '{"question": "What are your support hours?"}'

Returns:

{
  "answer": "According to Source 1, support hours are 9am–5pm Eastern, Mon–Fri.",
  "grounded": true,
  "sources": [
    { "source_id": "...", "label": "handbook.pdf", "excerpt": "..." }
  ]
}

If nothing relevant was found, grounded is false and the answer says so honestly instead of guessing — Docent never calls the AI model to invent an answer in that case.

4

Or just embed the widget

One script tag, no backend code required. Use a query-only key here — it'll be visible in your page's source, and that key can only ask questions.

<script src="https://docent-api-itjn.onrender.com/widget.js" data-key="dk_your_query_only_key"></script>

Optional attributes:

<script
  src="https://docent-api-itjn.onrender.com/widget.js"
  data-key="dk_your_query_only_key"
  data-accent="#2563eb"
  data-position="bottom-left"
  data-greeting="Hey! Ask me anything about our docs."
></script>

Full reference

Every endpoint, request, and response shape is documented interactively.

https://docent-api-itjn.onrender.com/docs