JavaScript
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({corpora_name: '<string>', description: '<string>', is_published: true})
};
fetch('https://api.example.com/api/corpora/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.example.com/api/corpora/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"corpora_name": "<string>",
"description": "<string>",
"is_published": true
}
'import requests
url = "https://api.example.com/api/corpora/"
payload = {
"corpora_name": "<string>",
"description": "<string>",
"is_published": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://api.example.com/api/corpora/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"corpora_name\": \"<string>\",\n \"description\": \"<string>\",\n \"is_published\": true\n}")
.asString();{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"corpora_name": "<string>",
"size_on_disk": 123,
"index_location": "<string>",
"creator": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"is_published": true,
"index_type": "VSI",
"indexing_status": "PND"
}Corpus Management
Create Corpus
Provision a new knowledge base that resources can be ingested into.
POST
/
api
/
corpora
/
JavaScript
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({corpora_name: '<string>', description: '<string>', is_published: true})
};
fetch('https://api.example.com/api/corpora/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.example.com/api/corpora/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"corpora_name": "<string>",
"description": "<string>",
"is_published": true
}
'import requests
url = "https://api.example.com/api/corpora/"
payload = {
"corpora_name": "<string>",
"description": "<string>",
"is_published": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.post("https://api.example.com/api/corpora/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"corpora_name\": \"<string>\",\n \"description\": \"<string>\",\n \"is_published\": true\n}")
.asString();{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"corpora_name": "<string>",
"size_on_disk": 123,
"index_location": "<string>",
"creator": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"is_published": true,
"index_type": "VSI",
"indexing_status": "PND"
}Overview
Create a corpus before uploading any resources. Every corpus belongs to the authenticated user and encapsulates indexing configuration (vector index type, publication flag, etc.). Back-end logic normalizes the name into lowercase snake_case and enforces uniqueness per user.Prerequisite: You must be authenticated with a valid JWT token or session cookie.
Request Body
string
required
Human-friendly name for your corpus. The system automatically converts it to lowercase with underscores (e.g., “Support Playbooks” becomes “support_playbooks”). Must be unique for your user account.
string
Optional context about what content lives in this corpus. Helps you and your team understand the corpus purpose.
boolean
default:"false"
Controls whether the corpus is discoverable via public listings. Set to
true for shared knowledge bases.string
default:"VSI"
Indexing strategy for the corpus. Available options:
VSI- Vector Store Index (recommended for semantic search)SMI- Summary IndexDSI- Document Summary Index
string
System-managed field that tracks indexing progress. Leave empty - Soar Labs automatically updates this as ingestion jobs complete.Status values:
PND- Pending (newly created)PRS- Processing (ingestion in progress)IND- Indexed (ready for queries)ERR- Error (ingestion failed)
Example request
curl -X POST https://{your-host}/api/corpora/ \
-H "Authorization: Bearer $SOAR_LABS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"corpora_name": "Support Playbooks",
"description": "Runbooks feeding LlamaIndex",
"is_published": false,
"index_type": "VSI"
}'
Response
UUID
Unique identifier for the corpus. Use this ID in all subsequent operations (uploading resources, querying, etc.).
timestamp
ISO 8601 timestamp when the corpus was created.
timestamp
ISO 8601 timestamp of the last update to corpus metadata.
string
Normalized corpus name in lowercase snake_case format.
string
User-provided description of the corpus content and purpose.
float
Total storage size in bytes. Initially
0.0 for new corpora, updates as resources are ingested.string | null
Storage location of the vector index (e.g.,
"qdrant_free_collection"). null until first resource is indexed.boolean
Whether the corpus is publicly discoverable.
string
The indexing strategy:
VSI (Vector Store), SMI (Summary), or DSI (Document Summary).string
Current indexing status:
PND (Pending), PRS (Processing), IND (Indexed), or ERR (Error).UUID
User ID of the corpus creator. Read-only field for ownership tracking.
Example Response
{
"id": "8d0f0a5d-4b5e-4c09-9db6-0e9d2aa8a9fd",
"created_at": "2024-09-01T10:05:03.291Z",
"updated_at": "2024-09-01T10:05:03.291Z",
"corpora_name": "support_playbooks",
"description": "Runbooks feeding LlamaIndex",
"size_on_disk": 0.0,
"index_location": null,
"is_published": false,
"index_type": "VSI",
"indexing_status": "PND",
"creator": "eb81c1d5-78fe-4f35-b58e-0ff6a3ad5d12"
}
Best Practices
Check Name Availability
Check Name Availability
Use
GET /api/check_corpora_name/?corpora_name=your_name to validate name availability before creating a corpus. This prevents 400 errors from duplicate names.curl -X GET "https://{your-host}/api/check_corpora_name/?corpora_name=support_playbooks" \
-H "Authorization: Bearer $SOAR_LABS_TOKEN"
Store the Corpus ID
Store the Corpus ID
Save the returned
id field immediately - you’ll need it for:- Uploading resources (
POST /api/data/files/,/urls/,/strings/) - Executing queries (
POST /api/query/) - Retrieving corpus details (
GET /api/corpora/{id}/)
Monitor Indexing Status
Monitor Indexing Status
Track the
indexing_status field as resources are added:PND→PRS→IND: Normal progressionERR: Check resource ingestion logs for failures
GET /api/corpora/{id}/ to monitor status changes.Understanding Read-Only Fields
Understanding Read-Only Fields
The following fields are managed by SOAR and cannot be set directly:
size_on_disk- Updated as resources are indexedindex_location- Assigned when first resource is processedcreator- Automatically set to your user IDid,created_at,updated_at- System-generated metadata
Choose
VSI (Vector Store Index) for most use cases. It provides the best semantic search capabilities and works well with the advanced RAG retrieval pipeline.Client examples
- Python
- TypeScript / JavaScript
- Java
import os
import requests
BASE_URL = "https://your-soar-instance.com"
TOKEN = os.environ["SOAR_LABS_TOKEN"]
payload = {
"corpora_name": "support_playbooks",
"description": "Runbooks feeding LlamaIndex",
}
response = requests.post(
f"{BASE_URL}/api/corpora/",
headers={
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json",
},
json=payload,
timeout=30,
)
response.raise_for_status()
corpus = response.json()
const BASE_URL = "https://your-soar-instance.com";
const token = process.env.SOAR_LABS_TOKEN!;
async function createCorpus() {
const response = await fetch(`${BASE_URL}/api/corpora/`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({
corpora_name: "support_playbooks",
description: "Runbooks feeding LlamaIndex",
}),
});
if (!response.ok) {
throw new Error(`Create corpus failed: ${response.status}`);
}
return response.json();
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
var BASE_URL = "https://your-soar-instance.com";
var token = System.getenv("SOAR_LABS_TOKEN");
var json = "{" +
"\"corpora_name\":\"support_playbooks\"," +
"\"description\":\"Runbooks feeding LlamaIndex\"" +
"}";
var request = HttpRequest.newBuilder(URI.create(BASE_URL + "/api/corpora/"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 400) {
throw new RuntimeException("Create corpus failed: " + response.statusCode());
}
var body = response.body();
Authorizations
jwtHeaderAuthjwtCookieAuthcookieAuthbasicAuth
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Name of the corpora
Maximum string length:
100Description of the corpora
Is the corpora Visible to all users?
Type of index to be used for the corpora
VSI- VectorStoreIndexSMI- SummaryIndexDSI- DocumentSummaryIndex
Available options:
VSI, SMI, DSI Status of the corpora processing
PND- PendingIQE- In QueuePRS- ProcessingDEX- Data Extracted SuccessfullyDER- Data Extraction ErrorIND- IndexedCMP- CompletedERR- Error
Available options:
PND, IQE, PRS, DEX, DER, IND, CMP, ERR Response
201 - application/json
The date and time the organization was created
Last updated time
Name of the corpora
Maximum string length:
100Size of the corpora on disk (in bytes)
Location of the index on Remote Storage
Description of the corpora
Is the corpora Visible to all users?
Type of index to be used for the corpora
VSI- VectorStoreIndexSMI- SummaryIndexDSI- DocumentSummaryIndex
Available options:
VSI, SMI, DSI Status of the corpora processing
PND- PendingIQE- In QueuePRS- ProcessingDEX- Data Extracted SuccessfullyDER- Data Extraction ErrorIND- IndexedCMP- CompletedERR- Error
Available options:
PND, IQE, PRS, DEX, DER, IND, CMP, ERR Was this page helpful?

