Back to all resources
Data SchemaData SchemaBash

Data Schema: What does my IKG actually contain, and did my ingest land?

Read the observed schema of a project's Identity Knowledge Graph with GET /data-schema/v1/: every node type with its properties, value types, labels and counts, and every relationship type between node types. Then use it two ways: a shell check that fails a pipeline when an ingest did not land as intended, and a condensed vocabulary to hand to an AI agent before it writes a Knowledge Query.

Data Schema: What does my IKG actually contain, and did my ingest land?

The Data Schema API answers one question with one call: what does this project's graph contain right now? Not the data, but its shape, observed from what was captured.

Endpoint: GET /data-schema/v1/

Header: X-IK-ClientKey with an AppAgent credential whose agent holds the ReadDataSchema API permission. No body, no parameters, no user token.

Response: a JSON Graph Format (JGF v2) document with one graph object:

- graph.nodes: a map keyed by node type. Each entry carries node_count, a properties map (per property: count, the observed value types with per-type counts, and for node properties the same statistics for its metadata fields), system_labels and user_defined_labels.

- graph.edges: one entry per (source type, relation, target type) combination, with its count and its properties map.

- graph.metadata: created_at and updated_at of the schema.

Platform-generated relationship types, such as the _SAME_AS relationships of Entity Matching, are not part of the schema. A project with nothing captured yet answers 404.

Use case

Scenario: a car-rental dataset, five Customer identity nodes, two Car and one Motorcycle node, and the RENT and LEASE relationships between them, is captured by a nightly pipeline, and two consumers need its shape rather than its content.

1. The pipeline itself: after the Capture calls, one GET confirms the expected types, properties and counts landed, and that no property arrived with mixed value types. A typo in a type name or a property sent as a string in one batch and an integer in the next shows up here, before any policy or query depends on it.

2. An AI agent that writes ContX IQ Knowledge Queries: it gets the graph's vocabulary, node types with their property names and the relationship patterns, condensed from the same response, so it uses real names instead of guessing.

The example captures the ready-made sample dataset of the Data Schema guide, so the response shown is the one you get.

Requirements

Prerequisites:

- ServiceAccount credentials: To grant the ReadDataSchema permission to an Application Agent.

- AppAgent credentials: For the Capture calls and the schema read (X-IK-ClientKey). The agent must hold Capture and ReadDataSchema.

- The two sample files: simple-dataset-nodes.json and simple-dataset-relationships.json, downloadable from the Data Schema guide.

- curl and jq.

Required API access:

- POST /configs/v1/application-agents (or PUT /configs/v1/application-agents/{id} to add the permission to an existing agent)

- POST /capture/v1/nodes, POST /capture/v1/relationships

- GET /data-schema/v1/

Steps

Step 1: Grant the permission

- Authentication: ServiceAccount credential.

- Action: create the Application Agent with Capture and ReadDataSchema in api_permissions, or PUT ReadDataSchema onto an existing agent, then generate its credential.

- Result: an AppAgent credential that may capture and read the schema. Without ReadDataSchema the read fails with 401 "insufficient API access level for appAgent".

Step 2: Read the schema of an empty project

- Authentication: AppAgent credential (X-IK-ClientKey).

- Action: GET /data-schema/v1/ before anything is captured.

- Result: 404 with message "Not Found" and the reason in errors[]. The schema exists once data does.

Step 3: Capture the sample dataset

- Action: POST the nodes file to /capture/v1/nodes, then the relationships file to /capture/v1/relationships.

- Result: 5 Customer, 2 Car and 1 Motorcycle nodes, 4 RENT and 1 LEASE relationships.

Step 4: Read the schema

- Action: GET /data-schema/v1/.

- Result: the JGF document for the dataset: three node types with their properties and counts, the DigitalTwin system label on the identity nodes, the driver_license property's metadata statistics, and three edge entries. The schema is persisted at most once a minute, so allow up to a minute after a capture before the counts reflect it.

Step 5: Verify the ingest in a pipeline

- Action: run the check script after the Capture step.

- Result: it exits non-zero when a count is off or a property has mixed value types, so the pipeline stops before policies and queries run against a wrong shape.

Step 6: Brief an agent

- Action: condense the response with jq into node types with property names and relationship patterns.

- Result: a few lines of vocabulary to put in the agent's context before it writes a Knowledge Query or a KBAC policy; no data values leave the project.

