Knowledge

Search Knowledge Chunks

Changed on

Perform semantic search across knowledge sources within a knowledge base to find the most relevant content chunks based on a natural language query. Returns ranked chunks with similarity scores, allowing you to retrieve contextually relevant information for AI applications, chatbots, or information retrieval systems. You can filter results by specific knowledge sources.

post/v2/KnowledgeBases/{kbId}/Search

Request

  • Base URL
    https://knowledge.twilio.com
  • URL
    https://knowledge.twilio.com/v2/KnowledgeBases/{kbId}/Search
  • Auth
    HTTP basic

Request body

querystring required

The query to search the knowledge source.

topinteger required

The top K results to return.

knowledgeIdsKnowledgeId[]

The list of knowledge IDs to search.

Example request

{
  "query": "How do I reset my password?",
  "top": 5,
  "knowledgeIds": [
    "know_knowledge_00000000000000000000000000"
  ]
}

Response

OK

Example response

{
  "chunks": [
    {
      "chunkIndex": 2,
      "documentTitle": "Authentication — Twilio Docs",
      "documentUrl": "https://docs.twilio.com/en/api/authentication",
      "documentNumber": 12,
      "knowledgeId": "know_knowledge_00000000000000000000000000"
    }
  ]
}

Changes

    • breaking

      the response property's max was increased from 99999.00 to 999999.00 for the response status

    • breaking

      the response property's max was increased from 99999.00 to 999999.00 for the response status

    • breaking

      the response property's max was increased from 99999.00 to 999999.00 for the response status

    • breaking

      the response property's max was increased from 99999.00 to 999999.00 for the response status

    • breaking

      the response property's max was increased from 99999.00 to 999999.00 for the response status

    • breaking

      the response property's max was increased from 99999.00 to 999999.00 for the response status

    • breaking

      the response property's max was increased from 99999.00 to 999999.00 for the response status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status