ContX IQ: With _Application as a service, create a Person node and link it to 2 existing nodes.
Use the _Application node created with a new Application and new AppAgent configurations to create a new node and link it to existing nodes.
Use case
When a new Application with new credentials is created, _Application and _AppAgent nodes are created in the IKG.
In order to create a node and a relationship between the node and existing data, a CIQ write query can be used.
You will use the _Application as an authenticated subject.
In this case, a Country node and a Company node are created. We create a new Person node and link it to the 2 existing nodes.

Requirements
- ServiceAccount credentials created in the IndyKite Hub for your organization.
- AppAgent credentials created in the IndyKite Hub, using the REST endpoints or using Terraform for your Project / Application.
Steps
1. Using the AppAgent credential as API Key (name: X-IK-ClientKey), ingest data in your IKG (IndyKite Knowledge Graph) using the script provided.
2. Using the ServiceAccount credential as Bearer token, create a CIQ Policy.
3. Using the ServiceAccount credential as Bearer token, create a CIQ Query.
4. Using the AppAgent credential as API Key (name: X-IK-ClientKey), run a CIQ Execution.
5. Delete your configuration.
Step 1
Ingest the nodes needed for this use case.
{
"nodes": [
{
"external_id": "Norway",
"type": "Country"
},
{
"external_id": "Forsenty",
"type": "Company"
}
]
}Step 2
Policy which designates the derived query can create a Person node, a relationship with a Country node, and a relationship with a Company node.
{
"meta": {
"policy_version": "1.0-ciq"
},
"subject": {
"type": "_Application"
},
"condition": {
"cypher": "MATCH (subject:_Application) MATCH (country:Country) MATCH (company:Company)",
"filter": [
{
"app": "app1",
"operator": "AND",
"operands": [
{
"attribute": "subject.external_id",
"operator": "=",
"value": "$_appId"
},
{
"attribute": "country.external_id",
"operator": "=",
"value": "$country_external_id"
},
{
"attribute": "company.external_id",
"operator": "=",
"value": "$company_external_id"
}
]
}
]
},
"allowed_reads": {
"nodes": [
"country",
"country.*",
"company",
"company.*"
]
},
"allowed_upserts": {
"nodes": {
"node_types": [
"Person"
]
},
"relationships": {
"relationship_types": [
{
"type": "BELONGS_TO",
"source_node_label": "Person",
"target_node_label": "Country"
},
{
"type": "BELONGS_TO",
"source_node_label": "Person",
"target_node_label": "Company"
}
]
}
}
}Request to create a CIQ Policy configuration using REST.
{
"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 (country:Country) MATCH (company:Company)\",\"filter\":[{\"app\":\"app1\",\"operator\":\"AND\",\"operands\":[{\"attribute\":\"subject.external_id\",\"operator\":\"=\",\"value\":\"$_appId\"},{\"attribute\":\"country.external_id\",\"operator\":\"=\",\"value\":\"$country_external_id\"},{\"attribute\":\"company.external_id\",\"operator\":\"=\",\"value\":\"$company_external_id\"}]}]},\"allowed_reads\":{\"nodes\":[\"country\",\"country.*\",\"company\",\"company.*\"]},\"allowed_upserts\":{\"nodes\":{\"node_types\":[\"Person\"]},\"relationships\":{\"relationship_types\":[{\"type\":\"BELONGS_TO\",\"source_node_label\":\"Person\",\"target_node_label\":\"Country\"},{\"type\":\"BELONGS_TO\",\"source_node_label\":\"Person\",\"target_node_label\":\"Company\"}]}}}",
"status": "ACTIVE",
"tags": []
}Request to read the CIQ Policy configuration using REST.
{
"id": "your_policy_configuration_gid"
}Step 3
The CIQ Knowledge Query designates the node to create and the relationships to upsert.
{
"nodes": [
"person",
"person.external_id"
],
"relationships": [],
"upsert_nodes": [
{
"name": "person",
"type": "Person",
"external_id": "$person_external_id",
"properties": [
{
"type": "VerificationMethod",
"value": "$verification_method",
"metadata": [
{
"type": "Assurance_level",
"value": "$assurance_level"
},
{
"type": "source",
"value": "$source"
}
]
},
{
"type": "Email",
"value": "$email",
"metadata": [
{
"type": "Assurance_level",
"value": "$assurance_level"
},
{
"type": "source",
"value": "$source"
}
]
},
{
"type": "PhoneNumber",
"value": "$phone_number",
"metadata": [
{
"type": "assurance_level",
"value": "$assurance_level"
},
{
"type": "source",
"value": "$source"
}
]
},
{
"type": "FirstName",
"value": "$first_name",
"metadata": [
{
"type": "assurance_level",
"value": "$assurance_level"
},
{
"type": "source",
"value": "$source"
}
]
},
{
"type": "LastName",
"value": "$last_name",
"metadata": [
{
"type": "assurance_level",
"value": "$assurance_level"
},
{
"type": "source",
"value": "$source"
}
]
}
]
}
],
"upsert_relationships": [
{
"name": "rel1",
"source": "person",
"target": "country",
"type": "BELONGS_TO",
"properties": []
},
{
"name": "rel2",
"source": "person",
"target": "company",
"type": "BELONGS_TO",
"properties": []
}
]
}Request to create a CIQ Knowledge Query configuration using REST.
{
"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\":[\"person\",\"person.external_id\"],\"relationships\":[],\"upsert_nodes\":[{\"name\":\"person\",\"type\":\"Person\",\"external_id\":\"$person_external_id\",\"properties\":[{\"type\":\"VerificationMethod\",\"value\":\"$verification_method\",\"metadata\":[{\"type\":\"Assurance_level\",\"value\":\"$assurance_level\"},{\"type\":\"source\",\"value\":\"$source\"}]},{\"type\":\"Email\",\"value\":\"$email\",\"metadata\":[{\"type\":\"Assurance_level\",\"value\":\"$assurance_level\"},{\"type\":\"source\",\"value\":\"$source\"}]},{\"type\":\"PhoneNumber\",\"value\":\"$phone_number\",\"metadata\":[{\"type\":\"assurance_level\",\"value\":\"$assurance_level\"},{\"type\":\"source\",\"value\":\"$source\"}]},{\"type\":\"FirstName\",\"value\":\"$first_name\",\"metadata\":[{\"type\":\"assurance_level\",\"value\":\"$assurance_level\"},{\"type\":\"source\",\"value\":\"$source\"}]},{\"type\":\"LastName\",\"value\":\"$last_name\",\"metadata\":[{\"type\":\"assurance_level\",\"value\":\"$assurance_level\"},{\"type\":\"source\",\"value\":\"$source\"}]}]}],\"upsert_relationships\":[{\"name\":\"rel1\",\"source\":\"person\",\"target\":\"country\",\"type\":\"BELONGS_TO\",\"properties\":[]},{\"name\":\"rel2\",\"source\":\"person\",\"target\":\"company\",\"type\":\"BELONGS_TO\",\"properties\":[]}]}",
"status": "ACTIVE"
}Read the CIQ Query Configuration.
{
"id": "your_knowledge_query_configuration_gid"
}Step 4
CIQ Execution request in json format.
{
"id": "knowledge_query_gid",
"input_params": {
"person_external_id": "456985",
"verification_method": "BREGG",
"assurance_level": 3,
"source": "NAV",
"email": "elias@email.com",
"phone_number": "4725639685",
"first_name": "Elias",
"last_name": "Boomy",
"country_external_id": "Norway",
"company_external_id": "Forsenty"
},
"page_token": 1
}CIQ Execution response in json format.
{
"data": [
{
"nodes": {
"person": {
"Id": 5,
"ElementId": "4:a5c213aa-aa4b-4be5-a17a-a677a80ee634:5",
"Labels": [
"Unique",
"Resource",
"Person"
],
"Props": {
"create_time": "2025-09-26T11:29:25.43Z",
"external_id": "456985",
"id": "I2kGlVoQQHmj_gfNvH4b-A",
"type": "Person",
"update_time": "2025-09-26T11:29:25.43Z"
}
},
"person.external_id": "456985"
}
}
]
}Step 5
Delete the CIQ Query.
{
"id": "your_knowledge_query_configuration_gid"
}Delete the CIQ Policy.
{
"id": "your_policy_configuration_gid"
}