{
  "id": "ciq-basic",
  "title": "ContX IQ: Which license numbers can a person access?",
  "description": "Query the IndyKite Knowledge Graph (IKG) to retrieve all vehicle license numbers that a specific person is authorized to view based on their contractual relationships.",
  "category": "ContX IQ",
  "tags": [
    "ContX IQ Policy",
    "ContX IQ Query",
    "ContX IQ Execution",
    "Read Authorization",
    "Graph Traversal"
  ],
  "api": "ContX IQ",
  "language": "Python",
  "lastUpdated": "2026-03-20",
  "openApiEndpoints": [
    "/capture/v1/nodes",
    "/capture/v1/relationships",
    "/configs/v1/authorization-policies",
    "/configs/v1/knowledge-queries",
    "/contx-iq/v1/execute"
  ],
  "relatedGuides": [
    "/guides/guide-contx-iq",
    "/guides/guide-sandbox"
  ],
  "commonErrors": [
    {
      "code": "401",
      "message": "UNAUTHENTICATED",
      "solution": "Check credentials: ServiceAccount Bearer token for config APIs, X-IK-ClientKey for execution"
    },
    {
      "code": "404",
      "message": "NOT_FOUND",
      "solution": "Verify the knowledge query ID exists and belongs to your project"
    },
    {
      "code": "400",
      "message": "INVALID_ARGUMENT",
      "solution": "Check that all required input parameters are provided in the execution request"
    }
  ],
  "summary": "This example demonstrates how to:\n\n1. Create an authorization policy that defines read access to LicenseNumber nodes\n2. Create a query that retrieves license numbers based on the policy\n3. Execute the query to get results filtered by authorization rules\n\nThe policy grants a Person access to LicenseNumber nodes when a path exists: Person -> ACCEPTED -> Contract -> COVERS -> Vehicle -> HAS -> LicenseNumber.",
  "usecase": "Scenario: Ryan (a Person node) has accepted Contract1, which covers Vehicle \"Car1\" owned by Company1. Car1 has LicenseNumber \"ABC-123\".\n\nGoal: Ryan wants to retrieve all license numbers for vehicles he is contractually allowed to use.\n\nExpected result: The query returns \"ABC-123\" because the relationship path exists:\nRyan -> ACCEPTED -> Contract1 -> COVERS -> Car1 -> HAS -> ABC-123",
  "requirements": "Prerequisites:\n- ServiceAccount credentials: Created in IndyKite Hub for your organization (used for policy/query configuration)\n- AppAgent credentials: Created in IndyKite Hub for your Project/Application (used for data ingestion and query execution)\n\nRequired API access:\n- POST /capture/v1/nodes/ (capture nodes)\n- POST /capture/v1/relationships/ (capture relationships)\n- POST /configs/v1/authorization-policies (create policy)\n- POST /configs/v1/knowledge-queries (create query)\n- POST /contx-iq/v1/execute (run query)",
  "steps": "Step 1: Ingest Graph Data\n- Authentication: AppAgent credential as API key (header: X-IK-ClientKey)\n- Action: POST nodes and relationships to build the graph\n- Result: Person, Contract, Vehicle, LicenseNumber, and Company nodes created with relationships\n\nStep 2: Create Authorization Policy\n- Authentication: ServiceAccount credential as Bearer token\n- Action: POST policy configuration to /configs/v1/authorization-policies\n- Policy logic: Grants READ access to LicenseNumber nodes when the subject (_Application) connects through the relationship path\n- Key parameter: Filter uses $_appId (auto-populated system variable for the calling Application's ID)\n- Result: Policy ID returned for reference\n\nStep 3: Create ContX IQ Query\n- Authentication: ServiceAccount credential as Bearer token\n- Action: POST query configuration to /configs/v1/knowledge-queries\n- Query logic: Traverses from Person (matched by email) through relationships to return LicenseNumber values\n- Result: Query ID returned for reference\n\nStep 4: Execute Query\n- Authentication: AppAgent credential as API key (header: X-IK-ClientKey)\n- Action: POST to /contx-iq/v1/execute with query ID and input parameters\n- Input parameter: email (e.g., \"ryan@example.com\")\n- Result: Array of license numbers the person can access\n\nStep 5: Cleanup\n- Action: DELETE the query and policy configurations\n- Note: This does not delete ingested graph data",
  "graph": {
    "caption": "The graph the example runs on: 18 nodes (3 Person, 2 PaymentMethod, 3 Contract, 3 Vehicle, 3 LicenseNumber, 2 Company, 2 Application) and 17 relationships (HAS, ACCEPTED, COVERS, OWNS, HAS_AGREEMENT_WITH). 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 1a",
      "description": "Capture nodes into the IKG. Creates Person, Company, Vehicle, Contract, LicenseNumber, and PaymentMethod nodes with their properties.",
      "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 1b",
      "description": "Capture relationships between nodes. Creates ACCEPTED, COVERS, OWNS, HAS, and HAS_AGREEMENT_WITH relationship types.",
      "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"
          }
        ]
      }
    },
    {
      "step": "Step 2a",
      "description": "Authorization policy JSON. Defines that subjects matching the _Application type can READ LicenseNumber nodes when connected via Person -> Contract -> Vehicle -> LicenseNumber path.",
      "filename": "policy.json",
      "language": "Json",
      "ingest": {
        "meta": {
          "policy_version": "1.0-ciq"
        },
        "subject": {
          "type": "_Application"
        },
        "condition": {
          "cypher": "MATCH (subject:_Application) MATCH (person:Person)-[r1:ACCEPTED]->(contract:Contract)-[r2:COVERS]->(vehicle:Vehicle)-[r3:HAS]->(ln:LicenseNumber)",
          "filter": [
            {
              "operator": "AND",
              "operands": [
                {
                  "attribute": "person.property.email",
                  "operator": "=",
                  "value": "$person_email"
                },
                {
                  "attribute": "subject.external_id",
                  "operator": "=",
                  "value": "$_appId"
                }
              ]
            }
          ]
        },
        "allowed_reads": {
          "nodes": [
            "ln.property.number",
            "ln.property.transferrable"
          ],
          "relationships": []
        }
      }
    },
    {
      "step": "Step 2b",
      "description": "POST request body to create the authorization policy. Wraps the policy JSON with location (project ID) and metadata.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/authorization-policies",
      "language": "Json",
      "ingest": {
        "project_id": "your_project_gid",
        "description": "description of policy",
        "display_name": "policy name",
        "name": "policy-name",
        "policy": "{\"meta\":{\"policy_version\":\"1.0-ciq\"},\"subject\":{\"type\":\"_Application\"},\"condition\":{\"cypher\":\"MATCH (subject:_Application) MATCH (person:Person)-[r1:ACCEPTED]->(contract:Contract)-[r2:COVERS]->(vehicle:Vehicle)-[r3:HAS]->(ln:LicenseNumber)\",\"filter\":[{\"operator\":\"AND\",\"operands\":[{\"attribute\":\"person.property.email\",\"operator\":\"=\",\"value\":\"$person_email\"},{\"attribute\":\"subject.external_id\",\"operator\":\"=\",\"value\":\"$_appId\"}]}]},\"allowed_reads\":{\"nodes\":[\"ln.property.number\",\"ln.property.transferrable\"],\"relationships\":[]}}",
        "status": "ACTIVE",
        "tags": []
      }
    },
    {
      "step": "Step 2b (Python)",
      "description": "Python SDK equivalent: Creates the same authorization policy using the IndyKite Python client library.",
      "filename": "create_policy.py",
      "language": "Python",
      "code": "\nimport http.client\n\nconn = http.client.HTTPSConnection(\"eu.api.indykite.com\")\n\npayload = \"{\"description\": \"\",\n  \"display_name\": \"\",\n  \"name\": \"\",\n  \"policy\": \"\",\n  \"project_id\": \"\",\n  \"status\": \"ACTIVE\",\n  \"tags\": [\n    \"\"\n  ]}\"\nheaders = {\n    'Content-Type': \"application/json\",\n    'Authorization': \"YOUR_SECRET_TOKEN\"\n}\n\nconn.request(\"POST\", \"/configs/v1/authorization-policies\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\n"
    },
    {
      "step": "Step 2c",
      "description": "GET request to verify the policy was created. Returns the full policy configuration including system-generated ID and timestamps.",
      "filename": "GET https://eu.api.indykite.com/configs/v1/authorization-policies/{policy_id}",
      "language": "Json",
      "ingest": {
        "id": "your_policy_configuration_gid"
      }
    },
    {
      "step": "Step 2c (Python)",
      "description": "Python SDK equivalent: Reads the policy configuration to verify creation.",
      "filename": "read_policy.py",
      "language": "Python",
      "code": "\nimport http.client\n\nconn = http.client.HTTPSConnection(\"eu.api.indykite.com\")\nheaders = { 'Authorization': \"YOUR_SECRET_TOKEN\" }\nconn.request(\"GET\", \"/configs/v1/authorization-policies/{{id}}\", headers=headers)\nres = conn.getresponse()\ndata = res.read()\n"
    },
    {
      "step": "Step 3a",
      "description": "Knowledge query JSON. Defines a Cypher-like query that: (1) matches a Person by email input parameter, (2) traverses to LicenseNumber nodes via contracts, (3) returns license number values.",
      "filename": "knowledge_query.json",
      "language": "Json",
      "ingest": {
        "nodes": [
          "ln.property.number"
        ],
        "filter": {
          "attribute": "ln.property.number",
          "operator": "=",
          "value": "$ln_number"
        }
      }
    },
    {
      "step": "Step 3b",
      "description": "POST request body to create the knowledge query. Links the query to the authorization policy created in Step 2.",
      "filename": "POST https://eu.api.indykite.com/configs/v1/knowledge-queries",
      "language": "Json",
      "ingest": {
        "project_id": "your_project_gid",
        "description": "description of knowledge query",
        "display_name": "knowledge query name",
        "name": "knowledge-query-name",
        "policy_id": "your_policy_gid",
        "query": "{\"nodes\":[\"ln.property.number\"],\"filter\":{\"attribute\":\"ln.property.number\",\"operator\":\"=\",\"value\":\"$ln_number\"}}",
        "status": "ACTIVE"
      }
    },
    {
      "step": "Step 3b (Python)",
      "description": "Python SDK equivalent: Creates the knowledge query using the IndyKite Python client library.",
      "filename": "create_knowledge_query.py",
      "language": "Python",
      "code": "\nimport http.client\n\nconn = http.client.HTTPSConnection(\"eu.api.indykite.com\")\n\npayload = \"{\"description\": \"\",\n  \"display_name\": \"\",\n  \"name\": \"\",\n  \"policy_id\": \"\",\n  \"project_id\": \"\",\n  \"query\": \"\",\n  \"status\": \"ACTIVE\"}\"\n\nheaders = {\n    'Content-Type': \"application/json\",\n    'Authorization': \"YOUR_SECRET_TOKEN\"\n}\n\nconn.request(\"POST\", \"/configs/v1/knowledge-queries\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n"
    },
    {
      "step": "Step 3c",
      "description": "GET request to verify the query was created. Returns the full query configuration including system-generated ID.",
      "filename": "GET https://eu.api.indykite.com/configs/v1/knowledge-queries/{query_id}",
      "language": "Json",
      "ingest": {
        "id": "your_knowledge_query_configuration_gid"
      }
    },
    {
      "step": "Step 3c (Python)",
      "description": "Python SDK equivalent: Reads the query configuration to verify creation.",
      "filename": "read_knowledge_query.py",
      "language": "Python",
      "code": "\nimport http.client\n\nconn = http.client.HTTPSConnection(\"eu.api.indykite.com\")\n\nheaders = { 'Authorization': \"YOUR_SECRET_TOKEN\" }\n\nconn.request(\"GET\", \"/configs/v1//knowledge-queries/{id}\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))\n"
    },
    {
      "step": "Step 4a",
      "description": "Execute query request. Provides the query ID and input parameters (email). The system evaluates authorization and returns only permitted results.",
      "filename": "POST https://eu.api.indykite.com/contx-iq/v1/execute",
      "language": "Json",
      "ingest": {
        "id": "knowledge_query_gid",
        "input_params": {
          "ln_number": "AX123456",
          "person_email": "ryan@yahoo.co.uk"
        }
      }
    },
    {
      "step": "Step 4a (Python)",
      "description": "Python SDK equivalent: Executes the ContX IQ query with the same parameters.",
      "filename": "execute_query.py",
      "language": "Python",
      "code": "\nimport http.client\n\nconn = http.client.HTTPSConnection(\"eu.api.indykite.com\")\n\npayload = \"{\"id\": \"knowledge_query_gid\",\n  \"input_params\": {\"ln_number\": \"AX123456\",\"person_email\": \"ryan@yahoo.co.uk\"}\n }\"\n\nheaders = {\n    'Content-Type': \"application/json\",\n    'Authorization': \"YOUR_SECRET_TOKEN\"\n}\n\nconn.request(\"POST\", \"/contx-iq/v1/execute\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n"
    },
    {
      "step": "Step 4b",
      "description": "Expected response. Contains an array of license number strings that the queried person is authorized to access.",
      "filename": "response.json",
      "language": "Json",
      "ingest": {
        "data": [
          {
            "nodes": {
              "ln.property.number": "AX123456"
            }
          }
        ]
      }
    },
    {
      "step": "Step 5a",
      "description": "DELETE request to remove the knowledge query. Use the query ID returned from Step 3.",
      "filename": "DELETE https://eu.api.indykite.com/configs/v1/knowledge-queries/{query_id}",
      "language": "Json",
      "ingest": {
        "id": "your_knowledge_query_configuration_gid"
      }
    },
    {
      "step": "Step 5a (Python)",
      "description": "Python SDK equivalent: Deletes the knowledge query configuration.",
      "filename": "delete_knowledge_query.py",
      "language": "Python",
      "code": "\nimport http.client\n\nconn = http.client.HTTPSConnection(\"eu.api.indykite.com)\n\nheaders = { 'Authorization': \"Bearer ...\" }\n\nconn.request(\"DELETE\", \"/configs/v1/knowledge-queries/{id}\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))\n"
    },
    {
      "step": "Step 5b",
      "description": "DELETE request to remove the authorization policy. Use the policy ID returned from Step 2.",
      "filename": "DELETE https://eu.api.indykite.com/configs/v1/authorization-policies/{policy_id}",
      "language": "Json",
      "ingest": {
        "id": "your_policy_configuration_gid"
      }
    },
    {
      "step": "Step 5b (Python)",
      "description": "Python SDK equivalent: Deletes the authorization policy configuration.",
      "filename": "delete_policy.py",
      "language": "Python",
      "code": "\nimport http.client\n\nconn = http.client.HTTPSConnection(\"eu.api.indykite.com\")\n\nheaders = { 'Authorization': \"Bearer ...\", 'Content-Type': \"application/json\" }\n\nconn.request(\"DELETE\", \"/configs/v1/authorization-policies/{id}\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n"
    }
  ],
  "links": {
    "html": "/resources/ciq-basic",
    "markdown": "/resources/ciq-basic.md",
    "openApi": "https://openapi.indykite.com/"
  }
}