const options = {
method: 'PATCH',
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/{id}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://api.example.com/api/corpora/{id}/ \
--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/{id}/"
payload = {
"corpora_name": "<string>",
"description": "<string>",
"is_published": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.patch("https://api.example.com/api/corpora/{id}/")
.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"
}Partially Update Corpus
Change an individual corpus field without resending the full payload.
const options = {
method: 'PATCH',
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/{id}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://api.example.com/api/corpora/{id}/ \
--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/{id}/"
payload = {
"corpora_name": "<string>",
"description": "<string>",
"is_published": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.patch("https://api.example.com/api/corpora/{id}/")
.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
Update specific corpus fields without affecting others. This is the recommended approach for incremental changes like toggling visibility, updating descriptions, or modifying individual settings.is_published or updating descriptions without risk of resetting other values.Authentication
Requires valid JWT token or session authentication. You must own the target corpus.Path Parameters
8d0f0a5d-4b5e-4c09-9db6-0e9d2aa8a9fdRequest Body
Send only the fields you want to modify:true makes the corpus discoverable by other users.Common use case: Publishing/unpublishing corpora for access control.VSI, SMI, or DSIExample request
curl -X PATCH https://{your-host}/api/corpora/8d0f0a5d-4b5e-4c09-9db6-0e9d2aa8a9fd/ \
-H "Authorization: Bearer $SOAR_LABS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"description": "Add tier-2 troubleshooting flows",
"is_published": false
}'
Example response
{
"id": "8d0f0a5d-4b5e-4c09-9db6-0e9d2aa8a9fd",
"description": "Add tier-2 troubleshooting flows",
"is_published": false,
"corpora_name": "support_playbooks",
"index_type": "VSI",
"indexing_status": "IND",
"size_on_disk": 4194304.0,
"index_location": "qdrant_free_collection",
"created_at": "2024-09-01T10:05:03.291Z",
"updated_at": "2024-09-02T07:23:18.081Z",
"creator": "eb81c1d5-78fe-4b35-b58e-0ff6a3ad5d12"
}
Response Structure
Returns the complete corpus object with your changes applied:indexing_status may switch to PRS.PRS if re-indexing was triggered by index_type modification.Common Use Cases
Toggle Publication Status
Toggle Publication Status
# Publish a corpus
requests.patch(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers,
json={"is_published": True}
)
# Unpublish for maintenance
requests.patch(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers,
json={"is_published": False}
)
Update Description Only
Update Description Only
requests.patch(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers,
json={"description": "Updated with Q4 2024 product documentation"}
)
Batch Status Updates
Batch Status Updates
corpus_ids = ["id1", "id2", "id3"]
# Publish all corpora
for corpus_id in corpus_ids:
try:
requests.patch(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers,
json={"is_published": True}
)
print(f"Published {corpus_id}")
except Exception as e:
print(f"Failed to publish {corpus_id}: {e}")
Safe Index Type Migration
Safe Index Type Migration
# Get current corpus
corpus = requests.get(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers
).json()
print(f"Current index type: {corpus['index_type']}")
# Update only the index type
updated = requests.patch(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers,
json={"index_type": "SMI"} # Switch to Summary Index
).json()
# Wait for re-indexing
if updated["indexing_status"] == "PRS":
print("Re-indexing started. Monitor status...")
Conditional Updates
Conditional Updates
# Get current state
corpus = requests.get(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers
).json()
# Only publish if indexing is complete
if corpus["indexing_status"] == "IND":
requests.patch(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers,
json={"is_published": True}
)
print("Corpus published")
else:
print(f"Corpus not ready (status: {corpus['indexing_status']})")
index_type enum validation still apply. Invalid values return 400 Bad Request.Client examples
- Python
- TypeScript / JavaScript
- Java
import os
import requests
BASE_URL = "https://your-soar-instance.com"
TOKEN = os.environ["SOAR_LABS_TOKEN"]
CORPUS_ID = "8d0f0a5d-4b5e-4c09-9db6-0e9d2aa8a9fd"
response = requests.patch(
f"{BASE_URL}/api/corpora/{CORPUS_ID}/",
headers={
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json",
},
json={"is_published": False, "description": "Add tier-2 troubleshooting flows"},
timeout=30,
)
response.raise_for_status()
patched = response.json()
const BASE_URL = "https://your-soar-instance.com";
const token = process.env.SOAR_LABS_TOKEN!;
async function patchCorpus(corpusId: string) {
const response = await fetch(`${BASE_URL}/api/corpora/${corpusId}/`, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({
description: "Add tier-2 troubleshooting flows",
is_published: false,
}),
});
if (!response.ok) {
throw new Error(`Patch 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 corpusId = "8d0f0a5d-4b5e-4c09-9db6-0e9d2aa8a9fd";
var json = "{" +
"\"description\":\"Add tier-2 troubleshooting flows\"," +
"\"is_published\":false" +
"}";
var request = HttpRequest.newBuilder(URI.create(BASE_URL + "/api/corpora/" + corpusId + "/"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString(json))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 400) {
throw new RuntimeException("Patch corpus failed: " + response.statusCode());
}
var body = response.body();
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
A UUID string identifying this Corpora.
Body
Name of the corpora
100Description of the corpora
Is the corpora Visible to all users?
Type of index to be used for the corpora
VSI- VectorStoreIndexSMI- SummaryIndexDSI- DocumentSummaryIndex
VSI, SMI, DSI Status of the corpora processing
PND- PendingIQE- In QueuePRS- ProcessingDEX- Data Extracted SuccessfullyDER- Data Extraction ErrorIND- IndexedCMP- CompletedERR- Error
PND, IQE, PRS, DEX, DER, IND, CMP, ERR Response
The date and time the organization was created
Last updated time
Name of the corpora
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
VSI, SMI, DSI Status of the corpora processing
PND- PendingIQE- In QueuePRS- ProcessingDEX- Data Extracted SuccessfullyDER- Data Extraction ErrorIND- IndexedCMP- CompletedERR- Error
PND, IQE, PRS, DEX, DER, IND, CMP, ERR Was this page helpful?

