{
  "id": "capture-1",
  "title": "How do I ingest data into the IndyKite Knowledge Graph (IKG)?",
  "description": "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",
  "tags": [
    "Data Ingestion",
    "Nodes",
    "Relationships",
    "Knowledge Graph",
    "Capture API"
  ],
  "api": "Capture",
  "language": "Json",
  "lastUpdated": "2026-09-22",
  "openApiEndpoints": [
    "/capture/v1/nodes",
    "/capture/v1/relationships"
  ],
  "relatedGuides": [
    "/guides/guide-sandbox",
    "/guides/guide-environment"
  ],
  "commonErrors": [
    {
      "code": "401",
      "message": "UNAUTHENTICATED",
      "solution": "Check X-IK-ClientKey header contains valid AppAgent credentials"
    },
    {
      "code": "400",
      "message": "INVALID_ARGUMENT",
      "solution": "Verify node/relationship structure: external_id, type, and properties are required"
    },
    {
      "code": "404",
      "message": "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."
    },
    {
      "code": "503",
      "message": "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."
    }
  ],
  "summary": "This guide demonstrates how to populate the IndyKite Knowledge Graph (IKG) with data:\n\n1. Capture nodes - Create entities like Person, Company, Vehicle, Contract, LicenseNumber, PaymentMethod\n2. Capture relationships - Connect nodes with typed relationships like OWNS, ACCEPTED, COVERS, HAS\n\nAfter ingestion, the data is available for:\n- ContX IQ queries (context-aware data retrieval)\n- KBAC authorization decisions (Knowledge-Based Access Control)\n- Hub Explorer visualization",
  "usecase": "Scenario: You are building a vehicle rental application and need to store:\n- People who can rent vehicles\n- Companies that own vehicle fleets\n- Vehicles with license numbers\n- Contracts linking people to vehicles\n- Payment methods for billing\n\nThe graph structure enables queries like \"Which vehicles can ryan access?\" or \"Who has a contract for vehicle car1?\"\n\nExample graph after ingestion (three people, three contracts, three vehicles):\nPerson(ryan) -[ACCEPTED]-> Contract(ct123) -[COVERS]-> Vehicle(car1) -[HAS]-> LicenseNumber(license1, number AX123456)\nPerson(alice) -[ACCEPTED]-> Contract(ct985) -[COVERS]-> Vehicle(car1)\nPerson(tilda) -[ACCEPTED]-> Contract(ct234) -[COVERS]-> Vehicle(truck1) -[HAS]-> LicenseNumber(license2)\nCompany(company1) -[OWNS]-> Vehicle(car1), Vehicle(car2), Vehicle(truck1)\nPerson(ryan) -[HAS]-> PaymentMethod(cb123); Person(alice) -[HAS]-> PaymentMethod(cb123); Person(tilda) -[HAS]-> PaymentMethod(kl123)\nApplication(application1) -[HAS_AGREEMENT_WITH]-> Company(company1)",
  "requirements": "Prerequisites:\n- Completed environment setup (see environment-1): Project, Application, Application Agent, and Credentials created\n- AppAgent credentials: The API key (X-IK-ClientKey) generated during environment setup\n\nRequired API access:\n- POST /capture/v1/nodes/ (create/update nodes)\n- POST /capture/v1/relationships/ (create/update relationships)",
  "steps": "Step 1: Ingest Nodes\n- Authentication: AppAgent credential as API key (header: X-IK-ClientKey)\n- Action: POST to /capture/v1/nodes/ with array of node definitions\n- Input: Each node requires: external_id (unique identifier), type (node label), and properties\n- Node types in this example: Person, Company, Vehicle, Contract, LicenseNumber, PaymentMethod\n- Result: Nodes created or updated in the IKG (upsert behavior based on external_id)\n\nStep 2: Ingest Relationships\n- Authentication: AppAgent credential as API key (header: X-IK-ClientKey)\n- Action: POST to /capture/v1/relationships/ with array of relationship definitions\n- Input: Each relationship requires: source node, target node, relationship type, and direction\n- Relationship types in this example: OWNS, ACCEPTED, COVERS, HAS, HAS_AGREEMENT_WITH\n- Result: Relationships created between existing nodes\n\nStep 3: Verify in Hub Explorer\n- Action: Open the IndyKite Hub and navigate to the Explorer\n- Result: Visual graph showing nodes and relationships",
  "graphEnd": {
    "caption": "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.",
    "nodes": [
      {
        "external_id": "alice",
        "type": "Person",
        "is_identity": true,
        "properties": [
          {
            "type": "email",
            "value": "alice@email.com"
          },
          {
            "type": "given_name",
            "value": "Alice"
          },
          {
            "type": "last_name",
            "value": "Smith"
          }
        ]
      },
      {
        "external_id": "ryan",
        "type": "Person",
        "is_identity": true,
        "properties": [
          {
            "type": "email",
            "value": "ryan@yahoo.co.uk"
          },
          {
            "type": "given_name",
            "value": "ryan"
          },
          {
            "type": "last_name",
            "value": "mushu"
          }
        ]
      },
      {
        "external_id": "tilda",
        "type": "Person",
        "is_identity": true,
        "properties": [
          {
            "type": "email",
            "value": "tilda@yahoo.co.uk"
          },
          {
            "type": "given_name",
            "value": "tilda"
          },
          {
            "type": "last_name",
            "value": "mushu"
          }
        ]
      },
      {
        "external_id": "cb123",
        "type": "PaymentMethod",
        "is_identity": false,
        "properties": [
          {
            "type": "payment_name",
            "value": "Credit Card"
          }
        ]
      },
      {
        "external_id": "kl123",
        "type": "PaymentMethod",
        "is_identity": false,
        "properties": [
          {
            "type": "payment_name",
            "value": "Klarna"
          }
        ]
      },
      {
        "external_id": "ct123",
        "type": "Contract",
        "is_identity": false,
        "properties": [
          {
            "type": "category",
            "value": "Insurance"
          },
          {
            "type": "status",
            "value": "Active"
          },
          {
            "type": "number",
            "value": "hfgrten123"
          }
        ]
      },
      {
        "external_id": "ct234",
        "type": "Contract",
        "is_identity": false,
        "properties": [
          {
            "type": "category",
            "value": "Insurance"
          },
          {
            "type": "status",
            "value": "Active"
          },
          {
            "type": "number",
            "value": "hfgrten234"
          }
        ]
      },
      {
        "external_id": "ct985",
        "type": "Contract",
        "is_identity": false,
        "properties": [
          {
            "type": "category",
            "value": "Insurance"
          },
          {
            "type": "status",
            "value": "Active"
          },
          {
            "type": "number",
            "value": "hfgrten985"
          }
        ]
      },
      {
        "external_id": "car1",
        "type": "Vehicle",
        "is_identity": false,
        "properties": [
          {
            "type": "category",
            "value": "Car"
          },
          {
            "type": "is_active",
            "value": true
          },
          {
            "type": "vin",
            "value": "rtfhcnvjt471"
          }
        ]
      },
      {
        "external_id": "car2",
        "type": "Vehicle",
        "is_identity": false,
        "properties": [
          {
            "type": "category",
            "value": "Car"
          },
          {
            "type": "is_active",
            "value": true
          },
          {
            "type": "vin",
            "value": "kdcbfrt178"
          }
        ]
      },
      {
        "external_id": "truck1",
        "type": "Vehicle",
        "is_identity": false,
        "properties": [
          {
            "type": "category",
            "value": "Truck"
          },
          {
            "type": "is_active",
            "value": true
          },
          {
            "type": "vin",
            "value": "sncnrkcldp"
          }
        ]
      },
      {
        "external_id": "license1",
        "type": "LicenseNumber",
        "is_identity": false,
        "properties": [
          {
            "type": "status",
            "value": "Active"
          },
          {
            "type": "number",
            "value": "AX123456"
          }
        ]
      },
      {
        "external_id": "license2",
        "type": "LicenseNumber",
        "is_identity": false,
        "properties": [
          {
            "type": "status",
            "value": "Active"
          },
          {
            "type": "number",
            "value": "OL123456"
          }
        ]
      },
      {
        "external_id": "license3",
        "type": "LicenseNumber",
        "is_identity": false,
        "properties": [
          {
            "type": "status",
            "value": "Active"
          },
          {
            "type": "number",
            "value": "VN123456"
          }
        ]
      },
      {
        "external_id": "company1",
        "type": "Company",
        "is_identity": false,
        "properties": [
          {
            "type": "name",
            "value": "Company1"
          },
          {
            "type": "registration",
            "value": "256314523"
          }
        ]
      },
      {
        "external_id": "company2",
        "type": "Company",
        "is_identity": false,
        "properties": [
          {
            "type": "name",
            "value": "Company2"
          },
          {
            "type": "registration",
            "value": "942365123"
          }
        ]
      },
      {
        "external_id": "application1",
        "type": "Application",
        "is_identity": false,
        "properties": [
          {
            "type": "name",
            "value": "Application"
          }
        ]
      },
      {
        "external_id": "application2",
        "type": "Application",
        "is_identity": false,
        "properties": [
          {
            "type": "name",
            "value": "Application2"
          }
        ]
      }
    ],
    "relationships": [
      {
        "source": "ryan",
        "target": "cb123",
        "type": "HAS",
        "properties": []
      },
      {
        "source": "tilda",
        "target": "kl123",
        "type": "HAS",
        "properties": []
      },
      {
        "source": "alice",
        "target": "cb123",
        "type": "HAS",
        "properties": []
      },
      {
        "source": "ryan",
        "target": "ct123",
        "type": "ACCEPTED",
        "properties": []
      },
      {
        "source": "tilda",
        "target": "ct234",
        "type": "ACCEPTED",
        "properties": []
      },
      {
        "source": "alice",
        "target": "ct985",
        "type": "ACCEPTED",
        "properties": []
      },
      {
        "source": "ct123",
        "target": "car1",
        "type": "COVERS",
        "properties": []
      },
      {
        "source": "ct985",
        "target": "car1",
        "type": "COVERS",
        "properties": []
      },
      {
        "source": "ct234",
        "target": "truck1",
        "type": "COVERS",
        "properties": []
      },
      {
        "source": "car1",
        "target": "license1",
        "type": "HAS",
        "properties": []
      },
      {
        "source": "truck1",
        "target": "license2",
        "type": "HAS",
        "properties": []
      },
      {
        "source": "car2",
        "target": "license3",
        "type": "HAS",
        "properties": []
      },
      {
        "source": "company1",
        "target": "car1",
        "type": "OWNS",
        "properties": []
      },
      {
        "source": "company1",
        "target": "car2",
        "type": "OWNS",
        "properties": []
      },
      {
        "source": "company1",
        "target": "truck1",
        "type": "OWNS",
        "properties": []
      },
      {
        "source": "application1",
        "target": "company1",
        "type": "HAS_AGREEMENT_WITH",
        "properties": []
      },
      {
        "source": "application2",
        "target": "company1",
        "type": "HAS_AGREEMENT_WITH",
        "properties": []
      }
    ]
  },
  "code": [
    {
      "step": "Step 1",
      "description": "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.",
      "filename": "POST https://eu.api.indykite.com/capture/v1/nodes/",
      "language": "Json",
      "ingest": {
        "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": "Step 2",
      "description": "POST request to capture relationships. Creates connections between nodes: Company-[OWNS]->Vehicle, Person-[ACCEPTED]->Contract, Contract-[COVERS]->Vehicle, Vehicle-[HAS]->LicenseNumber, Person-[HAS]->PaymentMethod.",
      "filename": "POST https://eu.api.indykite.com/capture/v1/relationships/",
      "language": "Json",
      "ingest": {
        "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"
          }
        ]
      }
    }
  ],
  "links": {
    "html": "/resources/capture-1",
    "markdown": "/resources/capture-1.md",
    "openApi": "https://openapi.indykite.com/"
  }
}