Step 1

export API_URL=https://eu.api.indykite.com   # or https://us.api.indykite.com, the region of your project
export CLIENT_KEY="<application agent credential with the ReadDataSchema permission>"

Step 1

An Application Agent that may capture data and read the schema. Add ReadDataSchema to an existing agent with PUT /configs/v1/application-agents/{id} instead if you already have one.

POST https://eu.api.indykite.com/configs/v1/application-agentsJson
{
  "application_id": "gid:YOUR_APPLICATION_GID",
  "name": "schema-reader",
  "display_name": "Schema reader",
  "api_permissions": [
    "Capture",
    "ReadDataSchema"
  ]
}

Step 2

The schema of a project with no data yet.

GET https://eu.api.indykite.com/data-schema/v1/Bash
curl -sS -i "$API_URL/data-schema/v1/" -H "X-IK-ClientKey: $CLIENT_KEY"

404: nothing has been captured in this project.


HTTP/2 404

{
  "message": "Not Found",
  "errors": [
    "data schema not found for the specified project"
  ]
}

Step 3

Capture the sample dataset: nodes first, then the relationships that reference them.

POST https://eu.api.indykite.com/capture/v1/nodesBash
# the two files are the sample dataset offered by the Data Schema guide
curl -sS -X POST "$API_URL/capture/v1/nodes" \
  -H "X-IK-ClientKey: $CLIENT_KEY" -H "Content-Type: application/json" \
  --data @simple-dataset-nodes.json
curl -sS -X POST "$API_URL/capture/v1/relationships" \
  -H "X-IK-ClientKey: $CLIENT_KEY" -H "Content-Type: application/json" \
  --data @simple-dataset-relationships.json

Step 4

Read the schema and list the node types and the relationship patterns with their counts.

GET https://eu.api.indykite.com/data-schema/v1/Bash
curl -sS "$API_URL/data-schema/v1/" -H "X-IK-ClientKey: $CLIENT_KEY" -o schema.json
jq '.graph.nodes | keys' schema.json                  # ["Car", "Customer", "Motorcycle"]
jq '.graph.edges[] | "\(.source)-[\(.relation)]->\(.target): \(.metadata.count)"' schema.json

The schema of the sample dataset. Value types are named as the graph stores them (STRING NOT NULL, INTEGER NOT NULL, FLOAT NOT NULL, BOOLEAN NOT NULL, ZONED DATETIME NOT NULL). Each property lists its observed types with counts; driver_license also carries the statistics of its metadata fields (assurance_level, source), present on three of the five customers. Every node carries the Resource system label; the Customer nodes, captured with is_identity true, also carry DigitalTwin. A label list with nothing in it is null.


