Query
curl --request POST \
--url https://general-runtime.voiceflow.com/knowledge-base/query \
--header 'Content-Type: application/json' \
--header 'authorization: <api-key>' \
--data '
{
"question": "<string>",
"projectID": "<string>",
"instruction": "<string>",
"chunkLimit": 15,
"synthesis": true,
"settings": {
"model": "<string>",
"temperature": 123,
"maxTokens": 0,
"system": "<string>",
"reasoningEffort": "<string>"
},
"filters": {},
"internalFilters": [
{
"key": "<string>",
"value": "<string>"
}
],
"projectEnvironmentIDOrAlias": "<string>",
"versionVariant": "published"
}
'import requests
url = "https://general-runtime.voiceflow.com/knowledge-base/query"
payload = {
"question": "<string>",
"projectID": "<string>",
"instruction": "<string>",
"chunkLimit": 15,
"synthesis": True,
"settings": {
"model": "<string>",
"temperature": 123,
"maxTokens": 0,
"system": "<string>",
"reasoningEffort": "<string>"
},
"filters": {},
"internalFilters": [
{
"key": "<string>",
"value": "<string>"
}
],
"projectEnvironmentIDOrAlias": "<string>",
"versionVariant": "published"
}
headers = {
"authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
question: '<string>',
projectID: '<string>',
instruction: '<string>',
chunkLimit: 15,
synthesis: true,
settings: {
model: '<string>',
temperature: 123,
maxTokens: 0,
system: '<string>',
reasoningEffort: '<string>'
},
filters: {},
internalFilters: [{key: '<string>', value: '<string>'}],
projectEnvironmentIDOrAlias: '<string>',
versionVariant: 'published'
})
};
fetch('https://general-runtime.voiceflow.com/knowledge-base/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://general-runtime.voiceflow.com/knowledge-base/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'question' => '<string>',
'projectID' => '<string>',
'instruction' => '<string>',
'chunkLimit' => 15,
'synthesis' => true,
'settings' => [
'model' => '<string>',
'temperature' => 123,
'maxTokens' => 0,
'system' => '<string>',
'reasoningEffort' => '<string>'
],
'filters' => [
],
'internalFilters' => [
[
'key' => '<string>',
'value' => '<string>'
]
],
'projectEnvironmentIDOrAlias' => '<string>',
'versionVariant' => 'published'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://general-runtime.voiceflow.com/knowledge-base/query"
payload := strings.NewReader("{\n \"question\": \"<string>\",\n \"projectID\": \"<string>\",\n \"instruction\": \"<string>\",\n \"chunkLimit\": 15,\n \"synthesis\": true,\n \"settings\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"maxTokens\": 0,\n \"system\": \"<string>\",\n \"reasoningEffort\": \"<string>\"\n },\n \"filters\": {},\n \"internalFilters\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projectEnvironmentIDOrAlias\": \"<string>\",\n \"versionVariant\": \"published\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://general-runtime.voiceflow.com/knowledge-base/query")
.header("authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"question\": \"<string>\",\n \"projectID\": \"<string>\",\n \"instruction\": \"<string>\",\n \"chunkLimit\": 15,\n \"synthesis\": true,\n \"settings\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"maxTokens\": 0,\n \"system\": \"<string>\",\n \"reasoningEffort\": \"<string>\"\n },\n \"filters\": {},\n \"internalFilters\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projectEnvironmentIDOrAlias\": \"<string>\",\n \"versionVariant\": \"published\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://general-runtime.voiceflow.com/knowledge-base/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"question\": \"<string>\",\n \"projectID\": \"<string>\",\n \"instruction\": \"<string>\",\n \"chunkLimit\": 15,\n \"synthesis\": true,\n \"settings\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"maxTokens\": 0,\n \"system\": \"<string>\",\n \"reasoningEffort\": \"<string>\"\n },\n \"filters\": {},\n \"internalFilters\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projectEnvironmentIDOrAlias\": \"<string>\",\n \"versionVariant\": \"published\"\n}"
response = http.request(request)
puts response.read_body{
"type": "completion",
"model": "<string>",
"output": "<string>",
"duration": 123,
"tokens": 123,
"queryTokens": 123,
"answerTokens": 123,
"cacheWriteTokens": 123,
"queryCachedTokens": 123,
"queryRemainderTokens": 123,
"inputMultiplier": 123,
"cacheMultiplier": 123,
"outputMultiplier": 123,
"cacheWriteMultiplier": 123,
"base": {
"queryTokens": 123,
"answerTokens": 123,
"cacheWriteTokens": 123,
"queryCachedTokens": 123
},
"chunks": [
{
"score": 123,
"chunkID": "<string>",
"documentID": "<string>",
"content": "<string>",
"source": {
"type": "url",
"name": "<string>",
"url": "<string>",
"lastSuccessUpdate": "<string>",
"accessTokenID": 123,
"integrationExternalID": "<string>"
},
"metadata": {},
"internalMetadata": [
{
"key": "<string>",
"values": [
"<string>"
]
}
]
}
]
}Query the knowledge base and retrieve answers to user questions. Send a question and receive a synthesized answer or relevant document chunks from the knowledge base.
POST
/
knowledge-base
/
query
Query
curl --request POST \
--url https://general-runtime.voiceflow.com/knowledge-base/query \
--header 'Content-Type: application/json' \
--header 'authorization: <api-key>' \
--data '
{
"question": "<string>",
"projectID": "<string>",
"instruction": "<string>",
"chunkLimit": 15,
"synthesis": true,
"settings": {
"model": "<string>",
"temperature": 123,
"maxTokens": 0,
"system": "<string>",
"reasoningEffort": "<string>"
},
"filters": {},
"internalFilters": [
{
"key": "<string>",
"value": "<string>"
}
],
"projectEnvironmentIDOrAlias": "<string>",
"versionVariant": "published"
}
'import requests
url = "https://general-runtime.voiceflow.com/knowledge-base/query"
payload = {
"question": "<string>",
"projectID": "<string>",
"instruction": "<string>",
"chunkLimit": 15,
"synthesis": True,
"settings": {
"model": "<string>",
"temperature": 123,
"maxTokens": 0,
"system": "<string>",
"reasoningEffort": "<string>"
},
"filters": {},
"internalFilters": [
{
"key": "<string>",
"value": "<string>"
}
],
"projectEnvironmentIDOrAlias": "<string>",
"versionVariant": "published"
}
headers = {
"authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
question: '<string>',
projectID: '<string>',
instruction: '<string>',
chunkLimit: 15,
synthesis: true,
settings: {
model: '<string>',
temperature: 123,
maxTokens: 0,
system: '<string>',
reasoningEffort: '<string>'
},
filters: {},
internalFilters: [{key: '<string>', value: '<string>'}],
projectEnvironmentIDOrAlias: '<string>',
versionVariant: 'published'
})
};
fetch('https://general-runtime.voiceflow.com/knowledge-base/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://general-runtime.voiceflow.com/knowledge-base/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'question' => '<string>',
'projectID' => '<string>',
'instruction' => '<string>',
'chunkLimit' => 15,
'synthesis' => true,
'settings' => [
'model' => '<string>',
'temperature' => 123,
'maxTokens' => 0,
'system' => '<string>',
'reasoningEffort' => '<string>'
],
'filters' => [
],
'internalFilters' => [
[
'key' => '<string>',
'value' => '<string>'
]
],
'projectEnvironmentIDOrAlias' => '<string>',
'versionVariant' => 'published'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://general-runtime.voiceflow.com/knowledge-base/query"
payload := strings.NewReader("{\n \"question\": \"<string>\",\n \"projectID\": \"<string>\",\n \"instruction\": \"<string>\",\n \"chunkLimit\": 15,\n \"synthesis\": true,\n \"settings\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"maxTokens\": 0,\n \"system\": \"<string>\",\n \"reasoningEffort\": \"<string>\"\n },\n \"filters\": {},\n \"internalFilters\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projectEnvironmentIDOrAlias\": \"<string>\",\n \"versionVariant\": \"published\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://general-runtime.voiceflow.com/knowledge-base/query")
.header("authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"question\": \"<string>\",\n \"projectID\": \"<string>\",\n \"instruction\": \"<string>\",\n \"chunkLimit\": 15,\n \"synthesis\": true,\n \"settings\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"maxTokens\": 0,\n \"system\": \"<string>\",\n \"reasoningEffort\": \"<string>\"\n },\n \"filters\": {},\n \"internalFilters\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projectEnvironmentIDOrAlias\": \"<string>\",\n \"versionVariant\": \"published\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://general-runtime.voiceflow.com/knowledge-base/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"question\": \"<string>\",\n \"projectID\": \"<string>\",\n \"instruction\": \"<string>\",\n \"chunkLimit\": 15,\n \"synthesis\": true,\n \"settings\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"maxTokens\": 0,\n \"system\": \"<string>\",\n \"reasoningEffort\": \"<string>\"\n },\n \"filters\": {},\n \"internalFilters\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projectEnvironmentIDOrAlias\": \"<string>\",\n \"versionVariant\": \"published\"\n}"
response = http.request(request)
puts response.read_body{
"type": "completion",
"model": "<string>",
"output": "<string>",
"duration": 123,
"tokens": 123,
"queryTokens": 123,
"answerTokens": 123,
"cacheWriteTokens": 123,
"queryCachedTokens": 123,
"queryRemainderTokens": 123,
"inputMultiplier": 123,
"cacheMultiplier": 123,
"outputMultiplier": 123,
"cacheWriteMultiplier": 123,
"base": {
"queryTokens": 123,
"answerTokens": 123,
"cacheWriteTokens": 123,
"queryCachedTokens": 123
},
"chunks": [
{
"score": 123,
"chunkID": "<string>",
"documentID": "<string>",
"content": "<string>",
"source": {
"type": "url",
"name": "<string>",
"url": "<string>",
"lastSuccessUpdate": "<string>",
"accessTokenID": 123,
"integrationExternalID": "<string>"
},
"metadata": {},
"internalMetadata": [
{
"key": "<string>",
"values": [
"<string>"
]
}
]
}
]
}Authorizations
Voiceflow API key
Body
application/json
Required range:
1 <= x <= 30The alias of the environment to target (ie. main). You can find this in the environments page of your agent.
💡 Tip: Learn more about Environments.
Available options:
draft, published Response
200 - application/json
Available options:
completion Hide child attributes
Hide child attributes
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
Hide child attributes
Hide child attributes
Available options:
url Available options:
daily, weekly, monthly, never Available options:
zendesk, shopify Was this page helpful?
⌘I