Skip to content

VecML GraphDB REST API (v0.3)

This document describes the HTTP/JSON interface exposed by the VecML Graph Database RESTful API, including:

  • Endpoint URL
  • Expected Request Body (JSON)
  • Response Format (JSON)
  • Relevant Details or Constraints
  • Example Requests / Responses

All RESTful API calls to the VecML cloud graph database should be sent to: https://graphdb.vecml.com/api. All endpoints require a JSON body unless otherwise noted.

Rate and request size limit

For resource allocation and server stability, the server enforces a rate limit on the number of API calls per second. If exceeded, the server responds with:

400 Bad Request
Request limit reached, please try again later
Please avoid high-frequency API calls. For example, when inserting multiple entities, please use /batch_create_entity instead of iteratively calling /create_entity.

The size of each request cannot exceed 200MB.

Managing Unique IDs for the graph

Entities and Relationships are identified by UNIQUE string IDs. An entity and relationship can have the same name as they are defined in different namespaces.

Authentication (API key):

VecML RESTful API requests are authenticated through user's API key. The API key can be generated as follows:

  1. Go to https://account.vecml.com/user-api-keys , sign up for a free VecML account.
  2. After registration, you can get an API key by clicking "Create New API Key".
  3. This unique API key will only be seen once at the creation time, so please keep the API key safely. If you need to re-generate an API key, simply delete the previous one and then create a new key.

An Example Workflow

import requests, json, time

# Configuration
API_KEY = "replace_this_with_your_api_key"
BASE_URL = "https://graphdb.vecml.com/api"
GRAPH_ID  = "cinema_graph"

def post(endpoint: str, payload: dict):
    url  = f"{BASE_URL}/{endpoint}"
    resp = requests.post(url, json=payload, timeout=30)
    print(f"[{resp.status_code}] {endpoint}")
    time.sleep(0.1)
    if not resp.ok:
        raise RuntimeError(resp.text)
    return resp.json() if resp.text else None

try:
  post("remove_graph", {"user_api_key": API_KEY, "graph_id": GRAPH_ID})
except Exception as e:
    # Fallback for any other exception
    print("Something went wrong:", e)
finally:
    pass

# 1️⃣  ─ Create the graph (idempotent if already exists)
post("create_graph", {"user_api_key": API_KEY, "graph_id": GRAPH_ID})

# 2️⃣  ─ Add entities with attributes
entities = [
    ("entity1", {"name": "Tom Cruise", "type": "Person", "profession": "Actor",    "born": "1962"}),
    ("entity2", {"name": "Emily Blunt", "type": "Person", "profession": "Actor",    "born": "1983"}),
    ("entity3", {"name": "Christopher McQuarrie", "type": "Person", "profession": "Director","born": "1968"}),
    ("entity4", {"name": "Edge of Tomorrow", "type": "Movie",  "year": "2014", "genre": "Sci-Fi"}),
    ("entity5", {"name": "Mission Impossible – Fallout", "type": "Movie", "year": "2018", "genre": "Action"})
]
for eid, attrs in entities:
    post("create_entity", {"user_api_key": API_KEY, "graph_id": GRAPH_ID, "entity_id": eid})
    post("set_entity_attributes", {
        "user_api_key": API_KEY, "graph_id": GRAPH_ID,
        "entity_id": eid, "attributes": attrs
    })

# 3️⃣  ─ Create relationships with attributes
relationships = [
    ("entity1", "acted_in_movie", "entity4"),
    ("entity2", "acted_in_movie", "entity4"),
    ("entity3", "directed_movie", "entity4"),
    ("entity1", "acted_in_1", "entity5"),
    ("entity3", "directed_movie", "entity5")
]

relationships_attributes = [
    ("acted_in_movie", {"type": "acted_in", "media": "movie", "role_type": "on_screen"}),
    ("directed_movie", {"type": "directed", "media": "movie", "role_type": "behind_the_scenes"}),
    ("acted_in_1", {"type": "acted_in", "media": "movie", "role": "main_character", "role_type": "on_screen"})
]

for src, rel, dst in relationships:
    post("create_relationship", {
        "user_api_key": API_KEY, "graph_id": GRAPH_ID,
        "src_entity_id": src, "relationship_id": rel, "dest_entity_id": dst
    })

for rel, attrs in relationships_attributes:
    post("set_relationship_attributes", {
        "user_api_key": API_KEY, "graph_id": GRAPH_ID,
        "relationship_id": rel, "attributes": attrs
    })

# 4️⃣  ─ Build an Entity Attribute Index on the "type" attribute
post("create_entity_index", {
    "user_api_key": API_KEY, "graph_id": GRAPH_ID,
    "attribute_name": "type",
    "index_type":     "Attribute Index"
})

# 5️⃣  ─ Search the index for nodes with type "Person”
search_resp = post("search_entity_index", {
    "user_api_key": API_KEY, "graph_id": GRAPH_ID,
    "attribute_name": "type", "index_type": "Attribute Index",
    "attribute_value": "Person", "top_k": 5
})

print("\n≈≈≈ Search results for 'Person' ≈≈≈")
for idx, eid in enumerate(search_resp["entity_ids"], 1):
    print(f"{idx}. {eid}") # This should print out entity1, entity2, entity3

# 6️⃣  ─ Build a Relationship Attribute Index on the "role_type" attribute
post("create_relationship_index", {
    "user_api_key": API_KEY, "graph_id": GRAPH_ID,
    "attribute_name": "role_type",
    "index_type":     "Attribute Index"
})

# 7️⃣  ─ Search the index for edges with type "on_screen"
search_resp = post("search_relationship_index", {
    "user_api_key": API_KEY, "graph_id": GRAPH_ID,
    "attribute_name": "role_type", "index_type": "Attribute Index",
    "attribute_value": "on_screen", "top_k": 5
})

print("\n≈≈≈ Search results for 'Person' ≈≈≈")
for idx, eid in enumerate(search_resp["relationship_ids"], 1):
    print(f"{idx}. {eid}") # This should print out acted_in_movie, acted_in_1

1. User API

1.1 /create_graph

Description

Creates a graph under the specified graph_id for the user.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "use_job": false
}
  • use_job (optional, default false): Set to true to enqueue the request; retrieve the finished payload via /get_job_result.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid field
  • 403: Invalid API Key.
  • 409: Graph already exists.
  • 500: Internal server error.

Example

POST /create_graph
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

1.2 /remove_graph

Description

Removes the graph identified by graph_id for the given user. The server will return 202, indicating that the deletion is in progress and will succeed (after other operations on this graph are completed).

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "use_job": false
}
  • use_job (optional, default false): Set to true to enqueue the request; retrieve the finished payload via /get_job_result.

Response

Success Response (202 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid field
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 500: Internal server error.

Example

POST /remove_graph
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

1.3 /get_graphs

Description

Retrieves the list of graph IDs available to the user.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "use_job": false
}
  • use_job (optional, default false): Set to true to enqueue the request; retrieve the finished payload via /get_job_result.

Response

Success Response (200 OK):

{
  "graph_ids": ["string", ...]
}

Error Responses:

  • 400: Missing or invalid field
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /get_graphs
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "use_job": false
}

Response:

{
  "graph_ids": ["graph1", "graph2", "graph3"]
}

1.4 /init_graph

Description

Initializes an existing graph, loading its data into memory for use.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "use_job": false
}

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid field
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 500: Internal server error.

Example

POST /init_graph
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

1.5 /create_checkpoint

Description

Creates a transactional checkpoint for the specified graph. The server returns a transaction_id that can be supplied later to /revert_checkpoint in order to roll the graph back to the saved state.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "use_job": false
}
  • use_job (optional, default false): When true, enqueue the checkpoint work as an asynchronous job. See Server Job API for polling semantics.

Response

{
  "error_code": "Success",
  "transaction_id": integer
}

Error Responses:

  • 400: Missing or invalid field.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 500: Internal server error.

Example

POST /create_checkpoint
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "transaction_id": 42
}

1.6 /revert_checkpoint

Description

Restores a graph to a previously recorded checkpoint identified by transaction_id.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "transaction_id": integer,
  "use_job": false
}
  • transaction_id: Identifier returned by /create_checkpoint.
  • use_job (optional, default false): Run the revert asynchronously.

Response

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid field.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 500: Internal server error.

Example

POST /revert_checkpoint
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "transaction_id": 42,
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

2. Basic Graph API

2.1 /create_entity

Description

Creates a new entity (node) within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "entity_id": "string",
  "use_job": false
}
  • use_job (optional, default false): Submit the creation request asynchronously; see Server Job API.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 409: Entity already exists.
  • 500: Internal server error.

Example

POST /create_entity
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_id": "entity",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

2.2 /remove_entity

Description

Removes an existing entity (node) from the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "entity_id": "string",
  "use_job": false
}
  • use_job (optional, default false): Submit the deletion asynchronously; see Server Job API.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Entity does not exist.
  • 500: Internal server error.

Example

POST /remove_entity
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_id": "entity",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

2.3 /set_entity_attributes

Description

Sets or updates textual attributes and optional vector embeddings for an entity in the specified graph. Existing attributes or embeddings with the same names will be overwritten.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "entity_id": "string",
  "attributes": { "key1": "value1", ... },
  "embeddings": [
    {
      "name": "string",
      "type": "Float32" | "SFloat32",
      "vector_data": [ ... ]
    },
    ...
  ],
  "use_job": false
}
  • attributes (optional): JSON object mapping attribute names to string values.
  • embeddings (optional): Array of embedding objects, each with a name, type, and vector data. See appendix for more details about embedding objects.
  • use_job (optional, default false): Submit the update asynchronously; see Server Job API.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields or invalid embedding format.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Entity does not exist.
  • 500: Internal server error.

Example

POST /set_entity_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_id": "entity",
  "attributes": {
    "color": "red",
    "size": "large",
    "status": "active"
  }
  "embeddings": [
    {
      "name": "embedding_location",
      "type": "Float32",
      "vector_data": [3.141519, 2.72]
    },
    {
      "name": "embedding_word",
      "type": "SFloat32",
      "vector_data": [[3, 0.7], [42, 1.9], [69, -2.7]]
    }
  ],
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

2.4 /remove_entity_attributes

Description

Removes one or more textual attributes and/or embeddings from an entity in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "entity_id": "string",
  "attribute_names": ["key1", "key2", ...],
  "embedding_names": ["emb1", "emb2", ...],
  "use_job": false
}
  • attribute_names: Array of attribute keys to remove.
  • embedding_names (optional): Array of embedding names to remove.
  • use_job (optional, default false): Submit the removal asynchronously; see Server Job API.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Entity does not exist.
  • 500: Internal server error.

