createEntity
Create an entity with a canonical name, aliases and a schema-declared type.
createEntity(input: CreateEntityInput): Promise<CreateEntityResult>createEntity(request: EntityCreateRequest): Promise<EntityCreateResponse>Parameters
entityTypeIdintegerrequiredA type id from the active schema. A type that is not declared there is rejected.
canonicalNamestringrequiredThe name Brain treats as the entity's own.
aliasesstring[]optionalOther surface forms that should resolve here. Defaults to empty.
Returns
entityIdstringalwaysThe new entity.
The wire request carries two fields the HTTP body does not: a sessionId,
attributing the entity to a session, and an attributesBlob.
Prefer resolveEntity with creation allowed
when you are turning a surface form into an entity — it checks for an existing
match first, where createEntity always writes a new one.
On the wire
Ids are fixed-width UUID bytes rather than strings, attributes is an opaque
attributesBlob, and every request carries a requestId plus an optional
actAs. See Wire client.
Was this page helpful?