Ingest Jobs
Create an ingest job
Create an ingest job for the authenticated organization. You can control how documents are parsed and chunked using the optional config object (for example, chunk size, overlap, language, and advanced OCR/LLM options).
POST
/
v1
/
namespace
/
{namespaceId}
/
ingest-jobs
TypeScript
import { Agentset } from "agentset";
const agentset = new Agentset({ apiKey: 'agentset_xxx' });
const ns = agentset.namespace('ns_xxx');
const job = await ns.ingestion.create({
payload: {
type: "TEXT",
text: "This is some content to ingest into the knowledge base.",
},
config: {
metadata: {
foo: "bar",
},
chunkSize: 2048,
},
});
console.log(job);from agentset import Agentset
with Agentset(
namespace_id="ns_123",
x_tenant_id="<id>",
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.ingest_jobs.create(payload={
"type": "TEXT",
"text": "<value>",
})
# Handle response
print(res)curl --request POST \
--url https://api.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payload": {
"type": "<string>",
"text": "<string>",
"fileName": "<string>"
},
"name": "<string>",
"config": {
"chunkSize": 4503599627370512,
"delimiter": "<string>",
"metadata": {},
"disableImageExtraction": true,
"disableImageCaptions": true,
"chartUnderstanding": true,
"keepPageheaderInOutput": true,
"keepPagefooterInOutput": true,
"forceOcr": true,
"disableOcrMath": true,
"useLlm": true,
"chunkOverlap": 123,
"maxChunkSize": 123
},
"externalId": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
payload: {type: '<string>', text: '<string>', fileName: '<string>'},
name: '<string>',
config: {
chunkSize: 4503599627370512,
delimiter: '<string>',
metadata: {},
disableImageExtraction: true,
disableImageCaptions: true,
chartUnderstanding: true,
keepPageheaderInOutput: true,
keepPagefooterInOutput: true,
forceOcr: true,
disableOcrMath: true,
useLlm: true,
chunkOverlap: 123,
maxChunkSize: 123
},
externalId: '<string>'
})
};
fetch('https://api.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs', 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.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs",
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([
'payload' => [
'type' => '<string>',
'text' => '<string>',
'fileName' => '<string>'
],
'name' => '<string>',
'config' => [
'chunkSize' => 4503599627370512,
'delimiter' => '<string>',
'metadata' => [
],
'disableImageExtraction' => true,
'disableImageCaptions' => true,
'chartUnderstanding' => true,
'keepPageheaderInOutput' => true,
'keepPagefooterInOutput' => true,
'forceOcr' => true,
'disableOcrMath' => true,
'useLlm' => true,
'chunkOverlap' => 123,
'maxChunkSize' => 123
],
'externalId' => '<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.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs"
payload := strings.NewReader("{\n \"payload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"fileName\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"config\": {\n \"chunkSize\": 4503599627370512,\n \"delimiter\": \"<string>\",\n \"metadata\": {},\n \"disableImageExtraction\": true,\n \"disableImageCaptions\": true,\n \"chartUnderstanding\": true,\n \"keepPageheaderInOutput\": true,\n \"keepPagefooterInOutput\": true,\n \"forceOcr\": true,\n \"disableOcrMath\": true,\n \"useLlm\": true,\n \"chunkOverlap\": 123,\n \"maxChunkSize\": 123\n },\n \"externalId\": \"<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.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"fileName\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"config\": {\n \"chunkSize\": 4503599627370512,\n \"delimiter\": \"<string>\",\n \"metadata\": {},\n \"disableImageExtraction\": true,\n \"disableImageCaptions\": true,\n \"chartUnderstanding\": true,\n \"keepPageheaderInOutput\": true,\n \"keepPagefooterInOutput\": true,\n \"forceOcr\": true,\n \"disableOcrMath\": true,\n \"useLlm\": true,\n \"chunkOverlap\": 123,\n \"maxChunkSize\": 123\n },\n \"externalId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs")
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 \"payload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"fileName\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"config\": {\n \"chunkSize\": 4503599627370512,\n \"delimiter\": \"<string>\",\n \"metadata\": {},\n \"disableImageExtraction\": true,\n \"disableImageCaptions\": true,\n \"chartUnderstanding\": true,\n \"keepPageheaderInOutput\": true,\n \"keepPagefooterInOutput\": true,\n \"forceOcr\": true,\n \"disableOcrMath\": true,\n \"useLlm\": true,\n \"chunkOverlap\": 123,\n \"maxChunkSize\": 123\n },\n \"externalId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"namespaceId": "<string>",
"tenantId": "<string>",
"externalId": "<string>",
"error": "<string>",
"payload": {
"type": "<string>",
"text": "<string>",
"fileName": "<string>"
},
"config": {
"chunkSize": 4503599627370512,
"delimiter": "<string>",
"metadata": {},
"disableImageExtraction": true,
"disableImageCaptions": true,
"chartUnderstanding": true,
"keepPageheaderInOutput": true,
"keepPagefooterInOutput": true,
"forceOcr": true,
"disableOcrMath": true,
"useLlm": true,
"chunkOverlap": 123,
"maxChunkSize": 123
},
"createdAt": "<string>",
"queuedAt": "<string>",
"preProcessingAt": "<string>",
"processingAt": "<string>",
"completedAt": "<string>",
"failedAt": "<string>",
"name": "<string>"
}
}{
"success": false,
"error": {
"code": "bad_request",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#bad-request"
}
}{
"success": false,
"error": {
"code": "unauthorized",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#unauthorized"
}
}{
"success": false,
"error": {
"code": "forbidden",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#forbidden"
}
}{
"success": false,
"error": {
"code": "not_found",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#not-found"
}
}{
"success": false,
"error": {
"code": "conflict",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#conflict"
}
}{
"success": false,
"error": {
"code": "invite_expired",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#invite-expired"
}
}{
"success": false,
"error": {
"code": "unprocessable_entity",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#unprocessable-entity"
}
}{
"success": false,
"error": {
"code": "rate_limit_exceeded",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#rate-limit_exceeded"
}
}{
"success": false,
"error": {
"code": "internal_server_error",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#internal-server_error"
}
}Authorizations
Default authentication mechanism
Headers
Optional tenant id to use for the request. If not provided, the namespace will be used directly. Must be alphanumeric and up to 64 characters.
Pattern:
^[A-Za-z0-9]{1,64}$Path Parameters
The id of the namespace (prefixed with ns_)
Example:
"ns_123"
Body
application/json
The ingest job payload for creation.
- Text Payload
- URL Payload
- Managed File Payload
- Crawl Payload
- Youtube Payload
- Batch Payload Input
Show child attributes
Show child attributes
The name of the ingest job.
The ingest job config.
Show child attributes
Show child attributes
A unique external ID of the ingest job. You can use this to identify the ingest job in your system.
⌘I
TypeScript
import { Agentset } from "agentset";
const agentset = new Agentset({ apiKey: 'agentset_xxx' });
const ns = agentset.namespace('ns_xxx');
const job = await ns.ingestion.create({
payload: {
type: "TEXT",
text: "This is some content to ingest into the knowledge base.",
},
config: {
metadata: {
foo: "bar",
},
chunkSize: 2048,
},
});
console.log(job);from agentset import Agentset
with Agentset(
namespace_id="ns_123",
x_tenant_id="<id>",
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.ingest_jobs.create(payload={
"type": "TEXT",
"text": "<value>",
})
# Handle response
print(res)curl --request POST \
--url https://api.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payload": {
"type": "<string>",
"text": "<string>",
"fileName": "<string>"
},
"name": "<string>",
"config": {
"chunkSize": 4503599627370512,
"delimiter": "<string>",
"metadata": {},
"disableImageExtraction": true,
"disableImageCaptions": true,
"chartUnderstanding": true,
"keepPageheaderInOutput": true,
"keepPagefooterInOutput": true,
"forceOcr": true,
"disableOcrMath": true,
"useLlm": true,
"chunkOverlap": 123,
"maxChunkSize": 123
},
"externalId": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
payload: {type: '<string>', text: '<string>', fileName: '<string>'},
name: '<string>',
config: {
chunkSize: 4503599627370512,
delimiter: '<string>',
metadata: {},
disableImageExtraction: true,
disableImageCaptions: true,
chartUnderstanding: true,
keepPageheaderInOutput: true,
keepPagefooterInOutput: true,
forceOcr: true,
disableOcrMath: true,
useLlm: true,
chunkOverlap: 123,
maxChunkSize: 123
},
externalId: '<string>'
})
};
fetch('https://api.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs', 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.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs",
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([
'payload' => [
'type' => '<string>',
'text' => '<string>',
'fileName' => '<string>'
],
'name' => '<string>',
'config' => [
'chunkSize' => 4503599627370512,
'delimiter' => '<string>',
'metadata' => [
],
'disableImageExtraction' => true,
'disableImageCaptions' => true,
'chartUnderstanding' => true,
'keepPageheaderInOutput' => true,
'keepPagefooterInOutput' => true,
'forceOcr' => true,
'disableOcrMath' => true,
'useLlm' => true,
'chunkOverlap' => 123,
'maxChunkSize' => 123
],
'externalId' => '<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.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs"
payload := strings.NewReader("{\n \"payload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"fileName\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"config\": {\n \"chunkSize\": 4503599627370512,\n \"delimiter\": \"<string>\",\n \"metadata\": {},\n \"disableImageExtraction\": true,\n \"disableImageCaptions\": true,\n \"chartUnderstanding\": true,\n \"keepPageheaderInOutput\": true,\n \"keepPagefooterInOutput\": true,\n \"forceOcr\": true,\n \"disableOcrMath\": true,\n \"useLlm\": true,\n \"chunkOverlap\": 123,\n \"maxChunkSize\": 123\n },\n \"externalId\": \"<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.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"fileName\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"config\": {\n \"chunkSize\": 4503599627370512,\n \"delimiter\": \"<string>\",\n \"metadata\": {},\n \"disableImageExtraction\": true,\n \"disableImageCaptions\": true,\n \"chartUnderstanding\": true,\n \"keepPageheaderInOutput\": true,\n \"keepPagefooterInOutput\": true,\n \"forceOcr\": true,\n \"disableOcrMath\": true,\n \"useLlm\": true,\n \"chunkOverlap\": 123,\n \"maxChunkSize\": 123\n },\n \"externalId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agentset.ai/v1/namespace/{namespaceId}/ingest-jobs")
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 \"payload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\",\n \"fileName\": \"<string>\"\n },\n \"name\": \"<string>\",\n \"config\": {\n \"chunkSize\": 4503599627370512,\n \"delimiter\": \"<string>\",\n \"metadata\": {},\n \"disableImageExtraction\": true,\n \"disableImageCaptions\": true,\n \"chartUnderstanding\": true,\n \"keepPageheaderInOutput\": true,\n \"keepPagefooterInOutput\": true,\n \"forceOcr\": true,\n \"disableOcrMath\": true,\n \"useLlm\": true,\n \"chunkOverlap\": 123,\n \"maxChunkSize\": 123\n },\n \"externalId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"namespaceId": "<string>",
"tenantId": "<string>",
"externalId": "<string>",
"error": "<string>",
"payload": {
"type": "<string>",
"text": "<string>",
"fileName": "<string>"
},
"config": {
"chunkSize": 4503599627370512,
"delimiter": "<string>",
"metadata": {},
"disableImageExtraction": true,
"disableImageCaptions": true,
"chartUnderstanding": true,
"keepPageheaderInOutput": true,
"keepPagefooterInOutput": true,
"forceOcr": true,
"disableOcrMath": true,
"useLlm": true,
"chunkOverlap": 123,
"maxChunkSize": 123
},
"createdAt": "<string>",
"queuedAt": "<string>",
"preProcessingAt": "<string>",
"processingAt": "<string>",
"completedAt": "<string>",
"failedAt": "<string>",
"name": "<string>"
}
}{
"success": false,
"error": {
"code": "bad_request",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#bad-request"
}
}{
"success": false,
"error": {
"code": "unauthorized",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#unauthorized"
}
}{
"success": false,
"error": {
"code": "forbidden",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#forbidden"
}
}{
"success": false,
"error": {
"code": "not_found",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#not-found"
}
}{
"success": false,
"error": {
"code": "conflict",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#conflict"
}
}{
"success": false,
"error": {
"code": "invite_expired",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#invite-expired"
}
}{
"success": false,
"error": {
"code": "unprocessable_entity",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#unprocessable-entity"
}
}{
"success": false,
"error": {
"code": "rate_limit_exceeded",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#rate-limit_exceeded"
}
}{
"success": false,
"error": {
"code": "internal_server_error",
"message": "The requested resource was not found.",
"doc_url": "https://docs.agentset.ai/api-reference/errors#internal-server_error"
}
}