Skip to Content
APIEndpointsSearch knowledge

Search knowledge

Semantic search over everything the brand itself has told us: its uploaded knowledge documents and its indexed website pages. Ask a question and it returns the passages that answer it best, each labelled with where it came from. Knowledge-base passages are the authoritative statement of what the product does; website passages are the public description of it.

Use this to check what the brand knows about itself before judging a conversation: whether it has an angle a thread has not covered, whether a claimed capability is real, or what its actual position on a topic is.

Requires the read:knowledge_base scope.

GET /v1/brands/{brand_id}/knowledge-documents/search

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands

Query parameters

ParameterTypeRequiredDescription
querystring, 3-300 charsrequiredWhat to look for, phrased as the question or claim to ground.

Request

curl --request GET \ --url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/knowledge-documents/search?query=Do%20you%20offer%20a%20free%20trial%3F' \ --header 'Authorization: Bearer <api-key>'

Response

{ "data": { "brand_id": "242546de-4cee-4a7d-952e-f6aa60c63ef8", "query": "Do you offer a free trial?", "passages": [ { "source": "knowledge_base", "title": "Pricing FAQ", "url": null, "content": "Asky offers a 14-day free trial on every plan, no credit card required to start." }, { "source": "website", "title": "Pricing — Asky", "url": "https://askylabs.com/pricing", "content": "Start free for 14 days. Upgrade any time, cancel any time." } ] }, "request_id": "req_a3f8c1e0b7d24f5a9c6e" }

Response fields

FieldTypeDescription
data.brand_iduuidrequired
data.querystringrequired. Echoes the query parameter
data.passages[].sourcestringrequired. One of knowledge_base, website
data.passages[].titlestringrequired
data.passages[].urlstring | nullrequired. null for knowledge_base passages — they have no public URL. Populated for website passages
data.passages[].contentstringrequired. The matched passage text
request_idstringrequired. Also returned as the x-request-id header. Quote it when contacting support

Errors

StatusCodeWhen
400invalid_requestquery is under 3 or over 300 characters
401invalid_tokenThe key is missing, malformed, or does not exist
401token_expiredThe key passed its expiry date
401token_revokedThe key was revoked
403insufficient_scopeThe key does not carry read:knowledge_base
404not_foundThe brand does not exist, or this key is not allowed to reach it
429rate_limitedOver 300 requests per minute

Notes

Not paginated. This returns a bounded set of the best-matching passages for query, not a collection — there is no limit or cursor here.

Two different kinds of ground truth. Knowledge-base passages are the brand’s own authoritative statement of what it does; website passages are what it publicly says about itself on its own site. A gap between the two is itself a signal worth surfacing.

query is a question or claim, not a keyword list. Phrase it the way you’d phrase the thing you’re trying to ground — this is semantic search, not a text-match filter like search on List prompts.

Last updated on