# How do I ingest data into the IndyKite Knowledge Graph (IKG)?

> Add nodes (entities) and relationships to the IndyKite Knowledge Graph using the Capture API. This is the foundation for all graph-based queries and authorization.

**Category:** Capture  
**API:** Capture  
**Tags:** Data Ingestion, Nodes, Relationships, Knowledge Graph, Capture API
**Last Updated:** 2026-09-22
**OpenAPI Endpoints:** /capture/v1/nodes, /capture/v1/relationships
**Related Guides:** /guides/guide-sandbox, /guides/guide-environment

## Summary

This guide demonstrates how to populate the IndyKite Knowledge Graph (IKG) with data:

1. Capture nodes - Create entities like Person, Company, Vehicle, Contract, LicenseNumber, PaymentMethod
2. Capture relationships - Connect nodes with typed relationships like OWNS, ACCEPTED, COVERS, HAS

After ingestion, the data is available for:
- ContX IQ queries (context-aware data retrieval)
- KBAC authorization decisions (Knowledge-Based Access Control)
- Hub Explorer visualization

## Use Case

Scenario: You are building a vehicle rental application and need to store:
- People who can rent vehicles
- Companies that own vehicle fleets
- Vehicles with license numbers
- Contracts linking people to vehicles
- Payment methods for billing

The graph structure enables queries like "Which vehicles can ryan access?" or "Who has a contract for vehicle car1?"

Example graph after ingestion (three people, three contracts, three vehicles):
Person(ryan) -[ACCEPTED]-> Contract(ct123) -[COVERS]-> Vehicle(car1) -[HAS]-> LicenseNumber(license1, number AX123456)
Person(alice) -[ACCEPTED]-> Contract(ct985) -[COVERS]-> Vehicle(car1)
Person(tilda) -[ACCEPTED]-> Contract(ct234) -[COVERS]-> Vehicle(truck1) -[HAS]-> LicenseNumber(license2)
Company(company1) -[OWNS]-> Vehicle(car1), Vehicle(car2), Vehicle(truck1)
Person(ryan) -[HAS]-> PaymentMethod(cb123); Person(alice) -[HAS]-> PaymentMethod(cb123); Person(tilda) -[HAS]-> PaymentMethod(kl123)
Application(application1) -[HAS_AGREEMENT_WITH]-> Company(company1)

## Requirements

Prerequisites:
- Completed environment setup (see environment-1): Project, Application, Application Agent, and Credentials created
- AppAgent credentials: The API key (X-IK-ClientKey) generated during environment setup

Required API access:
- POST /capture/v1/nodes/ (create/update nodes)
- POST /capture/v1/relationships/ (create/update relationships)

## Steps

Step 1: Ingest Nodes
- Authentication: AppAgent credential as API key (header: X-IK-ClientKey)
- Action: POST to /capture/v1/nodes/ with array of node definitions
- Input: Each node requires: external_id (unique identifier), type (node label), and properties
- Node types in this example: Person, Company, Vehicle, Contract, LicenseNumber, PaymentMethod
- Result: Nodes created or updated in the IKG (upsert behavior based on external_id)

Step 2: Ingest Relationships
- Authentication: AppAgent credential as API key (header: X-IK-ClientKey)
- Action: POST to /capture/v1/relationships/ with array of relationship definitions
- Input: Each relationship requires: source node, target node, relationship type, and direction
- Relationship types in this example: OWNS, ACCEPTED, COVERS, HAS, HAS_AGREEMENT_WITH
- Result: Relationships created between existing nodes

Step 3: Verify in Hub Explorer
- Action: Open the IndyKite Hub and navigate to the Explorer
- Result: Visual graph showing nodes and relationships

## Code Examples

### Step 1

POST request to capture nodes. Creates Person, Company, Vehicle, Contract, LicenseNumber, and PaymentMethod nodes. Each node has an external_id (unique identifier), type (label), and properties object.

**POST https://eu.api.indykite.com/capture/v1/nodes/**