Example

POST /remove_entity_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_id": "entity",
  "attribute_names": ["color", "size", "status"],
  "embedding_names": ["embedding_location", "embedding_word"],
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

2.5 /get_entity_attributes

Description

Retrieves values of specified textual attributes for an entity in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "entity_id": "string",
  "attribute_names": ["key1", "key2", ...],
  "use_job": false
}
  • attribute_names: Array of attribute keys to fetch.
  • use_job (optional, default false): Submit the query asynchronously; see Server Job API.

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "values": ["value1", "value2", ...]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph, entity, or attribute(s) does not exist.
  • 500: Internal server error.

Example

POST /get_entity_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_id": "entity",
  "attribute_names": ["color", "size", "status"],
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "values": ["red", "large", "active"]
}

2.6 /get_all_entity_attributes

Description

Retrieves all textual attributes (key-value pairs) for an entity in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "entity_id": "string",
  "use_job": false
}

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "attributes": {
    "name1": "value1",
    "name2": "value2",
    ...
  }
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Entity does not exist.
  • 500: Internal server error.

Example

POST /get_all_entity_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_id": "entity",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "attributes": {
    "size": "large",
    "color": "red",
    "status": "active"
  }
}

2.7 /get_entity_embeddings

Description

Retrieves embeddings (dense or sparse) for an entity in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "entity_id": "string",
  "embedding_names": ["string", "string", ...],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "embeddings": [
    {
      "name": "string",
      "type": "Float32" | "SFloat32",
      "vector_data": [ /* float list or [ [index, value], ... ] */ ]
    },
    ...
  ]
}

See appendix for more details about embedding objects.

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Entity does not exist.
  • 500: Internal server error.

Example

POST /get_entity_embeddings
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_id": "entity",
  "embedding_names": ["embedding_location", "embedding_word"],
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "embeddings": [
    {
      "name": "embedding_location",
      "type": "Float32",
      "vector_data": [3.141519, -2.72]
    },
    {
      "name": "embedding_word",
      "type": "SFloat32",
      "vector_data": [
        [5, -2.7],
        [42, 1.1],
        [69, -3]
      ]
    }
  ]
}

2.8 /get_all_entity_embeddings_names

Description

Retrieves the list of embedding names associated with an entity in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "entity_id": "string",
  "use_job": false
}

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "names": ["emb1", "emb2", ...]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Entity does not exist.
  • 500: Internal server error.

Example

POST /get_all_entity_embeddings_names
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_id": "entity",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "names": ["embedding_location", "embedding_word"]
}

2.9 /get_all_entity_embeddings

Description

Retrieves all embeddings (dense or sparse) and their data for an entity in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "entity_id": "string",
  "use_job": false
}

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "embeddings": [
    {
      "name": "string",
      "type": "Float32" | "SFloat32",
      "vector_data": [ /* float list or [ [index, value], ... ] */ ]
    },
    ...
  ]
}

See appendix for more details about embedding objects.

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Entity does not exist.
  • 500: Internal server error.

Example

POST /get_all_entity_embeddings
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_id": "entity",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "embeddings": [
    {
      "name": "embedding_location",
      "type": "Float32",
      "vector_data": [3.141519, -2.72]
    },
    {
      "name": "embedding_word",
      "type": "SFloat32",
      "vector_data": [
        [5, -2.7],
        [42, 1.1],
        [69, -3]
      ]
    }
  ]
}

2.10 /filter_entity

Description

Filters entities in the specified graph based on a provided JSON filter spec.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "entity_filter": { ... },
  "use_job": false
}
  • entity_filter: JSON filter spec combining conditions using and, or, not, and leaf operations like match_attribute, less_than, etc. See appendix for more details about filters.

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "entity_ids": ["id1", "id2", ...]
}

Error Responses:

  • 400: Missing or invalid fields or filter spec.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 500: Internal server error.

Example

POST /filter_entity
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_filter": {
    "and": [
      {
        "match_attribute": {
          "key": "type",
          "values": ["Person"]
        }
      },
      {
        "less_than": {
          "key": "age",
          "value": 30
        }
      },
      {
        "not": {
          "attribute_exists": "inactive"
        }
      }
    ]
  },
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "entity_ids": ["Alice", "Charlie", "Bob"]
}

2.11 /create_relationship

Description

Creates a new relationship (edge) of type relationship_id from src_entity_id to dest_entity_id within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "src_entity_id": "string",
  "relationship_id": "string",
  "dest_entity_id": "string",
  "use_job": false
}

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Entity does not exist.
  • 500: Internal server error.

Example

POST /create_relationship
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "src_entity_id": "entity1",
  "relationship_id": "parent_of",
  "dest_entity_id": "entity2",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

2.12 /remove_relationship

Description

Removes an existing relationship (edge) of type relationship_id from src_entity_id to dest_entity_id within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "src_entity_id": "string",
  "relationship_id": "string",
  "dest_entity_id": "string",
  "use_job": false
}

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Relationship does not exist.
  • 500: Internal server error.

Example

POST /remove_relationship
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "src_entity_id": "entity1",
  "relationship_id": "parent_of",
  "dest_entity_id": "entity2",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

2.13 /set_relationship_attributes

Description

Sets or updates textual attributes and optional vector embeddings for a relationship in the specified graph. Existing attributes or embeddings with the same names will be overwritten.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "relationship_id": "string",
  "attributes": { "key1": "value1", ... },
  "embeddings": [
    {
      "name": "string",
      "type": "Float32" | "SFloat32",
      "vector_data": [ ... ]
    },
    ...
  ],
  "use_job": false
}
  • attributes (optional): JSON object mapping attribute names to string values.
  • embeddings (optional): Array of embedding objects, each with a name, type, and vector data. See appendix for more details about embedding objects.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields or invalid embedding format.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Relationship does not exist.
  • 500: Internal server error.

Example

POST /set_relationship_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "relationship_id": "relationship",
  "attributes": {
    "color": "red",
    "size": "large",
    "status": "active"
  }
  "embeddings": [
    {
      "name": "embedding_location",
      "type": "Float32",
      "vector_data": [3.141519, 2.72]
    },
    {
      "name": "embedding_word",
      "type": "SFloat32",
      "vector_data": [[3, 0.7], [42, 1.9], [69, -2.7]]
    }
  ],
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

2.14 /remove_relationship_attributes

Description

Removes one or more textual attributes and/or embeddings from a relationship in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "relationship_id": "string",
  "attribute_names": ["key1", "key2", ...],
  "embedding_names": ["emb1", "emb2", ...],
  "use_job": false
}
  • attribute_names: Array of attribute names to remove.
  • embedding_names (optional): Array of embedding names to remove.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Relationship does not exist.
  • 500: Internal server error.

Example

POST /remove_relationship_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "relationship_id": "relationship",
  "attribute_names": ["color", "size", "status"],
  "embedding_names": ["embedding_location", "embedding_word"],
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

2.15 /get_relationship_attributes

Description

Retrieves values of specified textual attributes for a relationship in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "relationship_id": "string",
  "attribute_names": ["key1", "key2", ...],
  "use_job": false
}
  • attribute_names: Array of attribute names to fetch.

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "values": ["value1", "value2", ...]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph, relationship, or attribute(s) does not exist.
  • 500: Internal server error.

Example

POST /get_relationship_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "relationship_id": "relationship",
  "attribute_names": ["color", "size", "status"],
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "values": ["red", "large", "active"]
}

2.16 /get_all_relationship_attributes

Description

Retrieves all textual attributes (key-value pairs) for a relationship in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "relationship_id": "string",
  "use_job": false
}

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "attributes": {
    "name": "value",
    "name": "value",
    ...
  }
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Relationship does not exist.
  • 500: Internal server error.

Example

POST /get_all_relationship_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "relationship_id": "relationship",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "attributes": {
    "size": "large",
    "color": "red",
    "status": "active"
  }
}

2.17 /get_relationship_embeddings

Description

Retrieves embeddings (dense or sparse) for a relationship in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "relationship_id": "string",
  "embedding_names": ["string", "string", ...],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "embeddings": [
    {
      "name": "string",
      "type": "Float32" | "SFloat32",
      "vector_data": [ /* float list or [ [index, value], ... ] */ ]
    },
    ...
  ]
}

See appendix for more details about embedding objects.

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Relationship does not exist.
  • 500: Internal server error.

Example

POST /get_relationship_embeddings
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "relationship_id": "relationship",
  "embedding_names": ["embedding_location", "embedding_word"],
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "embeddings": [
    {
      "name": "embedding_location",
      "type": "Float32",
      "vector_data": [3.141519, -2.72]
    },
    {
      "name": "embedding_word",
      "type": "SFloat32",
      "vector_data": [
        [5, -2.7],
        [42, 1.1],
        [69, -3]
      ]
    }
  ]
}

2.18 /get_all_relationship_embeddings_names

Description

Retrieves the list of embedding names associated with a relationship in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "relationship_id": "string",
  "use_job": false
}

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "names": ["emb1", "emb2", ...]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Relationship does not exist.
  • 500: Internal server error.

Example

POST /get_all_relationship_embeddings_names
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "relationship_id": "relationship",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "names": ["embedding_location", "embedding_word"]
}

2.19 /get_all_relationship_embeddings

Description

Retrieves all embeddings (dense or sparse) and their data for a relationship in the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "relationship_id": "string",
  "use_job": false
}

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "embeddings": [
    {
      "name": "string",
      "type": "Float32" | "SFloat32",
      "vector_data": [ /* float list or [ [index, value], ... ] */ ]
    },
    ...
  ]
}

See appendix for more details about embedding objects.

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Relationship does not exist.
  • 500: Internal server error.

Example

POST /get_all_relationship_embeddings
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "relationship_id": "relationship",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "embeddings": [
    {
      "name": "embedding_location",
      "type": "Float32",
      "vector_data": [3.141519, -2.72]
    },
    {
      "name": "embedding_word",
      "type": "SFloat32",
      "vector_data": [
        [5, -2.7],
        [42, 1.1],
        [69, -3]
      ]
    }
  ]
}

2.20 /filter_relationship

Description

Filters relationships in the specified graph based on a provided JSON filter spec.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "relationship_filter": { ... },
  "use_job": false
}
  • relationship_filter: JSON filter spec combining conditions using and, or, not, and leaf operations like match_attribute, less_than, etc. See appendix for more details about filters.

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "relationship_ids": ["id1", "id2", ...]
}

Error Responses:

  • 400: Missing or invalid fields or filter spec.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 500: Internal server error.

Example

