#how can i add knowledge base to an agent through the api
1 messages · Page 1 of 1 (latest)
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:
-
Headers: Include your API key in the request header as
xi-api-key. -
Path Parameter: Provide the
agent_idin the URL path. This ID is returned when you create an agent. -
Body: You can either upload a file or provide a URL to the documentation:
- For a file, use the
fileparameter to upload the document. - For a URL, use the
urlparameter to specify the link to the documentation.
- For a file, use the
-
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.
how do i patch the agent