```json
{
  "nodes": [
    {
      "external_id": "alice",
      "is_identity": true,
      "type": "Person",
      "properties": [
        {
          "type": "email",
          "value": "alice@email.com"
        },
        {
          "type": "given_name",
          "value": "Alice"
        },
        {
          "type": "last_name",
          "value": "Smith"
        }
      ]
    },
    {
      "external_id": "ryan",
      "is_identity": true,
      "type": "Person",
      "properties": [
        {
          "type": "email",
          "value": "ryan@yahoo.co.uk"
        },
        {
          "type": "given_name",
          "value": "ryan"
        },
        {
          "type": "last_name",
          "value": "mushu"
        }
      ]
    },
    {
      "external_id": "tilda",
      "is_identity": true,
      "type": "Person",
      "properties": [
        {
          "type": "email",
          "value": "tilda@yahoo.co.uk"
        },
        {
          "type": "given_name",
          "value": "tilda"
        },
        {
          "type": "last_name",
          "value": "mushu"
        }
      ]
    },
    {
      "external_id": "cb123",
      "type": "PaymentMethod",
      "properties": [
        {
          "type": "payment_name",
          "value": "Credit Card"
        }
      ]
    },
    {
      "external_id": "kl123",
      "type": "PaymentMethod",
      "properties": [
        {
          "type": "payment_name",
          "value": "Klarna"
        }
      ]
    },
    {
      "external_id": "ct123",
      "type": "Contract",
      "properties": [
        {
          "type": "category",
          "value": "Insurance"
        },
        {
          "type": "status",
          "value": "Active"
        },
        {
          "type": "number",
          "value": "hfgrten123",
          "metadata": {
            "assurance_level": 3,
            "source": "BRREG"
          }
        }
      ]
    },
    {
      "external_id": "ct234",
      "type": "Contract",
      "properties": [
        {
          "type": "category",
          "value": "Insurance"
        },
        {
          "type": "status",
          "value": "Active"
        },
        {
          "type": "number",
          "value": "hfgrten234",
          "metadata": {
            "assurance_level": 3,
            "source": "BRREG"
          }
        }
      ]
    },
    {
      "external_id": "ct985",
      "type": "Contract",
      "properties": [
        {
          "type": "category",
          "value": "Insurance"
        },
        {
          "type": "status",
          "value": "Active"
        },
        {
          "type": "number",
          "value": "hfgrten985",
          "metadata": {
            "assurance_level": 3,
            "source": "BRREG"
          }
        }
      ]
    },
    {
      "external_id": "car1",
      "type": "Vehicle",
      "properties": [
        {
          "type": "category",
          "value": "Car"
        },
        {
          "type": "is_active",
          "value": true
        },
        {
          "type": "vin",
          "value": "rtfhcnvjt471"
        }
      ]
    },
    {
      "external_id": "car2",
      "type": "Vehicle",
      "properties": [
        {
          "type": "category",
          "value": "Car"
        },
        {
          "type": "is_active",
          "value": true
        },
        {
          "type": "vin",
          "value": "kdcbfrt178"
        }
      ]
    },
    {
      "external_id": "truck1",
      "type": "Vehicle",
      "properties": [
        {
          "type": "category",
          "value": "Truck"
        },
        {
          "type": "is_active",
          "value": true
        },
        {
          "type": "vin",
          "value": "sncnrkcldp"
        }
      ]
    },
    {
      "external_id": "license1",
      "type": "LicenseNumber",
      "properties": [
        {
          "type": "status",
          "value": "Active"
        },
        {
          "type": "number",
          "value": "AX123456",
          "metadata": {
            "assurance_level": 3,
            "source": "BRREG"
          }
        }
      ]
    },
    {
      "external_id": "license2",
      "type": "LicenseNumber",
      "properties": [
        {
          "type": "status",
          "value": "Active"
        },
        {
          "type": "number",
          "value": "OL123456",
          "metadata": {
            "assurance_level": 3,
            "source": "BRREG"
          }
        }
      ]
    },
    {
      "external_id": "license3",
      "type": "LicenseNumber",
      "properties": [
        {
          "type": "status",
          "value": "Active"
        },
        {
          "type": "number",
          "value": "VN123456",
          "metadata": {
            "assurance_level": 3,
            "source": "BRREG"
          }
        }
      ]
    },
    {
      "external_id": "company1",
      "type": "Company",
      "properties": [
        {
          "type": "name",
          "value": "Company1"
        },
        {
          "type": "registration",
          "value": "256314523"
        }
      ]
    },
    {
      "external_id": "company2",
      "type": "Company",
      "properties": [
        {
          "type": "name",
          "value": "Company2"
        },
        {
          "type": "registration",
          "value": "942365123"
        }
      ]
    },
    {
      "external_id": "application1",
      "type": "Application",
      "properties": [
        {
          "type": "name",
          "value": "Application"
        }
      ]
    },
    {
      "external_id": "application2",
      "type": "Application",
      "properties": [
        {
          "type": "name",
          "value": "Application2"
        }
      ]
    }
  ]
}
```

