Skip to main content
POST
/
knowledge-base-document-upload
Upload a knowledge base document
curl --request POST \
  --url https://cool.jobmojito.com/functions/v1/knowledge-base-document-upload \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form knowledge_base_store_id=d9d6f121-1230-48fd-b3a7-8b5a1e8db052 \
  --form file='@example-file' \
  --form 'name=<string>' \
  --form 'merchant_id=<string>'
import requests

url = "https://cool.jobmojito.com/functions/v1/knowledge-base-document-upload"

files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"knowledge_base_store_id": "d9d6f121-1230-48fd-b3a7-8b5a1e8db052",
"name": "<string>",
"merchant_id": "<string>"
}
headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.text)
const form = new FormData();
form.append('knowledge_base_store_id', 'd9d6f121-1230-48fd-b3a7-8b5a1e8db052');
form.append('file', '<string>');
form.append('name', '<string>');
form.append('merchant_id', '<string>');

const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

options.body = form;

fetch('https://cool.jobmojito.com/functions/v1/knowledge-base-document-upload', 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://cool.jobmojito.com/functions/v1/knowledge-base-document-upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"knowledge_base_store_id\"\r\n\r\nd9d6f121-1230-48fd-b3a7-8b5a1e8db052\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"merchant_id\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);

$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://cool.jobmojito.com/functions/v1/knowledge-base-document-upload"

payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"knowledge_base_store_id\"\r\n\r\nd9d6f121-1230-48fd-b3a7-8b5a1e8db052\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"merchant_id\"\r\n\r\n<string>\r\n-----011000010111000001101001--")

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

req.Header.Add("Authorization", "Bearer <token>")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://cool.jobmojito.com/functions/v1/knowledge-base-document-upload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"knowledge_base_store_id\"\r\n\r\nd9d6f121-1230-48fd-b3a7-8b5a1e8db052\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"merchant_id\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();
require 'uri'
require 'net/http'

url = URI("https://cool.jobmojito.com/functions/v1/knowledge-base-document-upload")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"knowledge_base_store_id\"\r\n\r\nd9d6f121-1230-48fd-b3a7-8b5a1e8db052\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"merchant_id\"\r\n\r\n<string>\r\n-----011000010111000001101001--"

response = http.request(request)
puts response.read_body
{
  "knowledge_base_id": "<string>"
}
{
"error": "Field is required.",
"name": "interview_result_id"
}
{
"error": "Field is required.",
"name": "interview_result_id"
}

Authorizations

Authorization
string
header
required

Supabase JWT — Authorization: Bearer <token>.

Body

knowledge_base_store_id
string
required

The knowledge base store to add the document to.

Minimum string length: 1
Example:

"d9d6f121-1230-48fd-b3a7-8b5a1e8db052"

file
file
required

The document file (binary).

name
string

Document name (with extension). Falls back to the uploaded file name for multipart.

merchant_id
string

Override merchant id (admin / sub-merchant only).

Response

The document was uploaded and queued for processing.

knowledge_base_id
string
required

Id of the created knowledge_base record.