Retrieve ranked documents across the organization
const url = 'https://api.yggy.tech/api/v1/query';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"question":"example","topK":5,"mode":"hybrid","include":["entities"],"includeArchived":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.yggy.tech/api/v1/query \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "question": "example", "topK": 5, "mode": "hybrid", "include": [ "entities" ], "includeArchived": false }'Return ranked document contexts for a question across every project the caller can access. Same body as the project query, including optional include.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters ”Request Body
Section titled “Request Body ”object
Natural-language question to retrieve documents for
Maximum number of ranked contexts to return
Hybrid combines document text with graph matches; lexical uses document text only; graph uses graph matches only
Optional graph fields to attach. Omit for the default retrieve body. identity alone returns only entities with an approved identity.
Also search cold triples. Archived hits surface separately and trigger a background promote. Single-project scope only.
Responses
Section titled “ Responses ”Ranked contexts and an extractive answer
object
Short extractive answer from the top context. Empty when nothing was retrieved.
object
Stable context id: source slug when present, otherwise the document id
Document id
Caller-supplied source id when the document has one
Document title
Short passage used for ranking
Relative rank from 0 to 1 inside this result set
Present when include asks for entities or identity
object
Public entity URI. Never a graph uid.
Public class URI
Ranked context document ids this entity matched
object
Approved identity namespace, for example a Wikidata entity prefix
Value in that namespace
Present when include asks for triples
object
object
Public HTTPS URI when one is stored
object
Public HTTPS URI when one is stored
object
Public HTTPS URI when one is stored
Stored hit text. Omitted when the graph hit has none.
Present when includeArchived was requested on a single project
object
Verbalized cold fact, e.g. subject predicate object
Example generated
{ "answer": "example", "contexts": [ { "id": "example", "documentId": "example", "source": "example", "title": "example", "snippet": "example", "score": 1 } ], "entities": [ { "uri": "example", "label": "example", "type": "example", "score": 1, "documentIds": [ "example" ], "identity": { "namespaceUri": "example", "value": "example" } } ], "triples": [ { "subject": { "uri": "example", "label": "example" }, "predicate": { "uri": "example", "label": "example" }, "object": { "uri": "example", "label": "example" }, "evidence": "example", "documentId": "example" } ], "archivedHits": [ { "tripleKey": "example", "text": "example", "score": 1 } ]}Invalid request or usage limit exceeded
object
object
Example
{ "success": false, "error": { "code": "INTERNAL_ERROR" }}Authentication required
object
object
Example
{ "success": false, "error": { "code": "INTERNAL_ERROR" }}Project access denied
object
object
Example
{ "success": false, "error": { "code": "INTERNAL_ERROR" }}