Manage the Knowledge Base
Push documents, pages and text from your own systems, follow their indexing, and take them back out when they change.
Before you start
- A key with the
ingestscope. Create one in the dashboard under API Keys. The widget key cannot write: without the scope every endpoint here answers403. Keep this key on your server. - Indexing runs in the background. Each upload returns
202with ajobIdstraight away; the content becomes answerable once the job completes. Follow it with the job endpoint below. - The plan's document allowance applies. It is counted across all sites of the
account. Once it is reached, uploads answer
429withcurrentUsageandmaxAllowed; remove documents or change the plan.
Add text
/v1/ingest/textBody: text (required, up to 500,000 characters) and sourceUrl. The
sourceUrl names the document: sending the same sourceUrl again updates that
document, a different one adds another. Visitors see it as the source link of answers built from
this text, so it must be an absolute http or https address, up to 2,000
characters. Text that has not changed since the last upload is not indexed again.
Always send sourceUrl. Without it, every text of the site goes into
one shared document and each upload replaces the text of the previous one.
cURL
curl -X POST https://api.slatech.ai/v1/ingest/text \
-H "X-Api-Key: $SLATECH_INGEST_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Returns are accepted within 30 days with the original receipt.",
"sourceUrl": "https://example.com/returns/"
}'
# 202: {"jobId": "...", "status": 0}
JavaScript
const res = await fetch("https://api.slatech.ai/v1/ingest/text", {
method: "POST",
headers: {
"X-Api-Key": process.env.SLATECH_INGEST_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
text: "Returns are accepted within 30 days with the original receipt.",
sourceUrl: "https://example.com/returns/",
}),
});
if (res.status !== 202) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
const { jobId } = await res.json();
Python
import os
import requests
resp = requests.post(
"https://api.slatech.ai/v1/ingest/text",
headers={"X-Api-Key": os.environ["SLATECH_INGEST_KEY"]},
json={
"text": "Returns are accepted within 30 days with the original receipt.",
"sourceUrl": "https://example.com/returns/",
},
timeout=30,
)
resp.raise_for_status()
job_id = resp.json()["jobId"]
C#
using System.Net.Http.Json;
using System.Text.Json;
using var http = new HttpClient { BaseAddress = new Uri("https://api.slatech.ai/") };
http.DefaultRequestHeaders.Add("X-Api-Key", Environment.GetEnvironmentVariable("SLATECH_INGEST_KEY"));
var resp = await http.PostAsJsonAsync("v1/ingest/text", new
{
text = "Returns are accepted within 30 days with the original receipt.",
sourceUrl = "https://example.com/returns/",
});
resp.EnsureSuccessStatusCode();
var jobId = (await resp.Content.ReadFromJsonAsync<JsonElement>()).GetProperty("jobId").GetGuid();
Upload a file
/v1/ingest/fileA multipart/form-data request with the file in a part named file.
Accepted: PDF, DOCX, TXT and MD, recognised by the file extension, up to 10 MB. Other types get
400, a larger file gets 413. The response is
{"jobId", "fileId", "status": "Pending"}.
cURL
curl -X POST https://api.slatech.ai/v1/ingest/file \
-H "X-Api-Key: $SLATECH_INGEST_KEY" \
-F "file=@price-list.pdf"
# 202: {"jobId": "...", "fileId": "...", "status": "Pending"}
JavaScript
import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("file", new Blob([await readFile("price-list.pdf")], { type: "application/pdf" }), "price-list.pdf");
const res = await fetch("https://api.slatech.ai/v1/ingest/file", {
method: "POST",
headers: { "X-Api-Key": process.env.SLATECH_INGEST_KEY },
body: form,
});
const { jobId, fileId } = await res.json();
Python
import os
import requests
with open("price-list.pdf", "rb") as f:
resp = requests.post(
"https://api.slatech.ai/v1/ingest/file",
headers={"X-Api-Key": os.environ["SLATECH_INGEST_KEY"]},
files={"file": ("price-list.pdf", f, "application/pdf")},
timeout=120,
)
resp.raise_for_status()
job_id = resp.json()["jobId"]
C#
using System.Net.Http.Headers;
using var http = new HttpClient { BaseAddress = new Uri("https://api.slatech.ai/") };
http.DefaultRequestHeaders.Add("X-Api-Key", Environment.GetEnvironmentVariable("SLATECH_INGEST_KEY"));
using var form = new MultipartFormDataContent();
var file = new ByteArrayContent(await File.ReadAllBytesAsync("price-list.pdf"));
file.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
form.Add(file, "file", "price-list.pdf");
var resp = await http.PostAsync("v1/ingest/file", form);
resp.EnsureSuccessStatusCode();
Index a page or a whole sitemap
/v1/ingest/url/v1/ingest/sitemap{"url": "..."} fetches and indexes one page; {"sitemapUrl": "..."}
indexes every page an XML sitemap lists. Only public http and https
addresses are accepted; private and internal addresses are refused with 400.
cURL
# One page
curl -X POST https://api.slatech.ai/v1/ingest/url \
-H "X-Api-Key: $SLATECH_INGEST_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/pricing/"}'
# Every page a sitemap lists
curl -X POST https://api.slatech.ai/v1/ingest/sitemap \
-H "X-Api-Key: $SLATECH_INGEST_KEY" \
-H "Content-Type: application/json" \
-d '{"sitemapUrl": "https://example.com/sitemap.xml"}'
Follow the job
/v1/ingest/jobs/{jobId}Returns jobId, status, createdAt, startedAt,
completedAt, errorCode, errorMessage and
retryCount. Times are UTC. A job of another site answers 404.
status | Meaning |
|---|---|
0 | Pending: waiting to be picked up |
1 | Processing |
2 | Completed: the content is answerable |
3 | Failed: see errorCode and errorMessage |
4 | Cancelled |
The status is a number here and in the responses of the text, page and sitemap uploads; only the
file upload answers with the word "Pending". When a job fails, errorCode is
one of page_empty, url_http_error, timeout,
url_unreachable, url_not_allowed, no_content or
internal_error, and errorMessage is a sentence you can show.
cURL
curl https://api.slatech.ai/v1/ingest/jobs/3e9a7c2d-51f4-4b8a-a0e6-9d2c7b1f4e38 \
-H "X-Api-Key: $SLATECH_INGEST_KEY"
Python
import os
import time
import requests
def wait_for_job(job_id, timeout_s=600):
url = f"https://api.slatech.ai/v1/ingest/jobs/{job_id}"
headers = {"X-Api-Key": os.environ["SLATECH_INGEST_KEY"]}
deadline = time.time() + timeout_s
while time.time() < deadline:
job = requests.get(url, headers=headers, timeout=30).json()
if job["status"] == 2: # Completed
return job
if job["status"] in (3, 4): # Failed, Cancelled
raise RuntimeError(f'{job["errorCode"]}: {job["errorMessage"]}')
time.sleep(5)
raise TimeoutError(job_id)
JSON
{
"jobId": "3e9a7c2d-51f4-4b8a-a0e6-9d2c7b1f4e38",
"status": 3,
"createdAt": "2026-12-04T09:12:40.517",
"startedAt": "2026-12-04T09:12:44.102",
"completedAt": "2026-12-04T09:12:51.88",
"errorCode": "url_http_error",
"errorMessage": "The page answered with HTTP 404.",
"retryCount": 0
}
Delete content
/v1/ingest/document/v1/documents/{documentId}DELETE /v1/ingest/document?sourceUrl=... deletes the site's document stored under
that address, for example one you wrote with a text upload, and withdraws text uploads for it that
are still waiting. It answers 200 with {"deleted": n}, including
0 when there was nothing to delete, so a sync can safely repeat it.
DELETE /v1/documents/{documentId} deletes one document by id: 204 on
success, 404 when the document does not belong to the key's site. The upload endpoints
do not return document ids, so for content you push yourself, delete by sourceUrl.
cURL
# The document a text job filed under this sourceUrl
curl -X DELETE "https://api.slatech.ai/v1/ingest/document?sourceUrl=https%3A%2F%2Fexample.com%2Freturns%2F" \
-H "X-Api-Key: $SLATECH_INGEST_KEY"
# 200: {"deleted": 1} (0 when there was nothing to delete)
# A document by id
curl -X DELETE https://api.slatech.ai/v1/documents/9b4e2a17-6c3d-4f0e-8a51-7e2d9c6b3f10 \
-H "X-Api-Key: $SLATECH_INGEST_KEY"
# 204 on success, 404 if the document is not this site's
Related
- Train your assistant from the dashboard, without code
- MCP server:
add_knowledge,ingest_urlandingest_sitemapfor AI agents - Ask questions against what you indexed
- Client libraries: these calls from JavaScript/TypeScript and Python
- API reference