Ask a question grounded in a lens's focused entities
const url = 'http://localhost:11044/api/v1/lenses/chat';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"conversationId":"example","english":"example","lensId":"example","question":"example","script":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:11044/api/v1/lenses/chat \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "conversationId": "example", "english": "example", "lensId": "example", "question": "example", "script": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Optional, and never needed: the call always acts as the signed-in principal. Naming the principal changes nothing; naming anyone else is refused with 403.
Request Bodyrequired
Section titled “Request Bodyrequired”question is answered from the lens’s focused entities. The lens comes from lensId (a saved, world or realm lens id, or a saved view name) when it is non-blank and resolves, else from script (a CypherScript, run without saving), else is generated from english. Omit conversationId on the first turn and send back the returned one to continue the same conversation
A question to answer grounded in a lens’s focused entities; sent to POST /lenses/chat. The lens comes from lensId, else script, else is generated from english.
object
Conversation to continue. Omit or leave blank on the first turn and the server starts one, answering its id as conversationId; pass that back on later turns.
Plain-English description the server generates a CypherScript lens from; used only when neither lensId nor script gives the lens
Id of a saved or world lens to open, e.g. briefing. When it is blank or names no lens, the lens is taken from script or english instead.
The question, answered by the main chat with the lens’s focused entities added to the caller’s working state
Ready CypherScript program to open as the lens; used when lensId gives none, and preferred over english
Example generated
{ "conversationId": "example", "english": "example", "lensId": "example", "question": "example", "script": "example"}Responses
Section titled “Responses”OK
object
Example generated
{}No authenticated principal
A refusal carrying only a human-readable reason.
object
What went wrong, in the terms the caller can act on.
Example generated
{ "error": "example"}username names someone other than the signed-in principal
A refusal carrying only a human-readable reason.
object
What went wrong, in the terms the caller can act on.
Example generated
{ "error": "example"}