POST /filter_relationship
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "relationship_filter": {
    "and": [
      {
        "match_attribute": {
          "key": "type",
          "values": ["Person"]
        }
      },
      {
        "less_than": {
          "key": "age",
          "value": 30
        }
      },
      {
        "not": {
          "attribute_exists": "inactive"
        }
      }
    ]
  },
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "relationship_ids": ["Alice", "Charlie", "Bob"]
}

2.21 /get_all_entity_ids

Description

Returns every entity ID that exists in the graph. The operation can run synchronously or be scheduled as a background job when the graph is large.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "use_job": false
}
  • use_job (optional, default false): Set to true to enqueue the request; the response will include error_code and job_id, and the completed payload is retrieved via /get_job_result.

Response

{
  "error_code": "Success",
  "entity_ids": ["node1", "node2", ...]
}

Error Responses:

  • 400: Missing or invalid field.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 500: Internal server error.

Example

POST /get_all_entity_ids
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "entity_ids": ["Alice", "Bob", "Charlie"]
}

2.22 /get_all_relationship_ids

Description

Lists every relationship identifier in the target graph. This is helpful when you need to enumerate edges prior to additional queries.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "use_job": false
}

Response

{
  "error_code": "Success",
  "relationship_ids": ["rel1", "rel2", ...]
}

Error Responses:

  • 400: Missing or invalid field.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 500: Internal server error.

Example

POST /get_all_relationship_ids
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "relationship_ids": ["r12", "r24", "r34"]
}

2.23 /get_all_relationships

Description

Retrieves every relationship as triplets (source, relationship_id, destination). Results follow the same serialization used throughout the API where edge tuples are expressed as [[src, dest], relationship_id].

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "use_job": false
}

Response

{
  "error_code": "Success",
  "relationships": [
    [["Alice", "Bob"], "knows"],
    [["Bob", "Carol"], "reports_to"],
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid field.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 500: Internal server error.

Example

POST /get_all_relationships
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "relationships": [
    [["Alice", "Bob"], "knows"],
    [["Bob", "Carol"], "collaborates_with"]
  ]
}

3. Graph Index API

3.1 /create_entity_index

Description

Creates an index on an entity attribute or embedding to accelerate filtering or similarity search within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",       // e.g., "Attribute Index", "Fuzzy Attribute Index", "Vector Index"
  "dim": integer,               // dimension for vector indices (default 0)
  "dist_type": "string"        // distance metric, e.g., "Euclidean" or "Cosine",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding to index.
  • index_type: Type of index to create (textual or vector-based). See appendix for more details about index types.
  • dim, dist_type: Optional index-specific parameters. See appendix for more details about dist_type.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 409: Index already exists.
  • 500: Internal server error.

Example

  • Create a Vector Index
POST /create_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_location",
  "index_type": "Vector Index",
  "dim": 384,
  "dist_type": "Cosine",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}
  • Create an Attribute Index
POST /create_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "size",
  "index_type": "Attribute Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}
  • Create a Fuzzy Attribute Index
POST /create_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "location",
  "index_type": "Fuzzy Attribute Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}
  • Create an Integer Linear Index
POST /create_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Integer Linear Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}
  • Create a Float Linear Index
POST /create_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Float Linear Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

3.2 /remove_entity_index

Description

Removes an existing index on an entity attribute or embedding within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding indexed.
  • index_type: Type of index to remove (textual or vector-based).

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Index does not exist.
  • 500: Internal server error.

Example

POST /remove_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Integer Linear Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

3.3 /load_entity_index

Description

Loads a previously created entity index into memory for use in filtering or search operations within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding indexed.
  • index_type: Type of index to load.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Index does not exist.
  • 500: Internal server error.

Example

POST /load_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Integer Linear Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

3.4 /offload_entity_index

Description

Offloads an entity index from memory, persisting its state to disk within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding indexed.
  • index_type: Type of index to offload.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Index does not exist.
  • 500: Internal server error.

Example

POST /offload_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Integer Linear Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

3.5 /entity_index_exists

Description

Checks whether an index exists on an entity attribute or embedding within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding indexed.
  • index_type: Type of index to check.

Response

Success Response (200 OK):

{
  "exists": true|false
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /entity_index_exists
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Integer Linear Index",
  "use_job": false
}

Response:

{
  "exists": true
}

3.6 /get_all_entity_index

Description

Retrieves a list of all indices (attribute_name) defined on entities within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "use_job": false
}

Response

Success Response (200 OK):

{
  "indices": ["string", ...]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /get_all_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "use_job": false
}

Response:

{
  "indices": ["size", "embedding_location"]
}

3.7 /get_all_types_entity_index

Description

Retrieves all index types available for a given entity attribute within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding whose index types to list.

Response

Success Response (200 OK):

{
  "types": ["type1", "type2", ...]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /get_all_types_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "name",
  "use_job": false
}

Response:

{
  "types": ["Attribute Index", "Vector Index"]
}

3.8 /search_entity_index

Description

Performs a search against an entity index by exact attribute value or by similarity to a provided vector, with optional entity-level filtering.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",
  // Provide exactly one of (depending on index type):
  "attribute_value": "string",
  "vector": { "type": "Float32" | "SFloat32", "vector_data": [ ... ] },
  "top_k": integer,                   // optional, default 5
  "similarity_measure": "string",   // optional, e.g. "Euclidean" or "Cosine"
  "entity_filter": { ... }           // optional JSON filter spec,
  "use_job": false
}
  • attribute_value: Exact string to search in the index.
  • vector: Embedding object for similarity search. See appendix for more details about embedding objects.
  • top_k: Number of results to return (default 5).
  • similarity_measure: Distance metric for vector search. See appendix for more details about similarity measure.
  • entity_filter (optional): JSON spec to filter returned entities. See appendix for more details about filters.

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "entity_ids": ["id1", "id2", ...]
}

Error Responses:

  • 400: Missing or invalid fields, or both/neither of attribute_value and vector provided.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Index does not exist.
  • 500: Internal server error.

Example

  • Search an Attribute Index
POST /search_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "Location",
  "index_type": "Attribute Index",
  "attribute_value": "Seattle",
  "top_k": 5,
  "entity_filter": {
    "or": [
      {
        "match_attribute": {
          "key": "Occupation",
          "values": ["Software Engineer", "Analyst"]
        }
      },
      {
        "less_than": {
          "key": "Age",
          "value": 30
        }
      }
    ]
  },
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "entity_ids": ["alice", "bob", "charlie", "dana", "evan"]
}
  • Search a Fuzzy Attribute Index
POST /search_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "Name",
  "index_type": "Fuzzy Attribute Index",
  "attribute_value": "Tom",
  "top_k": 5,
  "entity_filter": {
    "match_attribute": {
      "key": "Occupation",
      "values": ["Actor"]
    }
  },
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "entity_ids": [
    "Tom Hanks",
    "Tom Cruise",
    "Tom Hardy",
    "Tom Holland",
    "Tom Wilkinson"
  ]
}
  • Search a Vector Index
POST /search_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "Location",
  "index_type": "Vector Index",
  "vector": {
    "type": "Float32",
    "vector_data": [47.6061, -122.3328]
  },
  "top_k": 5,
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "entity_ids": ["Bellevue", "Tacoma", "Vancouver", "Portland", "Spokane"]
}
  • Search an Integer Linear Index
POST /search_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "Birth Year",
  "index_type": "Integer Linear Index",
  "vector": {
    "type": "Int32", "vector_data": [2000]
  },
  "top_k": 5,
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "entity_ids": ["Alice", "Bob", "Charlie", "Dave", "Edward"]
}
  • Search a Float Linear Index
POST /search_entity_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "Test Score",
  "index_type": "Float Linear Index",
  "vector": {
    "type": "Float32", "vector_data": [98.3]
  },
  "top_k": 5,
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "entity_ids": ["Alice", "Bob", "Charlie", "Dave", "Edward"]
}

3.9 /create_relationship_index

Description

Creates an index on a relationship attribute or embedding to accelerate filtering or similarity search within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",       // e.g., "Attribute Index", "Fuzzy Attribute Index", "Vector Index"
  "dim": integer,               // dimension for vector indices (default 0)
  "dist_type": "string"        // distance metric, e.g., "Euclidean" or "Cosine",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding to index.
  • index_type: Type of index to create (textual or vector-based). See appendix for more details about index types.
  • dim, dist_type: Optional index-specific parameters. See appendix for more details about dist_type.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 409: Index already exists.
  • 500: Internal server error.

Example

  • Create a Vector Index
POST /create_relationship_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_location",
  "index_type": "Vector Index",
  "dim": 384,
  "dist_type": "Cosine",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}
  • Create a Attribute Index
POST /create_relationship_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "size",
  "index_type": "Attribute Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}
  • Create a Fuzzy Attribute Index
POST /create_relationship_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "location",
  "index_type": "Fuzzy Attribute Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}
  • Create a Integer Linear Index
POST /create_relationship_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Integer Linear Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}
  • Create a Float Linear Index
POST /create_relationship_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Float Linear Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

3.10 /remove_relationship_index

Description

Removes an existing index on a relationship attribute or embedding within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding indexed.
  • index_type: Type of index to remove (textual or vector-based).

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Index does not exist.
  • 500: Internal server error.

Example

POST /remove_relationship_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Integer Linear Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

3.11 /load_relationship_index

Description

Loads a previously created relationship index into memory for use in filtering or search operations within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding indexed.
  • index_type: Type of index to load.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Index does not exist.
  • 500: Internal server error.

Example

POST /load_relationship_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Integer Linear Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

3.12 /offload_relationship_index

Description

Offloads a relationship index from memory, persisting its state to disk within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding indexed.
  • index_type: Type of index to offload.

Response

Success Response (200 OK):

{
  "error_code": "Success"
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Index does not exist.
  • 500: Internal server error.

Example

POST /offload_relationship_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Integer Linear Index",
  "use_job": false
}

Response:

{
  "error_code": "Success"
}

3.13 /relationship_index_exists

Description

Checks whether an index exists on a relationship attribute or embedding within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding indexed.
  • index_type: Type of index to check.

Response

Success Response (200 OK):

{
  "exists": true|false
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /relationship_index_exists
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "embedding_time",
  "index_type": "Integer Linear Index",
  "use_job": false
}

Response:

{
  "exists": true
}

3.14 /get_all_relationship_index

Description

Retrieves a list of all indices (attribute_name) defined on relationships within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "use_job": false
}

Response

Success Response (200 OK):

{
  "indices": ["string", ...]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /get_all_relationship_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "use_job": false
}

Response:

{
  "indices": ["size", "embedding_location"]
}

3.15 /get_all_types_relationship_index

Description

