#how can i add knowledge base to an agent through the api

1 messages · Page 1 of 1 (latest)

spiral sleetBOT
#
AI-generated Answer for bu.ilder

To add a knowledge base to an agent through the API, you can use the POST /v1/convai/agents/{agent_id}/add-to-knowledge-base endpoint. Here's a brief guide on how to do it:

  1. Headers: Include your API key in the request header as xi-api-key.

  2. Path Parameter: Provide the agent_id in the URL path. This ID is returned when you create an agent.

  3. Body: You can either upload a file or provide a URL to the documentation:

    • For a file, use the file parameter to upload the document.
    • For a URL, use the url parameter to specify the link to the documentation.
  4. cURL Example:

    curl --request POST \
      --url https://api.elevenlabs.io/v1/convai/agents/{agent_id}/add-to-knowledge-base \
      --header 'Content-Type: multipart/form-data' \
      --form 'url=<string>'
    

After adding the document, remember to patch your agent with the returned document ID to ensure the knowledge base changes take effect.

marble wedge
#

how do i patch the agent