API
API Documentation
Use Denser.ai’s API chat integration to exchange messages programmatically. Build custom chat UIs, link external apps, and manage conversations via code.
Query a Denser chatbot programmatically to build custom chat experiences or integrations. Before you start, generate an API key and copy your chatbot ID--see the REST API quick start.
Endpoint
POST https://denser.ai/api/query
Authenticate by passing your API key in the key field of the JSON request body. Send the body as Content-Type: application/json.
Request body
Prop
Type
Example requests
curl -X POST "https://denser.ai/api/query" \
-H "Content-Type: application/json" \
-d '{
"question": "What are the pricing options for Denser?",
"chatbotId": "11111111-1111-1111-1111-111111111111",
"key": "00000000-0000-0000-0000-000000000000",
"context": [],
"prompt": "",
"model": "gpt-4o-mini",
"citation": true
}'await fetch("https://denser.ai/api/query", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
question: "What are the pricing options for Denser?",
chatbotId: "11111111-1111-1111-1111-111111111111",
key: "00000000-0000-0000-0000-000000000000",
context: [],
prompt: "",
model: "gpt-4o-mini",
citation: true,
}),
});Responses
A successful request returns the answer plus supporting passages (when citation is enabled). Errors return a statusCode, an error label, and a message.
Answer with citations
{
"statusCode": "200",
"answer": "Denser.ai offers several pricing plans...",
"passages": [
{
"source": "https://denser.ai/docs/plans-and-billing/",
"text": "We offer four different subscription plans: Free Trial, Starter, Standard, and Business...",
"score": 7.904721
},
{
"source": "https://denser.ai/pricing",
"text": "Use DenserChat for free. Upgrade to enable custom domains and more advanced features...",
"score": 7.236598,
"score_rerank": 5.964538097381592
}
]
}{
"statusCode": 400,
"error": "Bad Request",
"message": [
"question must be a string",
"key must be a string",
"chatbotId must be a string"
]
}{
"statusCode": "500",
"error": "Internal Server Error",
"message": "An internal server error occurred."
}