Skip to main content
POST
/
api
/
triples
/
generate
curl --request POST \
  --url https://www.neode.ai/api/triples/generate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "query": "Extract facts about Tesla's Q4 2025 earnings",
  "index_id": "550e8400-e29b-41d4-a716-446655440000",
  "triple_count": 10
}
EOF
{
  "success": true,
  "data": [
    {
      "subject": "<string>",
      "predicate": "<string>",
      "object": "<string>",
      "object_type": "literal",
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "confidence": 0.5,
      "source": "<string>",
      "graph_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "index_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "subject_entity_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "object_entity_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "created_at": "2023-11-07T05:31:56Z"
    }
  ],
  "count": 123,
  "graph_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "provider": "<string>",
  "credits_used": 123,
  "balance_remaining": 123,
  "auto_topup_triggered": true
}

Authorizations

Authorization
string
header
required

API key for authentication

Query Parameters

format
enum<string>
default:json

Response format. 'json' returns a standard JSON response (default, recommended for SDKs). 'stream' returns a Vercel AI SDK data stream for chat UIs.

Available options:
json,
stream

Body

application/json

Request to generate triples using AI (OpenAI)

query
string
required

Natural language description of what to extract triples about

index_id
string<uuid>
required

Index for entity disambiguation (required)

graph_id
string<uuid>

Graph to store generated triples in

Enable web search for real-time information

triple_count
integer
default:10

Target number of triples to generate (approximate)

Required range: 1 <= x <= 50
predicates
string[]

Restrict to specific predicate types

subject_entity
string

Constrain all generated triples to use this exact subject

rules
string

Custom rules or instructions for the AI generation

Enable news-specific search for recent events

create_graph
boolean
default:true

Auto-create a graph for generated triples when no graph_id is provided. When true (default) and no graph_id is given, a new graph is created and all generated triples are associated with it.

Response

Generated triples (streaming or JSON based on format parameter)

Response from generating triples with AI

success
boolean
data
object[]
count
integer
graph_id
string<uuid>

Graph ID the triples were stored in (auto-created or provided)

provider
string

AI provider used (openai)

credits_used
integer

Credits deducted for generation

balance_remaining
integer

Remaining credit balance

auto_topup_triggered
boolean

Whether auto top-up was triggered after this generation