Files
Upload through a link
For a slow or unreliable connection: reserve a slot, upload the file to its link (resumable), then confirm it.
POST
/
knowledge-base
/
{id}
/
files
Upload through a link
curl --request POST \
--url https://api.verbeo.ai/v1/knowledge-base/{id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_name": "<string>",
"file_size": 123,
"content_hash": "<string>"
}
'import requests
url = "https://api.verbeo.ai/v1/knowledge-base/{id}/files"
payload = {
"file_name": "<string>",
"file_size": 123,
"content_hash": "<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_name: '<string>', file_size: 123, content_hash: '<string>'})
};
fetch('https://api.verbeo.ai/v1/knowledge-base/{id}/files', 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.verbeo.ai/v1/knowledge-base/{id}/files",
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_name' => '<string>',
'file_size' => 123,
'content_hash' => '<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.verbeo.ai/v1/knowledge-base/{id}/files"
payload := strings.NewReader("{\n \"file_name\": \"<string>\",\n \"file_size\": 123,\n \"content_hash\": \"<string>\"\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.verbeo.ai/v1/knowledge-base/{id}/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"file_name\": \"<string>\",\n \"file_size\": 123,\n \"content_hash\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.verbeo.ai/v1/knowledge-base/{id}/files")
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_name\": \"<string>\",\n \"file_size\": 123,\n \"content_hash\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyUpload files sends files in one request, which is what most integrations want. On a slow or unreliable connection, upload through a link instead, the way the dashboard does: the file goes straight to Verbeo’s file storage, in pieces that carry on where they stopped if the connection drops. It takes three steps:
For a resumable upload, use a TUS client such as
- Reserve a slot: this endpoint, with JSON. Your plan’s limits are checked here.
- Upload the file to the slot’s link, within 2 hours.
- Confirm it: Verbeo checks the file it received and starts reading it.
1. Reserve a slot
Its SHA-256, as 64 lowercase hex characters.
sha256sum prices.pdf prints it. A file with the same bytes as one already in the knowledge base is refused here.curl -X POST "https://api.verbeo.ai/v1/knowledge-base/5df09066-0842-4c92-8ef0-6cf2ff6d7455/files" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{ \"file_name\": \"prices.pdf\", \"file_size\": $(wc -c < prices.pdf), \"content_hash\": \"$(sha256sum prices.pdf | cut -d' ' -f1)\" }"
201 Created: the slot, a file object with status: "uploading", and where to send the file.
{
"success": true,
"data": {
"file": {
"id": "c4ff0c9c-4b3b-4a94-a86e-3d3b64088ae0",
"status": "uploading",
"upload_expires_at": "2026-11-07T11:12:44.833957+00:00",
"…": "every field of the file object"
},
"upload": {
"signed_url": "https://…/storage/v1/object/upload/sign/kb/5df09066-…/c4ff0c9c-…/prices.pdf?token=eyJhbGciOi…",
"path": "5df09066-…/c4ff0c9c-…/prices.pdf",
"token": "eyJhbGciOi…",
"content_type": "application/pdf",
"bucket": "kb",
"resumable_url": "https://…/storage/v1/upload/resumable/sign"
}
}
}
2. Upload the file
Send the whole file with onePUT to upload.signed_url, with upload.content_type:
curl -X PUT "UPLOAD_SIGNED_URL" \
-H "Content-Type: application/pdf" \
--data-binary @prices.pdf
tus-js-client with upload.resumable_url as its endpoint, pieces of 6 MB, the header x-signature set to upload.token, and the metadata bucketName, objectName and contentType set to upload.bucket, upload.path and upload.content_type.
The link goes to Verbeo’s file storage, not to api.verbeo.ai: the token is the credential, so no API key goes with it. It works for 2 hours.
3. Confirm it
curl -X POST "https://api.verbeo.ai/v1/knowledge-base/files/c4ff0c9c-4b3b-4a94-a86e-3d3b64088ae0/confirm" \
-H "Authorization: Bearer YOUR_API_KEY"
200 OK with the file object, now processing. Verbeo checks the size and SHA-256 of the file it received against your plan again; a refused file is removed, slot and all. Confirming twice is harmless.
To give up on a slot, delete it. An unconfirmed slot is removed on its own once its link expires.
The same JSON body on POST /knowledge-base/files/{fileId}/replace reserves a replacement the same way.
Errors
| Code | Status | When |
|---|---|---|
VALIDATION_FAILED | 422 | file_name, file_size or content_hash missing or malformed (content_hash: must be the file's SHA-256 as 64 lowercase hex characters), or a type that is not taken. |
KB_* | 409 | The reserve or the confirm was refused by your plan’s limits. |
KB_UPLOAD_EXPIRED | 409 | This upload took longer than 2 hours and has expired. Upload the file again. |
KB_UPLOAD_CLOSED | 409 | This upload is no longer open. Upload the file again. |
CONFLICT | 409 | The file did not finish uploading. Upload it again. The confirm found no file. |
BAD_GATEWAY | 502 | The file could not be read from storage just now. Try again in a moment. Nothing was removed. |
INTERNAL_ERROR | 500 | The upload could not be started. Try again in a moment. No slot was kept. |
Was this page helpful?
⌘I
Upload through a link
curl --request POST \
--url https://api.verbeo.ai/v1/knowledge-base/{id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"file_name": "<string>",
"file_size": 123,
"content_hash": "<string>"
}
'import requests
url = "https://api.verbeo.ai/v1/knowledge-base/{id}/files"
payload = {
"file_name": "<string>",
"file_size": 123,
"content_hash": "<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_name: '<string>', file_size: 123, content_hash: '<string>'})
};
fetch('https://api.verbeo.ai/v1/knowledge-base/{id}/files', 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.verbeo.ai/v1/knowledge-base/{id}/files",
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_name' => '<string>',
'file_size' => 123,
'content_hash' => '<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.verbeo.ai/v1/knowledge-base/{id}/files"
payload := strings.NewReader("{\n \"file_name\": \"<string>\",\n \"file_size\": 123,\n \"content_hash\": \"<string>\"\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.verbeo.ai/v1/knowledge-base/{id}/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"file_name\": \"<string>\",\n \"file_size\": 123,\n \"content_hash\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.verbeo.ai/v1/knowledge-base/{id}/files")
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_name\": \"<string>\",\n \"file_size\": 123,\n \"content_hash\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body