OrdinateDB

Documentation

product Pre-releaseunwritten sections are marked
POST/v1/calc/backfill

Create a calculation backfill

operation ID: post_v1_calc_backfill

Overview

Create a calculation backfill. The calculation API repairs historical derived data and explains how calculated values were produced.

When to use it

  • Use it when an application needs to create a calculation backfill.
  • Use it when an engineer is validating derived data, diagnosing a rule, or repairing a historical calculation window.

Quick example

Set the base URL and replace generated identifiers or credentials with values from your installation.

cURL

curl --request POST \
  --url "$ORDINATE_URL/v1/calc/backfill" \
  --header "Authorization: Bearer $ORDINATE_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "rule_id": "00000000-0000-4000-8000-000000000001",
    "start_ns": 0,
    "end_ns": 0
  }'

Expected output · 202

Backfill accepted

Example 202 output

{
  "job_id": "00000000-0000-4000-8000-000000000001"
}

The cURL request sends the smallest contract-derived body and asks OrdinateDB to create a calculation backfill. The documented 202 response is backfill accepted.

How it works

Backfills are managed jobs, while lineage, status, and trace reads expose the inputs and evaluation state behind calculated series.

Reference

Required capability
calc-author
Authorization scope
handler-resolved target

Parameters

NameInRequiredType and constraints
Idempotency-Keyheaderno
string

Replays the first successful response for the same authenticated principal, route, key, and request body

max length: 255

Request body

application/json

asset_idsarrayoptional

array

stringformat: uuid
end_nsintegerrequired

UTC Unix timestamp in nanoseconds

format: int64
previewbooleanoptional
rule_idstringrequired
format: uuid
start_nsintegerrequired

UTC Unix timestamp in nanoseconds

format: int64
unknown fields rejected

Example request body

{
  "rule_id": "00000000-0000-4000-8000-000000000001",
  "start_ns": 0,
  "end_ns": 0
}

Responses

202Backfill accepted

Response headers

  • X-Ordinate-Idempotent-ReplayPresent with the literal value `true` when this response was replayed

application/json

job_idstringrequired
format: uuid
unknown fields rejected

Example 202 output

{
  "job_id": "00000000-0000-4000-8000-000000000001"
}
400end_ns must be greater than start_ns; Invalid or oversized Idempotency-Key

application/json

ErrorEnvelope
codestringrequired
correlation_idstringrequired
format: uuid
detailsobjectoptional
errorstringrequired

Example 400 output

{
  "error": "string",
  "code": "account-sealed",
  "correlation_id": "00000000-0000-4000-8000-000000000001"
}
401Authentication required

application/json

ErrorEnvelope
codestringrequired
correlation_idstringrequired
format: uuid
detailsobjectoptional
errorstringrequired

Example 401 output

{
  "error": "string",
  "code": "account-sealed",
  "correlation_id": "00000000-0000-4000-8000-000000000001"
}
403calc-author capability is not granted

application/json

ErrorEnvelope
codestringrequired
correlation_idstringrequired
format: uuid
detailsobjectoptional
errorstringrequired

Example 403 output

{
  "error": "string",
  "code": "account-sealed",
  "correlation_id": "00000000-0000-4000-8000-000000000001"
}
409Idempotency-Key was already used with a different request body

application/json

ErrorEnvelope
codestringrequired
correlation_idstringrequired
format: uuid
detailsobjectoptional
errorstringrequired

Example 409 output

{
  "error": "string",
  "code": "account-sealed",
  "correlation_id": "00000000-0000-4000-8000-000000000001"
}
503Model database is not configured or unavailable

application/json

ErrorEnvelope
codestringrequired
correlation_idstringrequired
format: uuid
detailsobjectoptional
errorstringrequired

Example 503 output

{
  "error": "string",
  "code": "account-sealed",
  "correlation_id": "00000000-0000-4000-8000-000000000001"
}

Code examples

These examples are generated from the source contract. Replace the base URL, credentials, identifiers, and minimal generated values for your instance.

JavaScript

const ordinateUrl = "http://localhost:8080";
const token = "<bearer-token>";

const response = await fetch(`${ordinateUrl}/v1/calc/backfill`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${token}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "rule_id": "00000000-0000-4000-8000-000000000001",
  "start_ns": 0,
  "end_ns": 0
})
});

if (!response.ok) {
  throw new Error(`OrdinateDB returned ${response.status}: ${await response.text()}`);
}

const data = await response.json();
console.log(data);