Skip to main content

Accessing Knowledge Base Metadata

Before filtering or analyzing documents, use this endpoint to understand the metadata schema—the specific fields, data types, and allowed values present in your Knowledge Base.

Zafer Çavdar avatar
Written by Zafer Çavdar
Updated this week

What is the Metadata Schema?

The Metadata Schema defines the "shape" of the data attached to your documents. It tells you which fields exist (like revenue or author), what type of data they hold, and what the valid ranges or categories are.

Endpoint Overview

  • Base URL: https://rb-backend.dcipheranalytics.com

  • Path: /kb/{kb_id}/metadata

  • Method: GET

Understanding the Response

The API returns an array of objects describing each field:

  • label: The name of the metadata field (use this for filtering).

  • type: The data format (e.g., CATEGORICAL, INT, STRING).

  • values:

    • For Categorical fields: A list of all possible values (e.g., ["Draft", "Published"]).

    • For Numeric fields: An object showing the min and max values currently in the data.

Example Schema Response:

[
{
"label": "region",
"type": "CATEGORICAL",
"values": ["North America", "EMEA", "APAC"]
},
{
"label": "score",
"type": "INT",
"values": { "min": 1, "max": 100 }
}
]

Code Examples:

Bash (cURL)

curl -X GET "https://rb-backend.dcipheranalytics.com/kb/${KB_ID}/metadata" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "Accept: application/json"

Python

import requests

BASE_URL = "https://rb-backend.dcipheranalytics.com"
KB_ID = "YOUR_KB_ID"
ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"

resp = requests.get(
f"{BASE_URL}/kb/{KB_ID}/metadata",
headers={"Authorization": f"Bearer {ACCESS_TOKEN}",
"Accept": "application/json"},
timeout=30,
)
resp.raise_for_status()
schema = resp.json()
print(schema)

Node.js (Fetch)

const BASE_URL = "https://rb-backend.dcipheranalytics.com";
const KB_ID = "YOUR_KB_ID";
const ACCESS_TOKEN = "YOUR_ACCESS_TOKEN";

const resp = await fetch(`${BASE_URL}/kb/${KB_ID}/metadata`, {
method: "GET",
headers: {
Authorization: `Bearer ${ACCESS_TOKEN}`,
Accept: "application/json",
},
});

if (!resp.ok) {
throw new Error(`HTTP ${resp.status}: ${await resp.text()}`);
}

const schema = await resp.json();
console.log(schema);

Did this answer your question?