OriginChainDB
Database endpoints

Train GraphSAGE embeddings

Train node embeddings from graph relationships and row features, and optionally save them for similarity search.

POST /v1/tenants/{tenant}/graph/{schema}/graphsage

Learn representations from links and featuresSave embeddings when you intend to use the GraphSAGE similarity endpoint.
  1. Prepare links and featuresChoose the relation and numeric row-feature column.
  2. Train node embeddingsCombine graph neighborhoods with feature values.
  3. Check persisted outputVerify saving before searching the learned vectors.

Before you start

Use your database bearer token.

Connection setup

Populate the graph and a numeric-array feature column first. The example uses three finite values per row in features. Saving embeddings requires schema DDL permission.

Path parameters

FieldTypeRequired
tenantstringRequired
schemastringRequired

Headers

FieldTypeRequiredDescription
x-oc-db-userstringOptionalActing database user (role, grant and row-policy checks). Send with x-oc-db-key.
x-oc-db-keystringOptionalAPI key of the x-oc-db-user user.

Request body

application/json

Limits and accepted values
  • feature_col names the per-row numeric-array feature column.
  • Defaults: feature_dim 128, embedding_dim 128, hidden_dim 128 (each 1..1024), num_layers 2 (1..4), neighbor_sample_size 25 (1..50), aggregator mean (mean | max_pool | lstm), walks_per_node 10, walk_length 80, window_size 5, negative_samples 5, epochs 5, initial_lr 0.025, min_lr 0.0001, seed 0.
  • persist defaults to false;
  • persist=true also requires the schema DDL privilege.
  • Graphs above 100,000 nodes are refused.
FieldTypeRequired
aggregatorstringOptional
embedding_dimintegerOptional
epochsintegerOptional
feature_colstringRequired
feature_dimintegerOptional
hidden_dimintegerOptional
initial_lrnumberOptional
min_lrnumberOptional
negative_samplesintegerOptional
neighbor_sample_sizeintegerOptional
num_layersintegerOptional
persistbooleanOptional
relstringRequired
seedintegerOptional
walk_lengthintegerOptional
walks_per_nodeintegerOptional
window_sizeintegerOptional

Read the result

embeddings maps nodes to numeric vectors. Check persisted before calling the matching similarity-search endpoint. final_loss describes training, not a guarantee of useful recommendations.

Response statuses

HTTP status reference
StatusWhat to do
200OK
400Correct the request before retrying.
401Check the credential and Authorization header.
402Check feature access or available credits.
403Check tenant access, roles and permissions.
404Check the resource ID and API route.
409Resolve the conflict before retrying.
413Split or reduce the request body.
415Send the required Content-Type.
422Correct the values or unsupported combination.
429Honor Retry-After when present; back off.
500Check the outcome before retrying a write.
503Honor Retry-After when present; check write outcomes.
© 2026 Silicoyn Technologies Pvt Ltd