{
  "graph": {
    "directed": true,
    "metadata": {
      "created_at": "2026-10-12T15:04:05Z",
      "updated_at": "2026-10-12T15:04:09Z"
    },
    "nodes": {
      "Customer": {
        "metadata": {
          "node_count": 5,
          "properties": {
            "given_name":  { "count": 5, "types": [ { "type": "STRING NOT NULL",  "count": 5 } ] },
            "family_name": { "count": 5, "types": [ { "type": "STRING NOT NULL",  "count": 5 } ] },
            "email":       { "count": 5, "types": [ { "type": "STRING NOT NULL",  "count": 5 } ] },
            "driver_license": {
              "count": 5,
              "types": [ { "type": "INTEGER NOT NULL", "count": 5 } ],
              "metadata": {
                "assurance_level": { "count": 3, "types": [ { "type": "INTEGER NOT NULL", "count": 3 } ] },
                "source":          { "count": 3, "types": [ { "type": "STRING NOT NULL",  "count": 3 } ] }
              }
            }
          },
          "system_labels": [ { "name": "DigitalTwin", "count": 5 }, { "name": "Resource", "count": 5 } ],
          "user_defined_labels": null
        }
      },
      "Car": {
        "metadata": {
          "node_count": 2,
          "properties": {
            "make":  { "count": 2, "types": [ { "type": "STRING NOT NULL",  "count": 2 } ] },
            "model": { "count": 2, "types": [ { "type": "STRING NOT NULL",  "count": 2 } ] },
            "vin":   { "count": 2, "types": [ { "type": "STRING NOT NULL",  "count": 2 } ] },
            "year":  { "count": 2, "types": [ { "type": "INTEGER NOT NULL", "count": 2 } ] }
          },
          "system_labels": [ { "name": "Resource", "count": 2 } ],
          "user_defined_labels": null
        }
      },
      "Motorcycle": {
        "metadata": {
          "node_count": 1,
          "properties": {
            "make":  { "count": 1, "types": [ { "type": "STRING NOT NULL",  "count": 1 } ] },
            "model": { "count": 1, "types": [ { "type": "STRING NOT NULL",  "count": 1 } ] },
            "vin":   { "count": 1, "types": [ { "type": "STRING NOT NULL",  "count": 1 } ] },
            "year":  { "count": 1, "types": [ { "type": "INTEGER NOT NULL", "count": 1 } ] }
          },
          "system_labels": [ { "name": "Resource", "count": 1 } ],
          "user_defined_labels": null
        }
      }
    },
    "edges": [
      {
        "source": "Customer", "target": "Car", "relation": "RENT", "directed": true,
        "metadata": { "count": 3, "properties": { "since": { "count": 3, "types": [ { "type": "INTEGER NOT NULL", "count": 3 } ] } } }
      },
      {
        "source": "Customer", "target": "Motorcycle", "relation": "RENT", "directed": true,
        "metadata": { "count": 1, "properties": { "since": { "count": 1, "types": [ { "type": "INTEGER NOT NULL", "count": 1 } ] } } }
      },
      {
        "source": "Customer", "target": "Car", "relation": "LEASE", "directed": true,
        "metadata": { "count": 1, "properties": { "since": { "count": 1, "types": [ { "type": "INTEGER NOT NULL", "count": 1 } ] } } }
      }
    ]
  }
}

Step 5

A pipeline check: expected counts for the types and relationships the ingest produces, plus a generic guard against properties with mixed value types.

verify-schema.shBash
#!/usr/bin/env bash
# Fail a pipeline step when the schema does not show what the ingest was meant to produce.
set -euo pipefail
curl -sS "$API_URL/data-schema/v1/" -H "X-IK-ClientKey: $CLIENT_KEY" -o schema.json

expect() {  # expect <jq path> <value>
  actual=$(jq -r "$1" schema.json)
  [[ "$actual" == "$2" ]] || { echo "schema check failed: $1 is $actual, expected $2"; exit 1; }
}
expect '.graph.nodes.Customer.metadata.node_count' 5
expect '.graph.nodes.Customer.metadata.properties.email.count' 5
expect '[.graph.edges[] | select(.relation == "RENT")] | map(.metadata.count) | add' 4

# a property that arrived with more than one value type is a data-quality bug, whatever the counts
jq -e '[.graph.nodes[].metadata.properties[] | select((.types | length) > 1)] | length == 0' schema.json > /dev/null \
  || { echo "schema check failed: a property has mixed value types"; exit 1; }
echo "schema OK"

Step 6

Condense the schema into the vocabulary an agent needs: property names per node type and the relationship patterns.

# Hand the vocabulary, not the data, to whoever writes the next Knowledge Query or policy:
# node types with their properties, and the relationship types between them.
jq '{
  node_types: (.graph.nodes | to_entries | map({ (.key): (.value.metadata.properties | keys) }) | add),
  relationships: [ .graph.edges[] | "(\(.source))-[:\(.relation)]->(\(.target))" ]
}' schema.json

What the agent gets: names only, no values.


{
  "node_types": {
    "Car": ["make", "model", "vin", "year"],
    "Customer": ["driver_license", "email", "family_name", "given_name"],
    "Motorcycle": ["make", "model", "vin", "year"]
  },
  "relationships": [
    "(Customer)-[:RENT]->(Car)",
    "(Customer)-[:RENT]->(Motorcycle)",
    "(Customer)-[:LEASE]->(Car)"
  ]
}

The graph after

  • Car
  • Customer
  • Motorcycle
The graph after the capture: five Customer identity nodes, two Car and one Motorcycle node, four RENT and one LEASE relationships, each with a since property. The schema in step 4 is the shape of exactly this.

API Endpoints

/data-schema/v1/
/capture/v1/nodes
/capture/v1/relationships
/configs/v1/application-agents
View OpenAPI docs

Tags

Data SchemaIKGReadDataSchemaJGFIngest VerificationAI AgentsCapture API

Related Resources

No related resources found.