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/searchAuthorization
| Header | Type | Required |
|---|---|---|
Authorization | Bearer asky_sk_… | required |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
brand_id | uuid | required | From List brands |
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string, 3-300 chars | required | What to look for, phrased as the question or claim to ground. |
Request
cURL
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
200
{
"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
| Field | Type | Description |
|---|---|---|
data.brand_id | uuid | required |
data.query | string | required. Echoes the query parameter |
data.passages[].source | string | required. One of knowledge_base, website |
data.passages[].title | string | required |
data.passages[].url | string | null | required. null for knowledge_base passages — they have no public URL. Populated for website passages |
data.passages[].content | string | required. The matched passage text |
request_id | string | required. Also returned as the x-request-id header. Quote it when contacting support |
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | query is under 3 or over 300 characters |
| 401 | invalid_token | The key is missing, malformed, or does not exist |
| 401 | token_expired | The key passed its expiry date |
| 401 | token_revoked | The key was revoked |
| 403 | insufficient_scope | The key does not carry read:knowledge_base |
| 404 | not_found | The brand does not exist, or this key is not allowed to reach it |
| 429 | rate_limited | Over 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.