curl --request POST \
--url https://api.anam.ai/v1/knowledge/groups/{id}/documents/presigned-upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"contentType": "<string>",
"fileSize": 1,
"chunkSize": 1050,
"chunkOverlap": 500
}
'import requests
url = "https://api.anam.ai/v1/knowledge/groups/{id}/documents/presigned-upload"
payload = {
"filename": "<string>",
"contentType": "<string>",
"fileSize": 1,
"chunkSize": 1050,
"chunkOverlap": 500
}
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({
filename: '<string>',
contentType: '<string>',
fileSize: 1,
chunkSize: 1050,
chunkOverlap: 500
})
};
fetch('https://api.anam.ai/v1/knowledge/groups/{id}/documents/presigned-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://api.anam.ai/v1/knowledge/groups/{id}/documents/presigned-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 => json_encode([
'filename' => '<string>',
'contentType' => '<string>',
'fileSize' => 1,
'chunkSize' => 1050,
'chunkOverlap' => 500
]),
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.anam.ai/v1/knowledge/groups/{id}/documents/presigned-upload"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 1,\n \"chunkSize\": 1050,\n \"chunkOverlap\": 500\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.anam.ai/v1/knowledge/groups/{id}/documents/presigned-upload")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 1,\n \"chunkSize\": 1050,\n \"chunkOverlap\": 500\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anam.ai/v1/knowledge/groups/{id}/documents/presigned-upload")
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 \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 1,\n \"chunkSize\": 1050,\n \"chunkOverlap\": 500\n}"
response = http.request(request)
puts response.read_body{
"uploadUrl": "<string>",
"documentId": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>",
"message": "<string>"
}presigned upload knowledge group
Start a direct upload of a document to a knowledge folder, for files too large for the multipart POST /v1/knowledge/groups/{id}/documents (whose request body is limited to about 4.5MB). Flow: (1) call this endpoint with the file’s name, type and size to get an uploadUrl and a documentId; (2) PUT the file’s bytes to uploadUrl with the same Content-Type; (3) call POST /v1/knowledge/documents/{id}/confirm-upload with the documentId to measure the file and start processing. The document stays UPLOADED until then. Supports PDF, DOC, DOCX, CSV, MD, TXT, LOG and JSON files up to 50MB, chosen by the filename extension; any other type is refused. The declared fileSize is checked against the 50MB limit and the organization’s monthly knowledge upload quota here, and counts towards the quota until confirmation records the measured size. Requires an API key with knowledge write access.
curl --request POST \
--url https://api.anam.ai/v1/knowledge/groups/{id}/documents/presigned-upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"contentType": "<string>",
"fileSize": 1,
"chunkSize": 1050,
"chunkOverlap": 500
}
'import requests
url = "https://api.anam.ai/v1/knowledge/groups/{id}/documents/presigned-upload"
payload = {
"filename": "<string>",
"contentType": "<string>",
"fileSize": 1,
"chunkSize": 1050,
"chunkOverlap": 500
}
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({
filename: '<string>',
contentType: '<string>',
fileSize: 1,
chunkSize: 1050,
chunkOverlap: 500
})
};
fetch('https://api.anam.ai/v1/knowledge/groups/{id}/documents/presigned-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://api.anam.ai/v1/knowledge/groups/{id}/documents/presigned-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 => json_encode([
'filename' => '<string>',
'contentType' => '<string>',
'fileSize' => 1,
'chunkSize' => 1050,
'chunkOverlap' => 500
]),
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.anam.ai/v1/knowledge/groups/{id}/documents/presigned-upload"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 1,\n \"chunkSize\": 1050,\n \"chunkOverlap\": 500\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.anam.ai/v1/knowledge/groups/{id}/documents/presigned-upload")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 1,\n \"chunkSize\": 1050,\n \"chunkOverlap\": 500\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anam.ai/v1/knowledge/groups/{id}/documents/presigned-upload")
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 \"filename\": \"<string>\",\n \"contentType\": \"<string>\",\n \"fileSize\": 1,\n \"chunkSize\": 1050,\n \"chunkOverlap\": 500\n}"
response = http.request(request)
puts response.read_body{
"uploadUrl": "<string>",
"documentId": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>",
"message": "<string>"
}
