curl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/context/prefetch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"about": {
"value": "<string>",
"scope": "<string>"
},
"conversation_id": "<string>",
"object": {
"id": "<string>",
"namespace": "<string>",
"type": "<string>"
},
"subject": {
"value": "<string>",
"scope": "<string>"
},
"task_id": "<string>",
"verification": "V0",
"view": "voice"
}
'import requests
url = "https://{space}.{region}.api.niadra.com/v1/context/prefetch"
payload = {
"query": "<string>",
"about": {
"value": "<string>",
"scope": "<string>"
},
"conversation_id": "<string>",
"object": {
"id": "<string>",
"namespace": "<string>",
"type": "<string>"
},
"subject": {
"value": "<string>",
"scope": "<string>"
},
"task_id": "<string>",
"verification": "V0",
"view": "voice"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
about: {value: '<string>', scope: '<string>'},
conversation_id: '<string>',
object: {id: '<string>', namespace: '<string>', type: '<string>'},
subject: {value: '<string>', scope: '<string>'},
task_id: '<string>',
verification: 'V0',
view: 'voice'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/context/prefetch', 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://{space}.{region}.api.niadra.com/v1/context/prefetch",
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([
'query' => '<string>',
'about' => [
'value' => '<string>',
'scope' => '<string>'
],
'conversation_id' => '<string>',
'object' => [
'id' => '<string>',
'namespace' => '<string>',
'type' => '<string>'
],
'subject' => [
'value' => '<string>',
'scope' => '<string>'
],
'task_id' => '<string>',
'verification' => 'V0',
'view' => 'voice'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://{space}.{region}.api.niadra.com/v1/context/prefetch"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"about\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task_id\": \"<string>\",\n \"verification\": \"V0\",\n \"view\": \"voice\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{space}.{region}.api.niadra.com/v1/context/prefetch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"about\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task_id\": \"<string>\",\n \"verification\": \"V0\",\n \"view\": \"voice\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/context/prefetch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"about\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task_id\": \"<string>\",\n \"verification\": \"V0\",\n \"view\": \"voice\"\n}"
response = http.request(request)
puts response.read_body{
"queued": true
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Prepare the read of a turn
Memory v2: the partial transcript while the customer speaks; the read with the same query answers from work already done. 202 at once, no receipt.
curl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/context/prefetch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"about": {
"value": "<string>",
"scope": "<string>"
},
"conversation_id": "<string>",
"object": {
"id": "<string>",
"namespace": "<string>",
"type": "<string>"
},
"subject": {
"value": "<string>",
"scope": "<string>"
},
"task_id": "<string>",
"verification": "V0",
"view": "voice"
}
'import requests
url = "https://{space}.{region}.api.niadra.com/v1/context/prefetch"
payload = {
"query": "<string>",
"about": {
"value": "<string>",
"scope": "<string>"
},
"conversation_id": "<string>",
"object": {
"id": "<string>",
"namespace": "<string>",
"type": "<string>"
},
"subject": {
"value": "<string>",
"scope": "<string>"
},
"task_id": "<string>",
"verification": "V0",
"view": "voice"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
about: {value: '<string>', scope: '<string>'},
conversation_id: '<string>',
object: {id: '<string>', namespace: '<string>', type: '<string>'},
subject: {value: '<string>', scope: '<string>'},
task_id: '<string>',
verification: 'V0',
view: 'voice'
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/context/prefetch', 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://{space}.{region}.api.niadra.com/v1/context/prefetch",
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([
'query' => '<string>',
'about' => [
'value' => '<string>',
'scope' => '<string>'
],
'conversation_id' => '<string>',
'object' => [
'id' => '<string>',
'namespace' => '<string>',
'type' => '<string>'
],
'subject' => [
'value' => '<string>',
'scope' => '<string>'
],
'task_id' => '<string>',
'verification' => 'V0',
'view' => 'voice'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://{space}.{region}.api.niadra.com/v1/context/prefetch"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"about\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task_id\": \"<string>\",\n \"verification\": \"V0\",\n \"view\": \"voice\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{space}.{region}.api.niadra.com/v1/context/prefetch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"about\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task_id\": \"<string>\",\n \"verification\": \"V0\",\n \"view\": \"voice\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/context/prefetch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"about\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"conversation_id\": \"<string>\",\n \"object\": {\n \"id\": \"<string>\",\n \"namespace\": \"<string>\",\n \"type\": \"<string>\"\n },\n \"subject\": {\n \"value\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"task_id\": \"<string>\",\n \"verification\": \"V0\",\n \"view\": \"voice\"\n}"
response = http.request(request)
puts response.read_body{
"queued": true
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Authorizations
nia_sk_...
Body
POST /v1/context/prefetch: the customer's turn so far, sent while they are still speaking, so the
read that answers the turn finds its work done (memory v2). Same target, view and level as that read.
The partial transcript. The read with this same query is served from the prefetch; a longer transcript still finds the customer's memory already open.
1 - 2000The account or partner the person acts for.
Show child attributes
Show child attributes
1 - 512A business object in a system of record, e.g. invoice / erp / 0823.
Show child attributes
Show child attributes
An identifier of a subject in some channel or system: a phone, an e-mail, a CRM id.
Show child attributes
Show child attributes
1 - 512Session verification levels. no_customer sits outside the V0-V4 scale.
V0, V1, V2, V3, V4, no_customer ^(voice|chat|brief|full|custom|account|partner|task:[a-z0-9_]{1,40})$Response
Successful Response
False when there is nothing to prepare: the space does not have memory v2 on, or the server is at its bound of prefetches. The read answers the same either way.