Retrieves all index types available for a given relationship attribute within the specified graph.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "use_job": false
}
  • attribute_name: Name of the attribute or embedding whose index types to list.

Response

Success Response (200 OK):

{
  "types": ["type1", "type2", ...]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /get_all_types_relationship_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "use_job": false
}

Response:

{
  "types": ["Attribute Index", "Vector Index"]
}

3.16 /search_relationship_index

Description

Performs a search against a relationship index by exact attribute value or by similarity to a provided vector, with optional relationship-level filtering.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "attribute_name": "string",
  "index_type": "string",
  // Provide exactly one of (depending on index type):
  "attribute_value": "string",
  "vector": { "type": "Float32" | "SFloat32", "vector_data": [ ... ] },
  "top_k": integer,                   // optional, default 5
  "similarity_measure": "string",   // optional, e.g. "Euclidean" or "Cosine"
  "relationship_filter": { ... }           // optional JSON filter spec,
  "use_job": false
}
  • attribute_value: Exact string to search in the index.
  • vector: Embedding object for similarity search. See appendix for more details about embedding objects.
  • top_k: Number of results to return (default 5).
  • similarity_measure: Distance metric for vector search. See appendix for more details about similarity measure.
  • relationship_filter (optional): JSON spec to filter returned entities. See appendix for more details about filters.

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "relationship_ids": ["id1", "id2", ...]
}

Error Responses:

  • 400: Missing or invalid fields, or both/neither of attribute_value and vector provided.
  • 403: Invalid API Key.
  • 404: Graph does not exist.
  • 404: Index does not exist.
  • 500: Internal server error.

Example

POST /search_relationship_index
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "attribute_name": "Location",
  "index_type": "Attribute Index",
  "attribute_value": "Seattle",
  "top_k": 5,
    "relationship_filter": {
    "or": [
      {
        "match_attribute": {
          "key": "Occupation",
          "values": ["Software Engineer", "Analyst"]
        }
      },
      {
        "less_than": {
          "key": "Age",
          "value": 30
        }
      }
    ]
  },
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "relationship_ids": ["alice", "bob", "charlie", "dana", "evan"]
}

4. Graph Algorithms

4.1 Shortest Path Algorithms

4.1.1 /find_k_hop

Description

Finds all entities reachable within k hops from src_entity_id, optionally restricting the traversal with entity and relationship predicates. Supports synchronous execution or job submission.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "src_entity_id": "string",
  "type": 1,
  "k": 2,
  "entity_filters": [ { ... } ],
  "relationship_filters": [ { ... } ],
  "use_job": false
}
  • type: 1 (outbound), 2 (inbound), or 3 (bidirectional).
  • k: Maximum hop count.
  • entity_filters / relationship_filters: Optional arrays of JSON predicates (see Filters).
  • use_job: Optional; when true, enqueue the traversal and use the job API to retrieve results once complete.

Response

{
  "error_code": "Success",
  "entity_ids": ["id1", "id2", ...],
  "relationships": [
    [["src", "dst"], "relationship_id"],
    ...
  ]
}

Error Responses:

  • 400: Missing field or invalid filter configuration.
  • 403: Invalid API Key.
  • 404: Graph or source entity not found.
  • 500: Internal server error.

Example

POST /find_k_hop
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "src_entity_id": "Tom Cruise",
  "type": 1,
  "k": 2,
  "entity_filters": [
    {
      "match_attribute": {
        "key": "type",
        "values": ["Person"]
      }
    }
  ],
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "entity_ids": ["Emily Blunt", "Edge of Tomorrow"],
  "relationships": [
    [["Tom Cruise", "Emily Blunt"], "friend"],
    [["Emily Blunt", "Edge of Tomorrow"], "acted_in"]
  ]
}

4.1.2 /dijkstra

Description

Runs Dijkstra's single-source shortest path algorithm from one or more source nodes, optionally constraining the graph with attribute filters and returning explicit paths.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "source_node_ids": ["string", ...],
  "target_node_ids": ["string", ...],
  "weight_attr_name": "string",
  "is_undirected": false,
  "return_paths": false,
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}
  • source_node_ids: One or more starting nodes (required).
  • target_node_ids: Optional subset of destination nodes; leave empty to compute all reachable nodes.
  • weight_attr_name: Optional edge attribute storing numeric weights; omit to treat edges as weight 1.
  • return_paths: When true, return edge-by-edge paths.
  • node_filters / edge_filters: Optional predicate arrays.
  • use_job: Optional; when true, enqueue the traversal and retrieve results via the job API.

Response

{
  "error_code": "Success",
  "distances": [["node_id", 2.0], ...],
  "paths": [
    [
      [["src", "mid"], "rel_id"],
      [["mid", "dst"], "rel_id"]
    ],
    ...
  ]
}

paths is omitted unless return_paths is true. Each entry encodes the sequence of traversed relationships for the corresponding target in distances.

Error Responses:

  • 400: Missing or invalid field.
  • 403: Invalid API Key.
  • 404: Graph or referenced entity not found.
  • 500: Internal server error.

Example

POST /dijkstra
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "source_node_ids": ["1"],
  "target_node_ids": ["4"],
  "weight_attr_name": "weight",
  "return_paths": true,
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "distances": [["4", 2.0]],
  "paths": [
    [
      [["1", "3"], "r13"],
      [["3", "4"], "r34"]
    ]
  ]
}

4.1.3 /astar

Description

Computes shortest paths with the A* heuristic algorithm. Entities referenced in source_node_ids and target_node_ids must contain an embedding attribute (coor_attr_name) representing coordinates for the heuristic.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "source_node_ids": ["string", ...],
  "target_node_ids": ["string", ...],
  "coor_attr_name": "string",
  "weight_attr_name": "string",
  "is_undirected": false,
  "return_paths": false,
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}

Response

Identical in shape to /dijkstra: distances plus optional paths.

Error Responses:

  • 400: Missing field or invalid heuristic configuration.
  • 403: Invalid API Key.
  • 404: Graph or referenced entity not found.
  • 500: Internal server error.

Example

POST /astar
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "source_node_ids": ["1"],
  "target_node_ids": ["4"],
  "coor_attr_name": "pos",
  "weight_attr_name": "weight",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "distances": [["4", 2.0]],
  "paths": [
    [
      [["1", "3"], "a13"],
      [["3", "4"], "a34"]
    ]
  ]
}

4.1.4 /spfa

Description

Runs the Shortest Path Faster Algorithm (SPFA) from a single source node. Optionally returns explicit paths and respects filter predicates.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "source_node_id": "string",
  "target_node_ids": ["string", ...],
  "weight_attr_name": "string",
  "return_paths": true,
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}

Response

  • distances: array [entity_id, distance].
  • When return_paths is true, paths is an array of [reachable:boolean, [["src", "dst"], "rel_id"], ...] structures aligned with target_node_ids.

Error Responses mirror /dijkstra.

Example

POST /spfa
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "source_node_id": "1",
  "target_node_ids": ["4"],
  "weight_attr_name": "weight",
  "return_paths": true,
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "distances": [["4", 6.0]],
  "paths": [
    [
      true,
      [["1", "2"], "s12"],
      [["2", "3"], "s23"],
      [["3", "4"], "s34"]
    ]
  ]
}

4.1.5 /delta_stepping

Description

Executes the parallel delta-stepping algorithm for single-source shortest paths. Optional path_node_ids restricts which destinations should include path reconstructions.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "source_node_id": "string",
  "path_node_ids": ["string", ...],
  "num_threads": 2,
  "delta": 1.0,
  "weight_attr_name": "string",
  "is_undirected": false,
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}

Response

  • distances: array [entity_id, distance].
  • paths: only present when path_node_ids is non-empty.

Error Responses: same as /dijkstra.

Example

POST /delta_stepping
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "source_node_id": "1",
  "path_node_ids": ["4"],
  "num_threads": 2,
  "delta": 1.0,
  "weight_attr_name": "weight",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "distances": [["4", 2.0]],
  "paths": [
    [
      [["1", "3"], "d13"],
      [["3", "4"], "d34"]
    ]
  ]
}

4.2 Trees & Connectivity

4.2.1 /prim

Description

Builds a Minimum Spanning Tree using Prim's algorithm over the (optionally filtered) graph. For undirected graphs, insert symmetric edges before invoking the API.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "start_node_ids": ["string", ...],
  "weight_attr_name": "string",
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}

Response

{
  "error_code": "Success",
  "mst_edges": [
    [["u", "v"], "relationship_id"],
    ...
  ],
  "total_weight": 5.0
}

Error Responses: 400, 403, 404, 500.

Example

POST /prim
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "start_node_ids": [],
  "weight_attr_name": "weight",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "mst_edges": [
    [["1", "2"], "p12"],
    [["2", "3"], "p23"]
  ],
  "total_weight": 5.0
}

4.2.2 /steiner_tree

Description

Computes an approximate Steiner tree connecting source_node_id and terminal_node_ids. Optional rerouting refines the solution.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "source_node_id": "string",
  "terminal_node_ids": ["string", ...],
  "weight_attr_name": "string",
  "apply_rerouting": false,
  "use_job": false
}

Response

{
  "error_code": "Success",
  "tree_edges": [
    [["u", "v"], "relationship_id"],
    ...
  ],
  "total_cost": 2.0
}

Error Responses: 400, 403, 404, 500.

Example

POST /steiner_tree
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "source_node_id": "1",
  "terminal_node_ids": ["3", "4"],
  "weight_attr_name": "weight",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "tree_edges": [
    [["1", "3"], "st13"],
    [["3", "4"], "st34"]
  ],
  "total_cost": 2.0
}

4.3 Flow (Push-Relabel)

4.3.1 /max_flow_push_relabel

Description

Computes the maximal flow from source_node_id to sink_node_id using the push-relabel algorithm. Capacities and (optional) flow outputs are read from edge attributes.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "source_node_id": "string",
  "sink_node_id": "string",
  "capacity_attr_name": "string",
  "flow_attr_name": "string",
  "use_job": false
}

Response

{
  "error_code": "Success",
  "max_flow_value": 12.5
}

Error Responses:

  • 400: Invalid parameter.
  • 403: Invalid API Key.
  • 404: Graph or endpoint node not found.
  • 500: Internal server error.

Example

POST /max_flow_push_relabel
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "network",
  "source_node_id": "s",
  "sink_node_id": "t",
  "capacity_attr_name": "capacity",
  "flow_attr_name": "flow",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "max_flow_value": 12.5
}

4.4.1 /common_neighbors

Description

Counts (and optionally returns) the intersection of neighbors for the provided node_ids. Supports directed or undirected semantics plus attribute filters.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "node_ids": ["string", ...],
  "is_undirected": false,
  "return_nodes": true,
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}

