Skip to main content

What are Triples?

Triples are the building blocks of your knowledge graph. Each triple represents a fact in the form:
Subject → Predicate → Object
For example:
  • “Tesla” → “headquarters_in” → “Austin, Texas”
  • “Elon Musk” → “founded” → “SpaceX”
  • “SpaceX” → “founded_year” → “2002”

Creating Triples

Single Triple

curl -X POST https://neode.ai/api/triples \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "subject": "Tesla",
    "predicate": "headquarters_in",
    "object": "Austin, Texas",
    "object_type": "entity",
    "confidence": 0.95,
    "source": "https://wikipedia.org/wiki/Tesla",
    "index_id": "YOUR_INDEX_ID"
  }'

Batch Creation

Create multiple triples in one request:
curl -X POST https://neode.ai/api/triples \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "triples": [
      {
        "subject": "Tesla",
        "predicate": "founded_year",
        "object": "2003",
        "object_type": "literal"
      },
      {
        "subject": "Tesla",
        "predicate": "industry",
        "object": "Electric Vehicles",
        "object_type": "entity"
      },
      {
        "subject": "Tesla",
        "predicate": "ceo",
        "object": "Elon Musk",
        "object_type": "entity"
      }
    ],
    "index_id": "YOUR_INDEX_ID",
    "confidence": 0.9
  }'
Batch creation is more efficient than individual requests. Use it when storing multiple facts at once.

Querying Triples

By Subject

Get all facts about a specific entity:
curl "https://neode.ai/api/triples?subject=Tesla" \
  -H "Authorization: Bearer YOUR_API_KEY"

By Predicate

Get all facts of a specific type:
curl "https://neode.ai/api/triples?predicate=founded_by" \
  -H "Authorization: Bearer YOUR_API_KEY"

By Entity ID

Query using the resolved entity IDs:
# Get triples where entity is the subject
curl "https://neode.ai/api/triples?subject_entity_id=ENTITY_UUID" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Get triples where entity is the object
curl "https://neode.ai/api/triples?object_entity_id=ENTITY_UUID" \
  -H "Authorization: Bearer YOUR_API_KEY"
Search across subject, predicate, and object:
curl "https://neode.ai/api/triples?search=electric%20vehicle" \
  -H "Authorization: Bearer YOUR_API_KEY"

Filter by Graph

Get triples from a specific graph:
curl "https://neode.ai/api/triples?graph_id=GRAPH_UUID" \
  -H "Authorization: Bearer YOUR_API_KEY"

Combining Filters

curl "https://neode.ai/api/triples?subject=Tesla&predicate=founded_by&limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"

Updating Triples

Update an existing triple by ID:
curl -X PUT https://neode.ai/api/triples \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "id": "TRIPLE_UUID",
    "confidence": 0.99,
    "source": "https://updated-source.com"
  }'
You can update:
  • subject, predicate, object
  • confidence
  • source
  • graph_id

Deleting Triples

Single Delete

curl -X DELETE "https://neode.ai/api/triples?id=TRIPLE_UUID" \
  -H "Authorization: Bearer YOUR_API_KEY"

Batch Delete

curl -X DELETE "https://neode.ai/api/triples?ids=UUID1,UUID2,UUID3" \
  -H "Authorization: Bearer YOUR_API_KEY"

Best Practices

Predicate Naming

Use consistent, lowercase, snake_case predicates:
GoodAvoid
founded_byFoundedBy, Founded By
headquarters_inheadquartersIn, HQ
birth_datebirthDate, DOB

Confidence Scores

Be realistic with confidence scores:
{
  "confidence": 0.95  // Verified from authoritative source
}
{
  "confidence": 0.7   // From news article, may change
}

Sources

Always include sources when possible:
{
  "source": "https://wikipedia.org/wiki/Tesla",
  "confidence": 0.95
}

Entity vs Literal

Use the correct object type:
// Entity - references another thing
{
  "object": "Elon Musk",
  "object_type": "entity"
}

// Literal - a value
{
  "object": "2003",
  "object_type": "literal"
}

Response Example

{
  "success": true,
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "subject": "Tesla",
    "predicate": "founded_by",
    "object": "Elon Musk",
    "object_type": "entity",
    "confidence": 0.95,
    "source": "https://wikipedia.org/wiki/Tesla",
    "subject_entity_id": "entity-uuid-1",
    "object_entity_id": "entity-uuid-2",
    "index_id": "index-uuid",
    "created_at": "2026-01-27T10:00:00Z"
  }
}

API Reference

See the complete Triples API documentation.