### Step 2

POST request to capture relationships. Creates connections between nodes: Company-[OWNS]->Vehicle, Person-[ACCEPTED]->Contract, Contract-[COVERS]->Vehicle, Vehicle-[HAS]->LicenseNumber, Person-[HAS]->PaymentMethod.

**POST https://eu.api.indykite.com/capture/v1/relationships/**

```json
{
  "relationships": [
    {
      "source": {
        "external_id": "ryan",
        "type": "Person"
      },
      "target": {
        "external_id": "cb123",
        "type": "PaymentMethod"
      },
      "type": "HAS"
    },
    {
      "source": {
        "external_id": "tilda",
        "type": "Person"
      },
      "target": {
        "external_id": "kl123",
        "type": "PaymentMethod"
      },
      "type": "HAS"
    },
    {
      "source": {
        "external_id": "alice",
        "type": "Person"
      },
      "target": {
        "external_id": "cb123",
        "type": "PaymentMethod"
      },
      "type": "HAS"
    },
    {
      "source": {
        "external_id": "ryan",
        "type": "Person"
      },
      "target": {
        "external_id": "ct123",
        "type": "Contract"
      },
      "type": "ACCEPTED"
    },
    {
      "source": {
        "external_id": "tilda",
        "type": "Person"
      },
      "target": {
        "external_id": "ct234",
        "type": "Contract"
      },
      "type": "ACCEPTED"
    },
    {
      "source": {
        "external_id": "alice",
        "type": "Person"
      },
      "target": {
        "external_id": "ct985",
        "type": "Contract"
      },
      "type": "ACCEPTED"
    },
    {
      "source": {
        "external_id": "ct123",
        "type": "Contract"
      },
      "target": {
        "external_id": "car1",
        "type": "Vehicle"
      },
      "type": "COVERS"
    },
    {
      "source": {
        "external_id": "ct985",
        "type": "Contract"
      },
      "target": {
        "external_id": "car1",
        "type": "Vehicle"
      },
      "type": "COVERS"
    },
    {
      "source": {
        "external_id": "ct234",
        "type": "Contract"
      },
      "target": {
        "external_id": "truck1",
        "type": "Vehicle"
      },
      "type": "COVERS"
    },
    {
      "source": {
        "external_id": "car1",
        "type": "Vehicle"
      },
      "target": {
        "external_id": "license1",
        "type": "LicenseNumber"
      },
      "type": "HAS"
    },
    {
      "source": {
        "external_id": "truck1",
        "type": "Vehicle"
      },
      "target": {
        "external_id": "license2",
        "type": "LicenseNumber"
      },
      "type": "HAS"
    },
    {
      "source": {
        "external_id": "car2",
        "type": "Vehicle"
      },
      "target": {
        "external_id": "license3",
        "type": "LicenseNumber"
      },
      "type": "HAS"
    },
    {
      "source": {
        "external_id": "company1",
        "type": "Company"
      },
      "target": {
        "external_id": "car1",
        "type": "Vehicle"
      },
      "type": "OWNS"
    },
    {
      "source": {
        "external_id": "company1",
        "type": "Company"
      },
      "target": {
        "external_id": "car2",
        "type": "Vehicle"
      },
      "type": "OWNS"
    },
    {
      "source": {
        "external_id": "company1",
        "type": "Company"
      },
      "target": {
        "external_id": "truck1",
        "type": "Vehicle"
      },
      "type": "OWNS"
    },
    {
      "source": {
        "external_id": "application1",
        "type": "Application"
      },
      "target": {
        "external_id": "company1",
        "type": "Company"
      },
      "type": "HAS_AGREEMENT_WITH"
    },
    {
      "source": {
        "external_id": "application2",
        "type": "Application"
      },
      "target": {
        "external_id": "company1",
        "type": "Company"
      },
      "type": "HAS_AGREEMENT_WITH"
    }
  ]
}
```