Response

{
  "error_code": "Success",
  "num_common": 3,
  "common_nodes": ["3", "4", "5"]
}

common_nodes is omitted when return_nodes is false.

Error Responses: 400, 403, 404, 500.

Example

POST /common_neighbors
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "node_ids": ["1", "2"],
  "return_nodes": true,
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "num_common": 3,
  "common_nodes": ["3", "4", "5"]
}

4.4.2 /adamic_adar

Description

Computes the Adamic–Adar link prediction score between nodes u and v. The score can be evaluated on directed or undirected neighborhoods and filtered by attributes.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "u": "string",
  "v": "string",
  "is_undirected": false,
  "use_log": true,
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}

Response

{
  "error_code": "Success",
  "score": 0.6931471
}

Error Responses: 400, 403, 404, 500.

Example

POST /adamic_adar
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "u": "1",
  "v": "2",
  "is_undirected": true,
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "score": 0.9102392
}

4.4.3 /preferential_attachment

Description

Calculates the Preferential Attachment score (deg(u) × deg(v) under filter constraints) for the candidate link (u, v).

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "u": "string",
  "v": "string",
  "is_undirected": false,
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}

Response

{
  "error_code": "Success",
  "score": 4.0
}

Error Responses: 400, 403, 404, 500.

Example

POST /preferential_attachment
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "u": "1",
  "v": "2",
  "is_undirected": true,
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "score": 4.0
}

4.5 Ranking, Ordering, & Inference

4.5.1 /topsort

Description

Produces a depth-first topological ordering of the (filtered) DAG starting from the supplied nodes. If start_node_ids is empty, the algorithm covers the entire reachable component.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "start_node_ids": ["string", ...],
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}

Response

{
  "error_code": "Success",
  "order": ["1", "2", "3"]
}

Error Responses: 400, 403, 404, 500.

Example

POST /topsort
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "start_node_ids": ["1"],
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "order": ["1", "2", "3"]
}

4.5.2 /topsort_kahn

Description

Generates a level-by-level topological ordering using Kahn's algorithm. Each level array contains nodes with the same depth.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "start_node_ids": ["string", ...],
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}

Response

{
  "error_code": "Success",
  "levels": [["1"], ["2", "3"], ["4"]]
}

Example

POST /topsort_kahn
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "start_node_ids": ["1"],
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "levels": [["1"], ["2", "3"], ["4"]]
}

4.5.3 /dag_longest_path

Description

Computes longest paths within a Directed Acyclic Graph (DAG) using dynamic programming. Optional filters limit the nodes and edges considered. Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "source_node_ids": ["string", ...],
  "target_node_ids": ["string", ...],
  "weight_attr_name": "string",
  "return_paths": false,
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}

Response

Matches the structure used by /dijkstra (distances plus optional paths).

Error Responses: 400, 403, 404, 500 as above.

Example

POST /dag_longest_path
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "source_node_ids": ["1"],
  "target_node_ids": ["4"],
  "weight_attr_name": "weight",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "distances": [["4", 5.0]]
}

4.5.4 /pagerank

Description

Evaluates PageRank over the (optionally filtered) graph. Supports weighted edges, personalization scalers, and multi-threaded execution.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "damping_factor": 0.85,
  "max_iterations": 100,
  "edge_weight_attr": "string",
  "node_weight_attr": "string",
  "scaler": "string",
  "is_undirected": false,
  "num_threads": 0,
  "node_filters": [ { ... } ],
  "edge_filters": [ { ... } ],
  "use_job": false
}

Response

{
  "error_code": "Success",
  "scores": [["node", 0.32], ...]
}

Example

POST /pagerank
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "damping_factor": 0.85,
  "max_iterations": 20,
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "scores": [
    ["1", 0.19],
    ["2", 0.23],
    ["3", 0.42],
    ["4", 0.16]
  ]
}

4.5.5 /loopy_bp_map

Description

Runs loopy belief propagation (discrete MAP inference) on factor graphs encoded in the database. Nodes must carry a type attribute (variables vs. factors). Custom factor potentials are currently limited to the built-in uniform default.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "type_attr_name": "string",
  "K": 2,
  "max_iterations": 10,
  "damping": 0.2,
  "tol": 1e-6,
  "use_job": false
}

Response

{
  "error_code": "Success",
  "assignments": {
    "x": 0,
    "y": 1
  }
}

Error Responses: 400, 403, 404, 500.

Example

POST /loopy_bp_map
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "type_attr_name": "type",
  "K": 2,
  "max_iterations": 10,
  "damping": 0.3,
  "tol": 1e-6,
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "assignments": {
    "x": 0,
    "y": 1
  }
}

4.5.6 /loopy_bp_map_continuous

Description

Continuous variant of loopy BP supporting bounded continuous variables and Monte Carlo sampling parameters.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "type_attr_name": "string",
  "bounds": {
    "x": [0.0, 2.0]
  },
  "num_samples": 2,
  "num_mc_samples": 2,
  "max_iterations": 5,
  "damping": 0.2,
  "tol": 1e-6,
  "use_job": false
}

Response

{
  "error_code": "Success",
  "assignments": {
    "x": 1.2,
    "y": 2.4
  }
}

Example

POST /loopy_bp_map_continuous
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "type_attr_name": "type",
  "bounds": {
    "x": [0.0, 2.0],
    "y": [1.0, 3.0]
  },
  "num_samples": 2,
  "num_mc_samples": 2,
  "max_iterations": 5,
  "damping": 0.2,
  "tol": 1e-6,
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "assignments": {
    "x": 1.1,
    "y": 2.3
  }
}

6. Graph Batch Operations

Note: Batch operations will execute concurrently only when submitted as jobs. Without job usage, operations run sequentially.

6.1 /batch_create_entity

Description

Creates a batch of entities in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id"    : "string",
  "entity_ids"  : [
    "string",
    "string",
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "entity_id": "string",
      "error_code": "string"
    },
    {
      "entity_id": "string",
      "error_code": "string"
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

  • Creation Successful
POST /batch_create_entity
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_ids": [
    "John",
    "Alice",
    "Bob",
    "Charlie"
  ],
  "use_job": false
}

Response:

{
  "results": [
    {
      "entity_id": "John",
      "error_code": "Success"
    },
    {
      "entity_id": "Alice",
      "error_code": "Success"
    },
    {
      "entity_id": "Bob",
      "error_code": "Success"
    },
    {
      "entity_id": "Charlie",
      "error_code": "Success"
    }
  ]
}
  • Creation Failed (Graph does not exist)
POST /batch_create_entity
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_ids": [
    "John",
    "Alice",
    "Bob",
    "Charlie"
  ],
  "use_job": false
}

Response:

{
  "results": [
    {
      "entity_id": "John",
      "error_code": "GraphNotFound"
    },
    {
      "entity_id": "Alice",
      "error_code": "GraphNotFound"
    },
    {
      "entity_id": "Bob",
      "error_code": "GraphNotFound"
    },
    {
      "entity_id": "Charlie",
      "error_code": "GraphNotFound"
    }
  ]
}

6.2 /batch_remove_entity

Description

Removes a batch of entities in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id"    : "string",
  "entity_ids"  : [
    "string",
    "string",
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "entity_id": "string",
      "error_code": "string"
    },
    {
      "entity_id": "string",
      "error_code": "string"
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid field.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

  • Creation Successful
POST /batch_remove_entity
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_ids": [
    "John",
    "Alice",
    "Bob",
    "Charlie"
  ],
  "use_job": false
}

Response:

{
  "results": [
    {
      "entity_id": "John",
      "error_code": "Success"
    },
    {
      "entity_id": "Alice",
      "error_code": "Success"
    },
    {
      "entity_id": "Bob",
      "error_code": "Success"
    },
    {
      "entity_id": "Charlie",
      "error_code": "Success"
    }
  ]
}
  • Creation Failed (Entity does not exist)
POST /batch_remove_entity
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "entity_ids": [
    "John",
    "Alice",
    "Bob",
    "Charlie"
  ],
  "use_job": false
}

Response:

{
  "results": [
    {
      "entity_id": "John",
      "error_code": "EntityNotFound"
    },
    {
      "entity_id": "Alice",
      "error_code": "EntityNotFound"
    },
    {
      "entity_id": "Bob",
      "error_code": "EntityNotFound"
    },
    {
      "entity_id": "Charlie",
      "error_code": "EntityNotFound"
    }
  ]
}

6.3 /batch_set_entity_attributes

Description

