BrainAPI
BrainAPI
RetrieveEntity APIs

For the complete BrainAPI documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL. Docs MCP: /docs/mcp.

Existence API — Check an entity

Check whether a named entity exists and inspect its relationships and observations

Use GET /retrieve/entity/status when your application has a named thing and needs to resolve it to a graph node. This is a graph lookup, not a ranked document search.

What this answers

The endpoint answers four related questions:

  • Did BrainAPI resolve the target to a node?
  • Does that node have graph relationships?
  • Which relationship-and-neighbor pairs are attached to it?
  • Which observations are stored for that node?

For example, an incident tool can check whether payments-api is already represented before creating a duplicate service node. A learning application can check for a course by name before attaching a preference.

Before you call it

Ingest or create the entity first. The selected brain must contain graph nodes and node embeddings; passage-only ingestion with skip_enrichment=true does not create them.

Send a BrainPAT and an explicit brain scope:

curl --get "http://localhost:8000/retrieve/entity/status" \
  -H "BrainPAT: $BRAINPAT_TOKEN" \
  -H "X-Brain-ID: operations" \
  --data-urlencode "target=payments-api" \
  --data-urlencode "types=SERVICE"

Repeat types to allow more than one label:

?target=payments-api&types=SERVICE&types=APPLICATION

Read the response

When a node resolves, the response has this shape:

{
  "node": {
    "uuid": "service-42",
    "labels": ["SERVICE"],
    "name": "payments-api"
  },
  "exists": true,
  "has_relationships": true,
  "relationships": [],
  "observations": []
}

relationships contains predicate-and-neighbor pairs when present. observations contains stored observation objects, not generated prose.

No match is a successful lookup with an empty result, not an HTTP error:

{
  "node": null,
  "exists": false,
  "has_relationships": false,
  "relationships": [],
  "observations": []
}

Exact request contract

ParameterRequiredMeaning
targetYesText used to resolve a graph node through node-vector similarity.
typesNoRepeated label filter. BrainAPI selects the first resolved candidate whose labels intersect this list.
X-Brain-IDRecommendedBrain scope. See Authentication and brains.

Because resolution is similarity-based, exists=true means BrainAPI found the best eligible node; it does not prove an exact identifier match. If exact identity matters, store and retrieve stable UUIDs through the Model API.

When to use another surface

NeedBetter surface
Find passages that mention a serviceSearch
Assemble evidence for a model promptContext
List entities by label or textGET /retrieve/entities in the Retrieve reference
Inspect a known UUID's neighborsGET /retrieve/entities/neighbors in the Retrieve reference
Find peer entities connected through shared anchorsFind related entities

Troubleshoot

SymptomLikely causeWhat to check
exists=false after ingestionThe asynchronous task has not completed, the brain differs, or the entity was not extracted.Poll the task, compare X-Brain-ID, and list entities in the selected brain.
An unexpected node resolvesThe target is ambiguous or the eligible label set is too broad.Add types, use a more specific target, or resolve by UUID through Model operations.
exists=true but no relationshipsThe node is isolated or only passage data was saved.Inspect structured ingestion and graph creation.

Next, learn how to find related entities or choose a different retrieval surface.

Edit on GitHub

Last updated on

On this page