## Graph After

The graph after the two Capture calls: the nodes of the first request and the relationships of the second. Hover a node for its properties, click it to highlight its neighbourhood.

- Person `alice` (identity): email=alice@email.com, given_name=Alice, last_name=Smith
- Person `ryan` (identity): email=ryan@yahoo.co.uk, given_name=ryan, last_name=mushu
- Person `tilda` (identity): email=tilda@yahoo.co.uk, given_name=tilda, last_name=mushu
- PaymentMethod `cb123`: payment_name=Credit Card
- PaymentMethod `kl123`: payment_name=Klarna
- Contract `ct123`: category=Insurance, status=Active, number=hfgrten123
- Contract `ct234`: category=Insurance, status=Active, number=hfgrten234
- Contract `ct985`: category=Insurance, status=Active, number=hfgrten985
- Vehicle `car1`: category=Car, is_active=true, vin=rtfhcnvjt471
- Vehicle `car2`: category=Car, is_active=true, vin=kdcbfrt178
- Vehicle `truck1`: category=Truck, is_active=true, vin=sncnrkcldp
- LicenseNumber `license1`: status=Active, number=AX123456
- LicenseNumber `license2`: status=Active, number=OL123456
- LicenseNumber `license3`: status=Active, number=VN123456
- Company `company1`: name=Company1, registration=256314523
- Company `company2`: name=Company2, registration=942365123
- Application `application1`: name=Application
- Application `application2`: name=Application2
- `ryan` -[HAS]-> `cb123`
- `tilda` -[HAS]-> `kl123`
- `alice` -[HAS]-> `cb123`
- `ryan` -[ACCEPTED]-> `ct123`
- `tilda` -[ACCEPTED]-> `ct234`
- `alice` -[ACCEPTED]-> `ct985`
- `ct123` -[COVERS]-> `car1`
- `ct985` -[COVERS]-> `car1`
- `ct234` -[COVERS]-> `truck1`
- `car1` -[HAS]-> `license1`
- `truck1` -[HAS]-> `license2`
- `car2` -[HAS]-> `license3`
- `company1` -[OWNS]-> `car1`
- `company1` -[OWNS]-> `car2`
- `company1` -[OWNS]-> `truck1`
- `application1` -[HAS_AGREEMENT_WITH]-> `company1`
- `application2` -[HAS_AGREEMENT_WITH]-> `company1`

## Common Errors

### 401: UNAUTHENTICATED

**Solution:** Check X-IK-ClientKey header contains valid AppAgent credentials

### 400: INVALID_ARGUMENT

**Solution:** Verify node/relationship structure: external_id, type, and properties are required

### 404: knowledge graph not found for this project

**Solution:** The project has no knowledge graph to write to: it was deleted, or it has not finished provisioning yet. The request itself is fine. Check the project in the Hub or via GET /configs/v1/projects/{id}, wait for provisioning to complete, then resend.

### 503: Service Unavailable

**Solution:** The graph backend could not answer right now. Nothing is wrong with the request: retry it with backoff. Batches are idempotent upserts, so resending the same payload is safe.

---

Source: https://developer.indykite.com/resources/capture-1