Sets attributes and embeddings for multiple entities in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id"    : "string",
  "entities"  : [
    {
      "entity_id": "string",
      "attributes": {
        "string": "string",
        ...
      },
      "embeddings": [
        {
          "name": "string",
          "type": "string",
          "vector_data": [ ... ]
        },
        {
          "name": "string",
          "type": "string",
          "vector_data": [ ... ]
        },
        ...
      ]
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "entity_id": "string",
      "error_code": "string"
    },
    {
      "entity_id": "string",
      "error_code": "string"
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_set_entity_attributes
Content-Type: application/json
  "user_api_key": "api_key_123",
  "graph_id": "graph_ABC",
  "entities": [
    {
      "entity_id": "node1",
      "attributes": {
        "name": "Alice",
        "age": "30",
        "country": "Canada"
      },
      "embeddings": [
        {
          "name": "profile_vec",
          "type": "Float32",
          "vector_data": [0.12, 0.34, 0.56, 0.78]
        },
        {
          "name": "sparse_pref",
          "type": "SFloat32",
          "vector_data": [
            [0, 1.0],
            [3, 2.5]
          ]
        }
      ]
    },
    {
      "entity_id": "node2",
      "attributes": {
        "name": "Bob",
        "age": "25"
      }
    },
    {
      "entity_id": "node3",
      "embeddings": [
        {
          "name": "profile_vec",
          "type": "Float32",
          "vector_data": [0.01, 0.02, 0.03]
        }
      ]
    }
  ],
  "use_job": false
}

Response:

{
  "results": [
    {
      "entity_id": "node1",
      "error_code": "Success"
    },
    {
      "entity_id": "node2",
      "error_code": "EntityNotFound"
    },
    {
      "entity_id": "node3",
      "error_code": "Success"
    }
  ]
}

6.4 /batch_remove_entity_attributes

Description

Removes previously set string‑valued attributes and/or embeddings from multiple entities in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "entities": [
    {
      "entity_id":       "string",
      "attribute_names": ["string", ...],
      "embedding_names":      ["string", ...]
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "entity_id":  "string",
      "error_code": "string"
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_remove_entity_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id":     "graph_ABC",
  "entities": [
    {
      "entity_id":       "node1",
      "attribute_names": ["age","country"],
      "embedding_names":      ["profile_vec"]
    },
    {
      "entity_id":       "node2",
      "attribute_names": ["name"]
      // no embeddings to remove
    },
    {
      "entity_id":  "node3"
      // neither attributes nor embeddings: no‑ops
    }
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "entity_id": "node1",
      "error_code": "Success"
    },
    {
      "entity_id": "node2",
      "error_code": "EntityNotFound"
    },
    {
      "entity_id": "node3",
      "error_code": "AttributeNotFound"
    }
  ]
}

6.5 /batch_get_entity_attributes

Description

Fetches string‑valued attributes for multiple entities in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "entities": [
    {
      "entity_id":       "string",
      "attribute_names": ["string", ...]
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "entity_id":  "string",
      "error_code": "string",
      "values":      ["string", ...]
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_get_entity_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id":     "graph_ABC",
  "entities": [
    { "entity_id": "node1", "attribute_names": ["name","age"] },
    { "entity_id": "node2", "attribute_names": ["country"]   },
    { "entity_id": "nodeX", "attribute_names": ["name"]      }
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "entity_id": "node1",
      "error_code": "Success",
      "values": ["Alice", "30"]
    },
    {
      "entity_id": "node2",
      "error_code": "AttributeNotFound"
    },
    {
      "entity_id": "nodeX",
      "error_code": "EntityNotFound"
    }
  ]
}

6.6 /batch_get_all_entity_attributes

Description

Fetches all string‑valued attributes for multiple entities in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "entities": [
    {
      "entity_id": "string"
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "entity_id":       "string",
      "error_code":      "string",
      "attributes": {
        "string": "string",
        ...
      }
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_get_all_entity_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id":     "graph_ABC",
  "entities": [
    {"entity_id": "node1"},
    {"entity_id": "node2"},
    {"entity_id": "nodeX"}
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "entity_id": "node1",
      "error_code": "Success",
      "attributes": {
        "name": "Alice",
        "age": "30",
        "country": "Canada"
      }
    },
    {
      "entity_id": "node2",
      "error_code": "Success",
      "attributes": { "name": "Bob" }
    },
    {
      "entity_id": "nodeX",
      "error_code": "EntityNotFound"
    }
  ]
}

### 6.7 /batch_get_entity_embeddings

Description

Fetches specified embeddings for multiple entities in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "entities": [
    {
      "entity_id": "string",
      "embedding_names": ["string", ...]
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "entity_id": "string",
      "error_code": "string",
      "embeddings": [
        {"name": "string", "vector": [number, ...]},
        ...
      ]
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

### Example

POST /batch_get_entity_embeddings
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id":     "graph_ABC",
  "entities": [
    { "entity_id": "node1", "embedding_names": ["embedding_a", "embedding_b"] },
    { "entity_id": "node2", "embedding_names": ["embedding_c"] },
    { "entity_id": "nodeX", "embedding_names": ["embedding_y"] }
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "entity_id": "node1",
      "error_code": "Success",
      "embeddings": [
        {"name": "embedding_a", "vector": [0.1, 0.2, 0.3]},
        {"name": "embedding_b", "vector": [0.4, 0.5, 0.6]}
      ]
    },
    {
      "entity_id": "node2",
      "error_code": "Success",
      "embeddings": [
        {"name": "embedding_c", "vector": [0.7, 0.8]}
      ]
    },
    {
      "entity_id": "nodeX",
      "error_code": "EntityNotFound"
    }
  ]
}

6.8 /batch_get_all_entity_embeddings_names

Description

Fetches all embedding names (keys) for multiple entities in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "entities": [
    {
      "entity_id": "string"
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "entity_id": "string",
      "error_code": "string",
      "embedding_names": ["string", ...]
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_get_all_entity_embeddings_names
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id":     "graph_ABC",
  "entities": [
    { "entity_id": "node1" },
    { "entity_id": "node2" },
    { "entity_id": "nodeX" }
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "entity_id": "node1",
      "error_code": "Success",
      "embedding_names": ["profile_vec", "sparse_pref"]
    },
    {
      "entity_id": "node2",
      "error_code": "Success",
      "embedding_names": []
    },
    {
      "entity_id": "nodeX",
      "error_code": "EntityNotFound"
    }
  ]
}

6.9 /batch_get_all_entity_embeddings

Description

Fetches all embeddings (dense and sparse) for multiple entities in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "entities": [
    {
      "entity_id": "string"
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "entity_id": "node1",
      "error_code": "Success",
      "embeddings": [
        {
          "name":        "string",
          "type":        "string",
          "vector_data": [ ... ]
        },
        {
          "name":        "string",
          "type":        "string",
          "vector_data": [ ... ]
        }
      ]
    },
    {
      "entity_id": "node2",
      "error_code": "Success",
      "embeddings": []
    },
    {
      "entity_id": "nodeX",
      "error_code": "EntityNotFound"
    }
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

{
  "user_api_key": "api_key_123",
  "graph_id": "graph_ABC",
  "entities": [
    { "entity_id": "node1" },
    { "entity_id": "node2" },
    { "entity_id": "nodeX" }
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "entity_id": "node1",
      "error_code": "Success",
      "embeddings": [
        {
          "name": "profile_vec",
          "type": "Float32",
          "vector_data": [0.12, 0.34, 0.56, 0.78]
        },
        {
          "name": "sparse_pref",
          "type": "SFloat32",
          "vector_data": [
            [0, 1.0],
            [3, 2.5]
          ]
        }
      ]
    },
    {
      "entity_id": "node2",
      "error_code": "Success",
      "embeddings": []
    },
    {
      "entity_id": "nodeX",
      "error_code": "EntityNotFound"
    }
  ]
}

6.10 /batch_create_relationship

Description

Creates multiple relationships in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "relationships": [
    {
      "src_entity_id": "string",
      "relationship_id": "string",
      "dest_entity_id": "string"
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "src_entity_id": "string",
      "relationship_id": "string",
      "dest_entity_id": "string",
      "error_code": "string"
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_create_relationship
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph_ABC",
  "relationships": [
    {
      "src_entity_id": "nd1",
      "relationship_id": "rel1",
      "dest_entity_id": "nd2",
    },
    {
      "src_entity_id": "nd2",
      "relationship_id": "rel2",
      "dest_entity_id": "nd3",
    },
    {
      "src_entity_id": "nd3",
      "relationship_id": "rel3",
      "dest_entity_id": "nd4",
    }
  ],
  "use_job": false
}

Response:

{
  "results": [
    {
      "src_entity_id": "nd1",
      "relationship_id": "rel1",
      "dest_entity_id": "nd2",
      "error_code": "Success"
    },
    {
      "src_entity_id": "nd2",
      "relationship_id": "rel2",
      "dest_entity_id": "nd3",
      "error_code": "Success"
    },
    {
      "src_entity_id": "nd3",
      "relationship_id": "rel3",
      "dest_entity_id": "nd4",
      "error_code": "EntityNotFound"
    }
  ]
}

6.11 /batch_remove_relationship

Description

Removes multiple relationships in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "relationships": [
    {
      "src_entity_id": "string",
      "relationship_id": "string",
      "dest_entity_id": "string"
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "src_entity_id": "string",
      "relationship_id": "string",
      "dest_entity_id": "string",
      "error_code": "string"
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_remove_relationship
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph_ABC",
  "relationships": [
    {
      "src_entity_id": "nd1",
      "relationship_id": "rel1",
      "dest_entity_id": "nd2",
    },
    {
      "src_entity_id": "nd2",
      "relationship_id": "rel2",
      "dest_entity_id": "nd3",
    },
    {
      "src_entity_id": "nd3",
      "relationship_id": "rel3",
      "dest_entity_id": "nd4",
    }
  ],
  "use_job": false
}

Response:

{
  "results": [
    {
      "src_entity_id": "nd1",
      "relationship_id": "rel1",
      "dest_entity_id": "nd2",
      "error_code": "Success"
    },
    {
      "src_entity_id": "nd2",
      "relationship_id": "rel2",
      "dest_entity_id": "nd3",
      "error_code": "Success"
    },
    {
      "src_entity_id": "nd3",
      "relationship_id": "rel3",
      "dest_entity_id": "nd4",
      "error_code": "RelationshipNotFound"
    }
  ]
}

6.12 /batch_set_relationship_attributes

Description

Sets attributes and embeddings for multiple relationships in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id"    : "string",
  "relationships"  : [
    {
      "relationship_id": "string",
      "attributes": {
        "string": "string",
        ...
      },
      "embeddings": [
        {
          "name": "string",
          "type": "Float32" | "SFloat32",
          "vector_data": [ ... ]
        }
      ]
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "relationship_id": "string",
      "error_code": "string"
    },
    {
      "relationship_id": "string",
      "error_code": "string"
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_set_relationship_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph_ABC",
  "relationships": [
    {
      "relationship_id": "node1",
      "attributes": {
        "name": "Alice",
        "age": "30",
        "country": "Canada"
      },
      "embeddings": [
        {
          "name": "profile_vec",
          "type": "Float32",
          "vector_data": [0.12, 0.34, 0.56, 0.78]
        },
        {
          "name": "sparse_pref",
          "type": "SFloat32",
          "vector_data": [
            [0, 1.0],
            [3, 2.5]
          ]
        }
      ]
    },
    {
      "relationship_id": "node2",
      "attributes": {
        "name": "Bob",
        "age": "25"
      }
    },
    {
      "relationship_id": "node3",
      "embeddings": [
        {
          "name": "profile_vec",
          "type": "Float32",
          "vector_data": [0.01, 0.02, 0.03]
        }
      ]
    }
  ],
  "use_job": false
}

Response:

{
  "results": [
    {
      "relationship_id": "node1",
      "error_code": "Success"
    },
    {
      "relationship_id": "node2",
      "error_code": "RelationshipNotFound"
    },
    {
      "relationship_id": "node3",
      "error_code": "Success"
    }
  ]
}

6.13 /batch_remove_relationship_attributes

Description

Removes previously set string‑valued attributes and/or embeddings from multiple relationships in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "relationships": [
    {
      "relationship_id":       "string",
      "attribute_names": ["string", ...],
      "embedding_names":      ["string", ...]
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "relationship_id":  "string",
      "error_code": "string"
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_remove_relationship_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id":     "graph_ABC",
  "relationships": [
    {
      "relationship_id":       "node1",
      "attribute_names": ["age","country"],
      "embedding_names": ["profile_vec"]
    },
    {
      "relationship_id":       "node2",
      "attribute_names": ["name"]
      // no embeddings to remove
    },
    {
      "relationship_id":  "node3"
      // neither attributes nor embeddings: no‑ops
    }
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "relationship_id": "node1",
      "error_code": "Success"
    },
    {
      "relationship_id": "node2",
      "error_code": "RelationshipNotFound"
    },
    {
      "relationship_id": "node3",
      "error_code": "AttributeNotFound"
    }
  ]
}

6.14 /batch_get_relationship_attributes

Description

Fetches string‑valued attributes for multiple relationships in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "relationships": [
    {
      "relationship_id":       "string",
      "attribute_names": ["string", ...]
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "relationship_id":  "string",
      "error_code": "string",
      "values":      ["string", ...]
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_get_relationship_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id":     "graph_ABC",
  "relationships": [
    { "relationship_id": "node1", "attribute_names": ["name","age"] },
    { "relationship_id": "node2", "attribute_names": ["country"]   },
    { "relationship_id": "nodeX", "attribute_names": ["name"]      }
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "relationship_id": "node1",
      "error_code": "Success",
      "values": ["Alice", "30"]
    },
    {
      "relationship_id": "node2",
      "error_code": "AttributeNotFound",
      "values": []
    },
    {
      "relationship_id": "nodeX",
      "error_code": "RelationshipNotFound"
    }
  ]
}

6.15 /batch_get_all_relationship_attributes

Description

Fetches all string‑valued attributes for multiple relationships in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "relationships": [
    {
      "relationship_id": "string"
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "relationship_id":"string",
      "error_code":     "string",
      "attributes": {
        "string": "string",
        ...
      }
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_get_all_relationship_attributes
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id":     "graph_ABC",
  "relationships": [
    {"relationship_id": "node1"},
    {"relationship_id": "node2"},
    {"relationship_id": "nodeX"}
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "relationship_id": "node1",
      "error_code":        "Success",
      "attributes": {
        "name": "Alice",
        "age": "30",
        "country": "Canada"
      }
    },
    {
      "relationship_id": "node2",
      "error_code":        "Success",
      "attributes": { "name": "Bob" }
    },
    {
      "relationship_id": "nodeX",
      "error_code": "RelationshipNotFound"
    }
  ]
}

6.16 /batch_get_relationship_embeddings

Description

Fetches specified embeddings for multiple relationships in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "relationships": [
    {
      "relationship_id": "string",
      "embedding_names": ["string", ...]
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "relationship_id": "string",
      "error_code": "string",
      "embeddings": [
        {"name": "string", "vector": [number, ...]},
        ...
      ]
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_get_relationship_embeddings
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id":     "graph_ABC",
  "relationships": [
    { "relationship_id": "node1", "embedding_names": ["embedding_a", "embedding_b"] },
    { "relationship_id": "node2", "embedding_names": ["embedding_c"] },
    { "relationship_id": "nodeX", "embedding_names": ["embedding_y"] }
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "relationship_id": "node1",
      "error_code": "Success",
      "embeddings": [
        {"name": "embedding_a", "vector": [0.1, 0.2, 0.3]},
        {"name": "embedding_b", "vector": [0.4, 0.5, 0.6]}
      ]
    },
    {
      "relationship_id": "node2",
      "error_code": "Success",
      "embeddings": [
        {"name": "embedding_c", "vector": [0.7, 0.8]}
      ]
    },
    {
      "relationship_id": "nodeX",
      "error_code": "RelationshipNotFound"
    }
  ]
}

6.17 /batch_get_all_relationship_embeddings_names

Description

Fetches all embedding names (keys) for multiple relationships in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "relationships": [
    {
      "relationship_id": "string"
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "relationship_id": "string",
      "error_code": "string",
      "embedding_names": ["string", ...]
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

POST /batch_get_all_relationship_embeddings_names
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id":     "graph_ABC",
  "relationships": [
    { "relationship_id": "node1" },
    { "relationship_id": "node2" },
    { "relationship_id": "nodeX" }
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "relationship_id": "node1",
      "error_code": "Success",
      "embedding_names": ["profile_vec", "sparse_pref"]
    },
    {
      "relationship_id": "node2",
      "error_code": "Success",
      "embedding_names": []
    },
    {
      "relationship_id": "nodeX",
      "error_code": "RelationshipNotFound"
    }
  ]
}

6.18 /batch_get_all_relationship_embeddings

Description

Fetches all embeddings (dense and sparse) for multiple relationships in one request.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id":     "string",
  "relationships": [
    {
      "relationship_id": "string"
    },
    ...
  ],
  "use_job": false
}

Response

Success Response (200 OK):

{
  "results": [
    {
      "relationship_id": "node1",
      "error_code": "Success",
      "embeddings": [
        {
          "name":        "string",
          "type":        "string",
          "vector_data": [ ... ]
        },
        {
          "name":        "string",
          "type":        "string",
          "vector_data": [ ... ]
        }
      ]
    },
    {
      "relationship_id": "node2",
      "error_code": "Success",
      "embeddings": []
    },
    {
      "relationship_id": "nodeX",
      "error_code": "RelationshipNotFound"
    }
  ]
}

Error Responses:

  • 400: Missing or invalid fields.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

{
  "user_api_key": "api_key_123",
  "graph_id": "graph_ABC",
  "relationships": [
    { "relationship_id": "node1" },
    { "relationship_id": "node2" },
    { "relationship_id": "nodeX" }
  ],
  "use_job": false
}

Response

{
  "results": [
    {
      "relationship_id": "node1",
      "error_code": "Success",
      "embeddings": [
        {
          "name": "profile_vec",
          "type": "Float32",
          "vector_data": [0.12, 0.34, 0.56, 0.78]
        },
        {
          "name": "sparse_pref",
          "type": "SFloat32",
          "vector_data": [
            [0, 1.0],
            [3, 2.5]
          ]
        }
      ]
    },
    {
      "relationship_id": "node2",
      "error_code": "Success",
      "embeddings": []
    },
    {
      "relationship_id": "nodeX",
      "error_code": "RelationshipNotFound"
    }
  ]
}

6.19 /batch_search_entity_index

Description

Executes multiple /search_entity_index queries in a single request. Each query can perform either exact attribute matching or vector similarity search and may include its own filter.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "batch_queries": [
    {
      "attribute_name": "string",
      "index_type": "string",
      // Provide exactly one of the following:
      "attribute_value": "string",
      "vector": { "type": "Float32", "vector_data": [ ... ] },
      "top_k": 5,
      "similarity_measure": "Cosine",
      "entity_filter": { ... }
    },
    ...
  ],
  "use_job": false,
  "batch_count": 16
}
  • batch_queries: Ordered list of searches. For vector indices supply the embedding object under vector; for attribute indices supply attribute_value.
  • top_k, similarity_measure, and entity_filter are optional per-query overrides.
  • use_job (optional): When true, splits the work into background jobs; the immediate response includes a job_id and the completed payload is retrieved via the job API. batch_count (optional) controls how many jobs are created (default 16, capped by the number of queries).

Response

{
  "results": [
    {
      "attribute_name": "string",
      "index_type": "string",
      "entity_ids": ["string", ...],
      "error_code": "Success"
    },
    ...
  ]
}
  • The results array aligns with batch_queries order. Each entry echoes the query metadata and includes the per-query error_code (for example IndexNotFound, InvalidParameter, etc.).

Error Responses:

  • 400: A query omitted both attribute_value and vector, or provided both; unsupported similarity_measure.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

{
  "user_api_key": "api_key_123",
  "graph_id": "graph_ABC",
  "batch_queries": [
    {
      "attribute_name": "name",
      "index_type": "Attribute Index",
      "attribute_value": "Seattle"
    },
    {
      "attribute_name": "embedding_location",
      "index_type": "Vector Index",
      "vector": {
        "type": "Float32",
        "vector_data": [47.6061, -122.3328]
      },
      "top_k": 3
    }
  ],
  "use_job": false
}

Example Response (200 OK)

{
  "results": [
    {
      "attribute_name": "name",
      "index_type": "Attribute Index",
      "entity_ids": ["seattle_office", "seattle_hq"],
      "error_code": "Success"
    },
    {
      "attribute_name": "embedding_location",
      "index_type": "Vector Index",
      "entity_ids": ["seattle_hq", "bellevue_branch", "tacoma_branch"],
      "error_code": "Success"
    }
  ]
}

6.20 /batch_search_relationship_index

Description

Vectorised equivalent of /search_relationship_index that evaluates several relationship-index queries in one call.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "batch_queries": [
    {
      "attribute_name": "string",
      "index_type": "string",
      // Provide exactly one of the following:
      "attribute_value": "string",
      "vector": { "type": "Float32", "vector_data": [ ... ] },
      "top_k": 5,
      "similarity_measure": "Cosine",
      "relationship_filter": { ... }
    },
    ...
  ],
  "use_job": false,
  "batch_count": 16
}
  • Query fields mirror /batch_search_entity_index, with relationship_filter applying the predicate at query time.

Response

{
  "results": [
    {
      "attribute_name": "string",
      "index_type": "string",
      "relationship_ids": ["string", ...],
      "error_code": "Success"
    },
    ...
  ]
}

Error Responses:

  • 400: Missing or conflicting attribute_value/vector in a query.
  • 403: Invalid API Key.
  • 500: Internal server error.

Example

{
  "user_api_key": "api_key_123",
  "graph_id": "graph_ABC",
  "batch_queries": [
    {
      "attribute_name": "type",
      "index_type": "Attribute Index",
      "attribute_value": "acted_in"
    },
    {
      "attribute_name": "embedding_direction",
      "index_type": "Vector Index",
      "vector": {
        "type": "Float32",
        "vector_data": [0.01, 0.9, -0.2]
      },
      "relationship_filter": {
        "match_attribute": {
          "key": "status",
          "values": ["active"]
        }
      }
    }
  ],
  "use_job": false
}

Example Response (200 OK)

{
  "results": [
    {
      "attribute_name": "type",
      "index_type": "Attribute Index",
      "relationship_ids": ["r101", "r203"],
      "error_code": "Success"
    },
    {
      "attribute_name": "embedding_direction",
      "index_type": "Vector Index",
      "relationship_ids": ["r305", "r402"],
      "error_code": "Success"
    }
  ]
}

6.21 /import_entities

Description

Bulk-ingests entities from a CSV source. Exactly one of csv, json, or data must be supplied; at present only the CSV pipeline is implemented. Each successful request is executed asynchronously and returns one or more job IDs.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "csv": "https://example.com/entities.csv",
  "use_job": false
}
  • csv: HTTP(S) URL or file:// URI pointing to a UTF-8 CSV file accessible to the server. The header must include entity_id as the first column; additional columns become string attributes or embeddings (numeric vectors are auto-detected). Files downloaded via HTTP are cached temporarily during import.
  • json / data: Reserved for future streaming interfaces. The server currently responds with 501 Not Implemented if either field is used.

