Settings and API
The Answer API
One endpoint answers a question from your knowledge base, with the same retrieval, citations and cost controls as the help center and widget.
The request
curl https://pagetruth.com/api/v1/answer \
-H "Authorization: Bearer sk_…" \
-H "Content-Type: application/json" \
-d '{"question":"How do I reset my password?"}'
| Field | Required | What it is |
|---|---|---|
question |
yes | Up to 1,000 characters |
conversation_id |
no | From a previous response, to ask a follow-up |
user_id |
no | Your own identifier for the person asking, up to 64 characters |
The response
{
"answer": "Choose Forgot password on the sign-in page… [1]",
"answered": true,
"cached": false,
"conversation_id": "6f1c…",
"citations": [
{
"index": 1,
"document_id": "a2b9…",
"title": "Account security",
"page": 3,
"quote": "Choose Forgot password and we email you a code.",
"url": "https://pagetruth.com/help/acme/articles/account-security"
}
],
"escalation": null
}
answeredisfalsewhen your docs don't cover the question.answerthen holds your fallback message andescalationyour hand-off button, if you set one.cachedistruewhen the answer came from cache, which doesn't count towards your answers.urllinks to the cited article, or to the file at its page when customers may open source files; otherwise it'snull.
Follow-up questions
Send the conversation_id you got back to continue the same conversation. The answer takes the last six turns into account.
Errors
| Status | Meaning |
|---|---|
| 400 | The body isn't valid, for example a missing or too long question |
| 401 | The key is missing, wrong or revoked |
| 403 | Your plan doesn't include the API |
| 429 | Too many requests: the response's retry-after header says when to try again |
| 502 | The answer couldn't be produced right now; try again |
Each key can make 60 requests a minute.
Counting
Every answered question uses one AI answer from your plan, like any other channel. API conversations appear on Conversations under the channel API.
Was this helpful?