Chatbot and AI
Create/Edit Knowledge
Creates or edits a knowledge base for AI agents. (Requires an OpenAI API key configured on the instance)
POST
https://api.zapzapapi.com/api/v1/{instanceId}/knowledge/editAuthentication with the x-api-key and x-api-secret headers.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
id | text | body | No | Knowledge ID (empty to create a new one) |
delete | select | body | No | Defines whether this is a delete operation |
knowledge | json | body | No | Knowledge content |
fileType | select | body | No | File type when not detected automatically |
Request example
curl
curl -X POST "https://api.zapzapapi.com/api/v1/{instanceId}/knowledge/edit" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-api-secret: YOUR_API_SECRET" \
-H "Content-Type: application/json" \
-d '{"id":"id","delete":true}'Node.js
const res = await fetch("https://api.zapzapapi.com/api/v1/{instanceId}/knowledge/edit", {
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"x-api-secret": "YOUR_API_SECRET",
"Content-Type": "application/json",
},
body: JSON.stringify({
"id": "id",
"delete": true
}),
});
console.log(await res.json());Python
import requests
res = requests.post(
"https://api.zapzapapi.com/api/v1/{instanceId}/knowledge/edit",
headers={"x-api-key": "YOUR_API_KEY", "x-api-secret": "YOUR_API_SECRET"},
json={"id":"id","delete":True},
)
print(res.json())Response example
JSON
{
"ok": true
}Values are illustrative; the fields follow the real response format.
Other endpoints in this category
Get your API keys
Create your account, connect a number in minutes and start using the API. R$15 per active number/month, with a welcome credit when you create the account, subject to the current campaign.