Response

{
  "error_code": "Success",
  "job_ids": ["im_user_graph_...", ...]
}

Each job processes a batch of rows (default 1000). Retrieve the final status with /get_job_result. A successful job result looks like:

{
  "error_code": "Success",
  "start_row": 1,
  "end_row": 1000,
  "count_success_create": 1000,
  "count_success_set": 980,
  "count_fail_create": 0,
  "count_fail_set": 20,
  "invalid_rows": [12, 48]
}

Error Responses (during request submission):

  • 400: Missing csv/json/data, invalid URL scheme, or malformed header.
  • 403: Invalid API Key.
  • 502: Remote CSV could not be downloaded.

Graph-level failures (e.g., graph not found, duplicate IDs) surface inside the per-job statistics.

Example

POST /import_entities
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "csv": "https://data.example.com/entities.csv",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "job_ids": ["im_api_key_123_graph_7384efd5"]
}

6.22 /import_relationships

Description

Imports relationships from a CSV source. The header must contain src_entity_id, relationship_id, and dest_entity_id (in that order); additional columns supply string attributes or embeddings for the relationship.

Method

  • POST

Request Body

{
  "user_api_key": "string",
  "graph_id": "string",
  "csv": "file:///absolute/path/to/relationships.csv",
  "use_job": false
}

