Quickstart
Ask a question of your own installation and read the answer with the file it stands on.
On this page
You need the base address of your installation, an API token and access to a knowledge space. Follow Authentication first. Requests use $RDC_BASE_URL, the address of your own installation, and $RDC_TOKEN from your environment.
Choose a space
List the spaces visible to your client. Keep the id of the space containing the files you want to query. The identifiers in the requests below come from the returned records; use your own returned identifiers.
curl
curl "$RDC_BASE_URL/private-ai/v1/spaces?limit=20" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/private-ai/v1/spaces?limit=20`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/private-ai/v1/spaces?limit=20',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/private-ai/v1/spaces?limit=20');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/private-ai/v1/spaces?limit=20");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"items": [
{
"id": "warehouse",
"name": "Warehouse",
"permissionSource": "directory",
"lastSync": "2026-11-23T06:00:00Z"
},
{
"id": "finance",
"name": "Finance",
"permissionSource": "directory",
"lastSync": "2026-11-23T06:00:00Z"
}
],
"nextCursor": null
} Check files and model
Read the documents and choose an indexed file in your space. Queued and indexing files are not yet available to retrieval; a failed file needs its reported cause corrected. Your administrator assigns a loaded model to your team.
curl
curl "$RDC_BASE_URL/private-ai/v1/documents?limit=20" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/private-ai/v1/documents?limit=20`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/private-ai/v1/documents?limit=20',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/private-ai/v1/documents?limit=20');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/private-ai/v1/documents?limit=20");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"items": [
{
"id": "doc-procedure",
"spaceId": "warehouse",
"title": "Receiving procedure",
"status": "ready",
"revision": 1,
"readable": true,
"attempt": 1,
"error": null
},
{
"id": "doc-scan",
"spaceId": "warehouse",
"title": "Receiving checklist",
"status": "failed",
"revision": 1,
"readable": false,
"attempt": 1,
"error": "unreadable_file"
},
{
"id": "doc-delivery",
"spaceId": "warehouse",
"title": "Delivery instructions",
"status": "ready",
"revision": 1,
"readable": true,
"attempt": 1,
"error": null
},
{
"id": "doc-finance",
"spaceId": "finance",
"title": "Payment review",
"status": "ready",
"revision": 1,
"readable": true,
"attempt": 1,
"error": null
}
],
"nextCursor": null
} Ask a question
Create a UUID for operationId and use expectedRevision 0 for the new chat. Send spaceId, modelId and the question. Add the header Prefer: wait=10 to get the finished chat in the answer when the model is quick enough; without it, the 202 answer records acceptance and you read the operation.
curl
curl -X POST "$RDC_BASE_URL/private-ai/v1/chat" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "8a000001-0000-4000-8000-000000000001",
"expectedRevision": 0,
"spaceId": "warehouse",
"modelId": "model-primary",
"question": "What do we do with damaged goods at receiving?"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/private-ai/v1/chat`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "8a000001-0000-4000-8000-000000000001",
"expectedRevision": 0,
"spaceId": "warehouse",
"modelId": "model-primary",
"question": "What do we do with damaged goods at receiving?"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/private-ai/v1/chat',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '8a000001-0000-4000-8000-000000000001',
'expectedRevision': 0,
'spaceId': 'warehouse',
'modelId': 'model-primary',
'question': 'What do we do with damaged goods at receiving?',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "8a000001-0000-4000-8000-000000000001",
"expectedRevision": 0,
"spaceId": "warehouse",
"modelId": "model-primary",
"question": "What do we do with damaged goods at receiving?"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/private-ai/v1/chat');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/private-ai/v1/chat");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "8a000001-0000-4000-8000-000000000001",
"expectedRevision": 0,
"spaceId": "warehouse",
"modelId": "model-primary",
"question": "What do we do with damaged goods at receiving?"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "8a000001-0000-4000-8000-000000000001",
"status": "completed",
"aggregateId": "8a000002-0000-4000-8000-000000000001",
"aggregateRevision": 1,
"chat": {
"id": "8a000002-0000-4000-8000-000000000001",
"revision": 1,
"spaceId": "warehouse",
"modelId": "model-primary",
"question": "What do we do with damaged goods at receiving?",
"status": "answered",
"path": [
"received",
"authorized",
"retrieved",
"drafted",
"answered"
],
"answer": "Photograph the damaged goods, move them to the quarantine bay and report them to the supplier within one working day.",
"citations": [
{
"documentId": "doc-procedure",
"title": "Receiving procedure",
"locator": "Section 4, Damaged goods",
"passage": "Damaged goods are photographed, moved to the quarantine bay and reported to the supplier within one working day."
}
],
"documentIds": [
"doc-procedure"
],
"code": null
}
} Follow the operation
When the answer did not come back with the 202, read the operation using the operationId you sent. While accepted, wait before checking again. completed means the chat result is available at aggregateId; rejected carries a stable code. After a timeout, retry the identical request with its original operationId.
curl
curl "$RDC_BASE_URL/private-ai/v1/operations/8a000001-0000-4000-8000-000000000001" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/private-ai/v1/operations/8a000001-0000-4000-8000-000000000001`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/private-ai/v1/operations/8a000001-0000-4000-8000-000000000001',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/private-ai/v1/operations/8a000001-0000-4000-8000-000000000001');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/private-ai/v1/operations/8a000001-0000-4000-8000-000000000001");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "8a000001-0000-4000-8000-000000000001",
"status": "completed",
"aggregateId": "8a000002-0000-4000-8000-000000000001",
"aggregateRevision": 1
} Read the result
Read the chat with aggregateId. An answered record holds the answer and its citations: the file, the section and the passage the answer stands on. When nothing in the readable files answers the question, the record is answered with no answer and no citation. A refused record has no answer and names its reason in code. Correct permissions, indexing or model state before submitting a new question.
curl
curl "$RDC_BASE_URL/private-ai/v1/chat/8a000002-0000-4000-8000-000000000001" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/private-ai/v1/chat/8a000002-0000-4000-8000-000000000001`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/private-ai/v1/chat/8a000002-0000-4000-8000-000000000001',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/private-ai/v1/chat/8a000002-0000-4000-8000-000000000001');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/private-ai/v1/chat/8a000002-0000-4000-8000-000000000001");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "8a000002-0000-4000-8000-000000000001",
"revision": 1,
"spaceId": "warehouse",
"modelId": "model-primary",
"question": "What do we do with damaged goods at receiving?",
"status": "answered",
"path": [
"received",
"authorized",
"retrieved",
"drafted",
"answered"
],
"answer": "Photograph the damaged goods, move them to the quarantine bay and report them to the supplier within one working day.",
"citations": [
{
"documentId": "doc-procedure",
"title": "Receiving procedure",
"locator": "Section 4, Damaged goods",
"passage": "Damaged goods are photographed, moved to the quarantine bay and reported to the supplier within one working day."
}
],
"documentIds": [
"doc-procedure"
],
"code": null
} Next, register Subscriptions and complete the Go-live checklist.