Create Knowledge Base From Files
curl --request POST \
--url https://app.backend.genezio.ai/customer/v1/brands/{brand_id}/knowledge-bases/files \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--form files=@example-file \
--form 'title=<string>' \
--form chunk_tokens=256import requests
url = "https://app.backend.genezio.ai/customer/v1/brands/{brand_id}/knowledge-bases/files"
files = { "files": ("example-file", open("example-file", "rb")) }
payload = {
"title": "<string>",
"chunk_tokens": "256"
}
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '<string>');
form.append('title', '<string>');
form.append('chunk_tokens', '256');
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
options.body = form;
fetch('https://app.backend.genezio.ai/customer/v1/brands/{brand_id}/knowledge-bases/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"chunk_tokens": 123,
"created_at": "2023-11-07T05:31:56Z",
"id": 123,
"status": "active",
"title": "<string>",
"type": "text",
"updated_at": "2023-11-07T05:31:56Z",
"version": 123,
"crawled_pages": 123,
"error": "<string>",
"filenames": [
"<string>"
],
"max_pages": 123,
"notify_emails": [
"<string>"
],
"schedule": {
"interval": "daily",
"days": [
3
],
"time": "03:00"
},
"url": "<string>",
"url_pattern": "<string>"
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}Knowledge bases
Create a knowledge base from files
Create a knowledge base from up to 20 files of up to 25 MiB each.
Send the files as multipart/form-data. The answer is 202 with status: indexing, as for a text or a site. It costs an embedding of each chunk.
POST
/
customer
/
v1
/
brands
/
{brand_id}
/
knowledge-bases
/
files
Create Knowledge Base From Files
curl --request POST \
--url https://app.backend.genezio.ai/customer/v1/brands/{brand_id}/knowledge-bases/files \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--form files=@example-file \
--form 'title=<string>' \
--form chunk_tokens=256import requests
url = "https://app.backend.genezio.ai/customer/v1/brands/{brand_id}/knowledge-bases/files"
files = { "files": ("example-file", open("example-file", "rb")) }
payload = {
"title": "<string>",
"chunk_tokens": "256"
}
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '<string>');
form.append('title', '<string>');
form.append('chunk_tokens', '256');
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
options.body = form;
fetch('https://app.backend.genezio.ai/customer/v1/brands/{brand_id}/knowledge-bases/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"chunk_tokens": 123,
"created_at": "2023-11-07T05:31:56Z",
"id": 123,
"status": "active",
"title": "<string>",
"type": "text",
"updated_at": "2023-11-07T05:31:56Z",
"version": 123,
"crawled_pages": 123,
"error": "<string>",
"filenames": [
"<string>"
],
"max_pages": 123,
"notify_emails": [
"<string>"
],
"schedule": {
"interval": "daily",
"days": [
3
],
"time": "03:00"
},
"url": "<string>",
"url_pattern": "<string>"
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}{
"error": {
"code": "brand_access_denied",
"message": "This API key has no access to this brand",
"details": [
{
"field": "page_size",
"message": "Input should be less than or equal to 100"
}
],
"request_id": "4f3c2e1a-9b7d-4c1e-8f2a-1d3e5b7c9a0f"
}
}Authorizations
An API key of your account, from Settings > API Keys. It starts with gnz-.
Path Parameters
Body
multipart/form-data
Response
Successful Response
indexing: the platform reads it now. active: the check of the facts reads it.
Available options:
active, indexing, error, cancelled Available options:
text, url, file Each crawl again makes a new version.
The pages of the last crawl.
When the platform crawls the site again, in UTC.
Show child attributes
Show child attributes