Run a saved question
Read a question, start a run and retrieve its result.
On this page
Obtain an account through sales and follow Authentication. Set RDC_BASE_URL to the base address you receive and RDC_TOKEN to the access token. Keep both in the server environment. The test company includes the saved question used below.
Read the definition and revision
curl
curl "$RDC_BASE_URL/reports/v1/questions/revenue-by-product" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/reports/v1/questions/revenue-by-product`, {
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"]}/reports/v1/questions/revenue-by-product',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/reports/v1/questions/revenue-by-product');
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")}/reports/v1/questions/revenue-by-product");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "revenue-by-product",
"revision": 1,
"metricId": "net-revenue",
"filters": {
"period": "2026-10",
"companyId": null,
"department": null
},
"dimension": "productLine",
"direction": "asc",
"presentation": "table"
} Retain revision, metricId and filters. Choose a new UUID for operationId and a separate runId. The question revision goes into expectedRevision; the month and optional company and department go into filters.
Start the run
curl
curl -X POST "$RDC_BASE_URL/reports/v1/questions/revenue-by-product/runs" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "41800000-0000-4000-8000-000000000001",
"expectedRevision": 1,
"runId": "41800000-0000-4000-8000-000000000002",
"filters": {
"period": "2026-10",
"companyId": null,
"department": null
}
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/reports/v1/questions/revenue-by-product/runs`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "41800000-0000-4000-8000-000000000001",
"expectedRevision": 1,
"runId": "41800000-0000-4000-8000-000000000002",
"filters": {
"period": "2026-10",
"companyId": null,
"department": null
}
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/reports/v1/questions/revenue-by-product/runs',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '41800000-0000-4000-8000-000000000001',
'expectedRevision': 1,
'runId': '41800000-0000-4000-8000-000000000002',
'filters': {
'period': '2026-10',
'companyId': None,
'department': None,
},
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "41800000-0000-4000-8000-000000000001",
"expectedRevision": 1,
"runId": "41800000-0000-4000-8000-000000000002",
"filters": {
"period": "2026-10",
"companyId": null,
"department": null
}
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/reports/v1/questions/revenue-by-product/runs');
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")}/reports/v1/questions/revenue-by-product/runs");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "41800000-0000-4000-8000-000000000001",
"expectedRevision": 1,
"runId": "41800000-0000-4000-8000-000000000002",
"filters": {
"period": "2026-10",
"companyId": null,
"department": null
}
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "41800000-0000-4000-8000-000000000001",
"status": "accepted",
"aggregateRevision": 1
} A 202 response accepts the request; it does not contain completed rows. Keep operationId and runId so a network retry uses exactly the same body.
Wait for the operation
curl
curl "$RDC_BASE_URL/reports/v1/operations/41800000-0000-4000-8000-000000000001" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/reports/v1/operations/41800000-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"]}/reports/v1/operations/41800000-0000-4000-8000-000000000001',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/reports/v1/operations/41800000-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")}/reports/v1/operations/41800000-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": "41800000-0000-4000-8000-000000000001",
"status": "completed",
"aggregateRevision": 1
} Continue when status is completed. For accepted, poll again with bounded backoff. For rejected, inspect the stable error code and correct the request before choosing another operationId. Never treat a timeout as a completed run.
Read the rows
curl
curl "$RDC_BASE_URL/reports/v1/runs/41800000-0000-4000-8000-000000000002" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/reports/v1/runs/41800000-0000-4000-8000-000000000002`, {
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"]}/reports/v1/runs/41800000-0000-4000-8000-000000000002',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/reports/v1/runs/41800000-0000-4000-8000-000000000002');
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")}/reports/v1/runs/41800000-0000-4000-8000-000000000002");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "41800000-0000-4000-8000-000000000002",
"revision": 1,
"questionId": "revenue-by-product",
"questionRevision": 1,
"status": "completed",
"filters": {
"period": "2026-10",
"companyId": null,
"department": null
},
"sourceRevision": 1,
"refreshedAt": "2026-11-22T06:00:00Z",
"rows": [
{
"key": "food",
"netRevenue": "142063.00",
"invoiceIds": [
"FCT-2026-00418",
"BRR-2026-00127"
]
},
{
"key": "household",
"netRevenue": "60735.50",
"invoiceIds": [
"FCT-2026-00436"
]
}
],
"errorCode": null
} Check the run status as well: queued and running have no final rows. On completed, read key, netRevenue and invoiceIds. netRevenue is a decimal string in RON; use decimal arithmetic rather than binary floating-point when adding money. sourceRevision and refreshedAt identify freshness.
Handle a refused run
For revision_conflict, read the question again and decide whether the changed definition still answers your question. For source_unavailable, inspect the source and refresh it before starting a new run. For forbidden, check the account permissions rather than widening the filters.