Response

{
  "error_code": "Success",
  "job_ids": ["string", ...]
}

Each job ingests a batch of relationship rows. Retrieve progress via /get_job_result, which returns counters scoped to relationships:

{
  "error_code": "Success",
  "start_row": 1,
  "end_row": 1000,
  "count_success_create": 998,
  "count_success_set": 990,
  "count_fail_create": 2,
  "count_fail_set": 10,
  "invalid_rows": [17, 42]
}

Error Responses:

  • 400: Invalid or incomplete header, unsupported URI scheme, or no import option provided.
  • 403: Invalid API Key.
  • 502: Remote CSV could not be downloaded.

Example

POST /import_relationships
Content-Type: application/json

{
  "user_api_key": "api_key_123",
  "graph_id": "graph",
  "csv": "https://data.example.com/relationships.csv",
  "use_job": false
}

Response:

{
  "error_code": "Success",
  "job_ids": ["im_api_key_123_graph_1f9cb0f7", "im_api_key_123_graph_6aa5be0c"]
}

7. Server Job API

To support long-running or resource-intensive operations without requiring clients to maintain a persistent connection, most API endpoints offer asynchronous job execution. When you enable this feature, your request will be processed in the background, and you can poll for its completion using the job API.

To submit an API call as a job, add these parameters to your request body:

{
  "use_job": true,
  "batch_count": integer // optional; only applies to batch operations (default: 16)
}
  • use_job: Set to true to process the operation asynchronously.
  • batch_count: (Batch operations only) Specifies how many parallel jobs to split the batch into. The default is 16.

When a request is submitted as a job, the server responds with the job identifier(s):

  • For non-batch operations:

{
  "error_code": "string",
  "job_id": "string"
}
* For batch operations:

{
  "error_code": "string",
  "job_ids": ["string", "string", "string"]
}

Note: Not all endpoints support asynchronous job execution. The following endpoints do not support jobs and must be called synchronously:

  • All job management endpoints: /get_job_status, /get_job_result, /remove_job
  • Graph management: /create_graph, /remove_graph, /get_graphs

The following API endpoints are used to monitor and manage jobs:

7.1 /get_job_status

Description

Retrieves the current status of a job specified by job_id.

Method

  • POST

Request Body

{
  "job_id": "string"
}

Response

Success Response (200 OK):

{
  "error_code": "Success",
  "status": "Pending" | "In Progress" | "Success" | "Failed"
}

Error Responses:

  • 400: Missing or invalid field.
  • 404: Job not found.
  • 500: Internal server error.

Example

POST /get_job_status
Content-Type: application/json

{
  "job_id": "job_abc123"
}

Response:

{
  "error_code": "Success",
  "status": "Success"
}

7.2 /get_job_result

Description

Retrieves the result of a completed job specified by job_id. If the job is still in progress, the response will indicate that the result is not yet available.

Method

  • POST

Request Body

{
  "job_id": "string"
}

Response

  • Success Response (200 OK): Returns the response object for the original API call (format depends on the endpoint you invoked with use_job=true).

  • Accepted Response (202 Accepted): Indicates that the job is still running and the result is not yet available.

  • Error Responses:

  • 400: Missing or invalid field.

  • 403: Invalid API Key.
  • 404: Job not found.
  • 500: Internal server error.

Example

POST /get_job_result
Content-Type: application/json

{
  "job_id": "job_abc123"
}

Example Response (when completed):

{
  "error_code": "Success",
  "entity_ids": ["Alice", "Bob", "Charlie"]
}

Example Response (if still running):

Job is still running

7.3 /remove_job

Description

Removes a completed job from the server, freeing up any resources associated with the job. Only jobs that have finished running can be removed. If the job is still in progress or was not found, the response will indicate the status.

Method

  • POST

Request Body

{
  "job_id": "string"
}

Response

  • Success Response (200 OK):
{
  "error_code": "Success"
}
  • Job still running:
Job is not yet finished
  • Error Responses:

  • 400: Missing or invalid field.

  • 404: Job not found.
  • 500: Internal server error.

Example

POST /remove_job
Content-Type: application/json

{
  "job_id": "job_abc123"
}

Example Response (when completed and removed):

{
  "error_code": "Success"
}

Example Response (if job is still running):

Job is not yet finished

Appendix

The appendix contains several notes about how the Graph API works.

Filters

The VecML GraphDB REST API supports expressive, composable JSON predicates to filter entities.

Overall Structure

A filter is a JSON object representing either:

  • A logical combinator (and, or, xor, not) whose value is one or more sub-predicates, or
  • A leaf operation that tests a single property.

Example

{
  "and": [
    {
      "match_attribute": {
        "key": "status",
        "values": ["active"]
      }
    },
    {
      "less_than": {
        "key": "age",
        "value": 18
      }
    }
  ]
}

Logical Combinators

Operator Syntax Description
AND {"and":[<pred>,<pred>,…]} True if all sub-predicates are true.
OR {"or":[<pred>,<pred>,…]} True if any sub-predicate is true.
XOR {"xor":[<pred>,<pred>]} True if exactly one sub-predicate is true.
NOT {"not":<pred>} True if the sub-predicate is false.

Leaf Operations

Operation Syntax Description
match_attribute {"match_attribute":{"key":"<attr>","values":["v1","v2",…]}} <attr> equals any listed value.
attribute_exists {"attribute_exists":"<attr>"} Entity has attribute <attr>.
attribute_is_integer {"attribute_is_integer":"<attr>"} <attr> is an integer.
attribute_is_float {"attribute_is_float":"<attr>"} <attr> is a float.
less_than {"less_than":{"key":"<attr>","value":<num>}} <attr> < value (numeric or lexicographic).
true {"true":{}} Always true.
false {"false":{}} Always false.

Embeddings

The VecML GraphDB REST API supports three kinds of embeddings, each represented as a JSON object with at least two fields:

  • Dense float embeddingstype: "Float32"vector_data: an array of 32-bit floating-point values

  • Dense integer embeddingstype: "Int32"vector_data: an array of 32-bit integer values

  • Sparse float embeddingstype: "SFloat32"vector_data: an array of [index, value] pairs, where value is a 32-bit float

Some endpoints also require or return a "name" attribute alongside the two fields above.

Examples

// Dense float embedding (with name)
{
  "name": "embedding_location",
  "type": "Float32",
  "vector_data": [0.12, 0.83, 0.44, ]
}
// Dense integer embedding
{
  "type": "Int32",
  "vector_data": [12, 83, 44, ]
}
// Sparse float embedding (with name)
{
  "name": "embedding_word",
  "type": "SFloat32",
  "vector_data": [
    [3, 0.7],
    [42, 1.9],
    
  ]
}

Distance Function

When building or querying a Vector Index or a Fuzzy Attribute Index, you must specify a distance‐function. The supported values for dist_type / similarity_measure reside in the DistanceFunctionType enum. At a minimum, the following options are available:

  • Euclidean (default)
    Standard L₂‐norm (ℓ₂) distance:

$$ d_{\text{Euclidean}}(\mathbf x, \mathbf y) \;=\; \sqrt{\sum_{i}(x_i - y_i)^2} $$

  • Cosine
    One minus the cosine‐similarity:

$$ d_{\text{Cosine}}(\mathbf x, \mathbf y) \;=\; 1 \;-\; \frac{\langle \mathbf x, \mathbf y\rangle}{|\mathbf x|\;|\mathbf y|} $$

  • InnerProduct
    Equivalent to negative cosine when vectors are normalized; otherwise, the raw dot‐product.

  • Manhattan (or L₁)
    Sum of absolute differences:

$$ d_{\text{Manhattan}}(\mathbf x, \mathbf y) \;=\; \sum_{i} |\,x_i - y_i\,| $$

  • Hamming (or Binary‐Hamming)
    For binary‐encoded/sparse‐packed vectors, counts the number of differing bits.

Note:

  1. Only Vector Index and Fuzzy Attribute Index consult dist_type. All other index types ignore it.
  2. If you do not explicitly pass dist_type, the API defaults to Euclidean (see DistanceFunctionType::Euclidean in graph_interface.h).
  3. In code, these are all defined under enum DistanceFunctionType { Euclidean, Cosine, InnerProduct, Manhattan, Hamming, … }.

Index Types

The following index types are supported by the GraphInterface API (see “Types of Indices” in the SDK docs): :contentReference[oaicite:0]{index=0}

  • Attribute Index
    Finds all entities (or relationships) whose attribute value exactly equals the query term.

  • Fuzzy Attribute Index
    Performs approximate string‐matching on attribute values (e.g. edit‐distance or n‐gram based) to find entities (or relationships) whose attribute “approximately” matches the query term.

  • Vector Index
    An approximate nearest‐neighbor index over dense or sparse vectors. Commonly used for high‐dimensional embeddings (e.g. Float32). When creating a Vector Index, you supply:

  • dim – dimensionality of the vectors

  • dist_type – distance metric to use (see 0.6)

  • Integer Linear Index
    A linear (brute‐force) similarity search over integer‐valued vectors. Useful for scalar or quantized embeddings.

  • Float Linear Index
    A linear (brute‐force) similarity search over floating‐point vectors. Similar to Integer Linear Index, but for Float32‐typed vectors.