curl --request POST \
--url https://api.anam.ai/v1/knowledge/groups/{id}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form chunkSize=1050 \
--form chunkOverlap=500import requests
url = "https://api.anam.ai/v1/knowledge/groups/{id}/documents"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"chunkSize": "1050",
"chunkOverlap": "500"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('chunkSize', '1050');
form.append('chunkOverlap', '500');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.anam.ai/v1/knowledge/groups/{id}/documents', 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",
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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkSize\"\r\n\r\n1050\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkOverlap\"\r\n\r\n500\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://api.anam.ai/v1/knowledge/groups/{id}/documents"
payload := strings.NewReader("-----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=\"chunkSize\"\r\n\r\n1050\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkOverlap\"\r\n\r\n500\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://api.anam.ai/v1/knowledge/groups/{id}/documents")
.header("Authorization", "Bearer <token>")
.body("-----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=\"chunkSize\"\r\n\r\n1050\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkOverlap\"\r\n\r\n500\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anam.ai/v1/knowledge/groups/{id}/documents")
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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkSize\"\r\n\r\n1050\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkOverlap\"\r\n\r\n500\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "00000000-0000-0000-0000-000000000000",
"knowledgeFolderId": "00000000-0000-0000-0000-000000000000",
"filename": "getting-started.pdf",
"fileType": "application/pdf",
"fileSize": 248320,
"fileUrl": "https://cdn.anam.ai/knowledge/getting-started.pdf",
"status": "READY",
"errorMessage": null,
"chunkSize": null,
"chunkOverlap": null,
"appliedChunking": {
"strategy": "paragraph",
"chunkSize": 800,
"chunkOverlap": 100,
"source": "folder",
"appliedAt": "2026-04-20T10:01:12.000Z"
},
"createdAt": "2026-04-20T10:00:00.000Z",
"updatedAt": "2026-04-20T10:01:12.000Z"
}upload knowledge group document
Upload a document to a RAG group (Supports PDF, TXT, MD, DOCX, CSV, JSON up to 50MB). Authentication can be via API key (Bearer token) OR upload token (X-Upload-Token header).
curl --request POST \
--url https://api.anam.ai/v1/knowledge/groups/{id}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form chunkSize=1050 \
--form chunkOverlap=500import requests
url = "https://api.anam.ai/v1/knowledge/groups/{id}/documents"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"chunkSize": "1050",
"chunkOverlap": "500"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('chunkSize', '1050');
form.append('chunkOverlap', '500');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.anam.ai/v1/knowledge/groups/{id}/documents', 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",
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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkSize\"\r\n\r\n1050\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkOverlap\"\r\n\r\n500\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://api.anam.ai/v1/knowledge/groups/{id}/documents"
payload := strings.NewReader("-----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=\"chunkSize\"\r\n\r\n1050\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkOverlap\"\r\n\r\n500\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://api.anam.ai/v1/knowledge/groups/{id}/documents")
.header("Authorization", "Bearer <token>")
.body("-----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=\"chunkSize\"\r\n\r\n1050\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkOverlap\"\r\n\r\n500\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anam.ai/v1/knowledge/groups/{id}/documents")
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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkSize\"\r\n\r\n1050\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"chunkOverlap\"\r\n\r\n500\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "00000000-0000-0000-0000-000000000000",
"knowledgeFolderId": "00000000-0000-0000-0000-000000000000",
"filename": "getting-started.pdf",
"fileType": "application/pdf",
"fileSize": 248320,
"fileUrl": "https://cdn.anam.ai/knowledge/getting-started.pdf",
"status": "READY",
"errorMessage": null,
"chunkSize": null,
"chunkOverlap": null,
"appliedChunking": {
"strategy": "paragraph",
"chunkSize": 800,
"chunkOverlap": 100,
"source": "folder",
"appliedAt": "2026-04-20T10:01:12.000Z"
},
"createdAt": "2026-04-20T10:00:00.000Z",
"updatedAt": "2026-04-20T10:01:12.000Z"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier of the knowledge group
Body
Document file to upload into the knowledge group. Supported formats are PDF, TXT, MD, DOCX, CSV, and JSON, up to 50MB. Must be sent as multipart/form-data. Documents are processed asynchronously — the returned record starts in PROCESSING state and becomes searchable once it reaches READY.
Document file (PDF, TXT, MD, DOCX, CSV, or JSON, max 50MB).
Maximum tokens per chunk for this document. Defaults to the group's chunkSize, or the default of 350 when the group has none. Setting chunkSize or chunkOverlap overrides the group's settings for this document. JSON files ignore chunk settings; they are kept whole up to 2000 tokens, and larger files are split at 1000 tokens with 50 overlap.
100 <= x <= 2000Token overlap between chunks for this document. Must be at most half of chunkSize, or at most 175 when chunkSize is not set. Defaults to the group's chunkOverlap, or the default of 0 when the group has none. If you set only chunkSize, overlap is the default of 0 rather than the group's value.
0 <= x <= 1000Response
Successfully uploaded document
A single file uploaded into a knowledge group. Retrieved chunks reference it by ID.
Unique identifier for the document.
ID of the knowledge group this document belongs to.
Original filename as uploaded.
MIME type or extension-derived file type.
Size of the file in bytes.
Internal URL at which the file is stored.
Current processing state. Only READY documents are searchable.
UPLOADED, PROCESSING, READY, FAILED Failure reason when status is FAILED, otherwise null.
Chunk size override set at upload, in tokens; null when not overridden. When both chunkSize and chunkOverlap are null, the document uses its group's settings. When only chunkOverlap is set, a null chunkSize means the default of 350.
Chunk overlap override set at upload, in tokens; null when not overridden. When both chunkSize and chunkOverlap are null, the document uses its group's settings. When only chunkSize is set, a null chunkOverlap means the default of 0.
Settings the last successful processing used. Null until the document has been processed.
Show child attributes
Show child attributes
Timestamp when the document was uploaded.
Timestamp when the document record was last updated.
Was this page helpful?

