Skip to main content
POST
/
knowledge-base
/
{id}
/
index
Index documents in a knowledge base
curl --request POST \
  --url https://api.vectorshift.ai/v1/knowledge-base/{id}/index \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "file_data": {
    "file": {
      "type": "file",
      "raw_bytes": "aSDinaTvuI8gbWludGxpZnk=",
      "metadata": {
        "name": "<string>",
        "path": "<string>",
        "mime_type": "<string>"
      }
    },
    "custom_metadata": {}
  },
  "wikipedia": "<string>",
  "youtube": "<string>",
  "arxiv": "<string>",
  "config": {
    "index_tables": false,
    "analyze_documents": false,
    "enrichment_tasks": [],
    "file_processing_implementation": "Default",
    "chunk_size": 123,
    "chunk_overlap": 123,
    "apify_api_key": "<string>"
  }
}
'
import requests

url = "https://api.vectorshift.ai/v1/knowledge-base/{id}/index"

payload = {
"file_data": {
"file": {
"type": "file",
"raw_bytes": "aSDinaTvuI8gbWludGxpZnk=",
"metadata": {
"name": "<string>",
"path": "<string>",
"mime_type": "<string>"
}
},
"custom_metadata": {}
},
"wikipedia": "<string>",
"youtube": "<string>",
"arxiv": "<string>",
"config": {
"index_tables": False,
"analyze_documents": False,
"enrichment_tasks": [],
"file_processing_implementation": "Default",
"chunk_size": 123,
"chunk_overlap": 123,
"apify_api_key": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
file_data: {
file: {
type: 'file',
raw_bytes: 'aSDinaTvuI8gbWludGxpZnk=',
metadata: {name: '<string>', path: '<string>', mime_type: '<string>'}
},
custom_metadata: {}
},
wikipedia: '<string>',
youtube: '<string>',
arxiv: '<string>',
config: {
index_tables: false,
analyze_documents: false,
enrichment_tasks: [],
file_processing_implementation: 'Default',
chunk_size: 123,
chunk_overlap: 123,
apify_api_key: '<string>'
}
})
};

fetch('https://api.vectorshift.ai/v1/knowledge-base/{id}/index', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vectorshift.ai/v1/knowledge-base/{id}/index",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'file_data' => [
'file' => [
'type' => 'file',
'raw_bytes' => 'aSDinaTvuI8gbWludGxpZnk=',
'metadata' => [
'name' => '<string>',
'path' => '<string>',
'mime_type' => '<string>'
]
],
'custom_metadata' => [

]
],
'wikipedia' => '<string>',
'youtube' => '<string>',
'arxiv' => '<string>',
'config' => [
'index_tables' => false,
'analyze_documents' => false,
'enrichment_tasks' => [

],
'file_processing_implementation' => 'Default',
'chunk_size' => 123,
'chunk_overlap' => 123,
'apify_api_key' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.vectorshift.ai/v1/knowledge-base/{id}/index"

payload := strings.NewReader("{\n \"file_data\": {\n \"file\": {\n \"type\": \"file\",\n \"raw_bytes\": \"aSDinaTvuI8gbWludGxpZnk=\",\n \"metadata\": {\n \"name\": \"<string>\",\n \"path\": \"<string>\",\n \"mime_type\": \"<string>\"\n }\n },\n \"custom_metadata\": {}\n },\n \"wikipedia\": \"<string>\",\n \"youtube\": \"<string>\",\n \"arxiv\": \"<string>\",\n \"config\": {\n \"index_tables\": false,\n \"analyze_documents\": false,\n \"enrichment_tasks\": [],\n \"file_processing_implementation\": \"Default\",\n \"chunk_size\": 123,\n \"chunk_overlap\": 123,\n \"apify_api_key\": \"<string>\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.vectorshift.ai/v1/knowledge-base/{id}/index")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"file_data\": {\n \"file\": {\n \"type\": \"file\",\n \"raw_bytes\": \"aSDinaTvuI8gbWludGxpZnk=\",\n \"metadata\": {\n \"name\": \"<string>\",\n \"path\": \"<string>\",\n \"mime_type\": \"<string>\"\n }\n },\n \"custom_metadata\": {}\n },\n \"wikipedia\": \"<string>\",\n \"youtube\": \"<string>\",\n \"arxiv\": \"<string>\",\n \"config\": {\n \"index_tables\": false,\n \"analyze_documents\": false,\n \"enrichment_tasks\": [],\n \"file_processing_implementation\": \"Default\",\n \"chunk_size\": 123,\n \"chunk_overlap\": 123,\n \"apify_api_key\": \"<string>\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.vectorshift.ai/v1/knowledge-base/{id}/index")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"file_data\": {\n \"file\": {\n \"type\": \"file\",\n \"raw_bytes\": \"aSDinaTvuI8gbWludGxpZnk=\",\n \"metadata\": {\n \"name\": \"<string>\",\n \"path\": \"<string>\",\n \"mime_type\": \"<string>\"\n }\n },\n \"custom_metadata\": {}\n },\n \"wikipedia\": \"<string>\",\n \"youtube\": \"<string>\",\n \"arxiv\": \"<string>\",\n \"config\": {\n \"index_tables\": false,\n \"analyze_documents\": false,\n \"enrichment_tasks\": [],\n \"file_processing_implementation\": \"Default\",\n \"chunk_size\": 123,\n \"chunk_overlap\": 123,\n \"apify_api_key\": \"<string>\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "document_ids": [
    "<string>"
  ]
}
{
"status": "failed",
"error": "<string>"
}
{
"status": "failed",
"error": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer token authentication using API key

Path Parameters

id
string
required

Knowledge base ID

Body

file_data
object
required
url_data
object
wikipedia
string
youtube
string
arxiv
string
config
object

Response

Document indexed successfully

status
enum<string>
Available options:
success,
failed
document_ids
string[]