Skip to content
TriedDocs
Public endpoints

Get public KB retrievals

Read a call's knowledge base lookups through the signed knowledge_base_retrieved_contents_url.

GEThttps://api.tried.com.au/public/calls/{call_id}/kb-retrievals

Returns every knowledge base lookup the agent made during a call, oldest first. Open the knowledge_base_retrieved_contents_url field of the call object rather than building the URL. It works without an API key until it expires. With an API key, List knowledge base retrievals returns the same lookups with their IDs.

The link looks like https://api.tried.com.au/public/calls/<call_id>/kb-retrievals?exp=<ms>&sig=<hex> and follows the same rules as public_log_url: a 7-day expiry from the time the call object was returned, an HMAC-SHA256 signature, and null for calls with call_status: "registered". A log link does not work for retrievals or the other way round, because the link kind is part of the signature.

Request#

Path parameters#

Parameter Type Required Description
call_id string Yes The call.

Query parameters#

Parameter Type Required Description
exp string Yes Expiry from the signed link.
sig string Yes Signature from the signed link.

Example request#

curl "$KB_RETRIEVALS_URL"
const call = await (await fetch("https://api.tried.com.au/v2/get-call/call_c837e1e2d9691e32ae3bbd47", {
  headers: { Authorization: `Bearer ${process.env.TRIED_API_KEY}` },
})).json();
const kb = await (await fetch(call.knowledge_base_retrieved_contents_url)).json();
import os, requests

call = requests.get(
    "https://api.tried.com.au/v2/get-call/call_c837e1e2d9691e32ae3bbd47",
    headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
).json()
kb = requests.get(call["knowledge_base_retrieved_contents_url"]).json()

Response#

200 OK

{
  "call_id": "call_c837e1e2d9691e32ae3bbd47",
  "retrievals": [
    {
      "query": "what about Saturday?",
      "rewritten_query": "Are you open on Saturday? what about Saturday?",
      "chunks": [
        {
          "text": "We are open 8am to 6pm, Monday to Saturday.",
          "score": 0.8123,
          "source_title": "Opening hours",
          "knowledge_base_id": "knowledge_base_9f060d81a4d8df9b04ca6d12"
        }
      ],
      "timestamp": 1792310461532
    }
  ]
}
Field Type Description
retrievals[].query string The query the agent sent.
retrievals[].rewritten_query string or null The standalone query built from recent turns, or null when the query was not rewritten.
retrievals[].chunks array Chunks returned, best first. Fields as in List knowledge base retrievals.
retrievals[].timestamp integer Unix ms when the lookup ran.

A call with no lookups returns an empty retrievals array.

Errors#

Status When
403 Invalid or expired link: exp or sig is missing, exp is in the past, or the signature does not match.
429 Per-IP rate limit exceeded. See Rate limits.

See Errors for the body format.