const options = {
method: 'PUT',
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 PUT \
--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.put(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.put("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"
}Update Corpus
Replace every mutable field on a corpus in a single request.
const options = {
method: 'PUT',
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 PUT \
--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.put(url, json=payload, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.put("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
Replace all mutable corpus fields in a single request. This is a full replacement operation - any field not provided will be reset to its default value.PATCH /api/corpora/{id}/ instead.Authentication
Requires valid JWT token or session authentication. You must own the target corpus.Path Parameters
8d0f0a5d-4b5e-4c09-9db6-0e9d2aa8a9fdRequest Body
400 Bad Request if another of your corpora has the same normalized name.true to make the corpus discoverable by other users.Default: false (private) if omitted.VSI- Vector Store Index (best for semantic search)SMI- Summary IndexDSI- Document Summary Index
PND, PRS, IND, ERRExample request
curl -X PUT https://{your-host}/api/corpora/8d0f0a5d-4b5e-4c09-9db6-0e9d2aa8a9fd/ \
-H "Authorization: Bearer $SOAR_LABS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"corpora_name": "support_playbooks",
"description": "Updated description",
"is_published": true,
"index_type": "VSI",
"indexing_status": "IND"
}'
Example response
{
"id": "8d0f0a5d-4b5e-4c09-9db6-0e9d2aa8a9fd",
"created_at": "2024-09-01T10:05:03.291Z",
"updated_at": "2024-09-02T07:12:44.914Z",
"corpora_name": "support_playbooks",
"description": "Updated description",
"size_on_disk": 4194304.0,
"index_location": "qdrant_free_collection",
"is_published": true,
"index_type": "VSI",
"indexing_status": "IND",
"creator": "eb81c1d5-78fe-4f35-b58e-0ff6a3ad5d12"
}
Response Structure
false if omitted).VSI if omitted).PRS if index_type was changed and re-indexing started.Best Practices
PUT vs PATCH - When to Use Each
PUT vs PATCH - When to Use Each
- Renaming a corpus along with other changes
- You want to explicitly reset fields to defaults
- You have a complete corpus object to replace
- Updating a single field (e.g., toggling
is_published) - Making incremental changes without affecting other fields
- You don’t want to risk accidentally resetting fields
# ❌ BAD: Using PUT to only change description
# This resets is_published to false!
requests.put(
f"{base_url}/api/corpora/{corpus_id}/",
json={"corpora_name": "my_corpus", "description": "New description"}
)
# ✅ GOOD: Use PATCH for single field updates
requests.patch(
f"{base_url}/api/corpora/{corpus_id}/",
json={"description": "New description"}
)
Handling Name Collisions
Handling Name Collisions
try:
response = requests.put(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers,
json={
"corpora_name": "duplicate_name",
"description": "Test",
"is_published": False,
"index_type": "VSI"
}
)
response.raise_for_status()
except requests.HTTPError as e:
if e.response.status_code == 400:
error = e.response.json()
if "corpora_name" in error:
print("Name collision - choose a different name")
GET /api/check_corpora_name/?corpora_name=new_name before attempting the update.Index Type Migration
Index Type Migration
index_type triggers background re-indexing:# Update to different index type
response = requests.put(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers,
json={
"corpora_name": "support_playbooks",
"description": "Switching to summary index",
"index_type": "SMI", # Changed from VSI
"is_published": False
}
)
# Monitor re-indexing progress
while True:
corpus = requests.get(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers
).json()
if corpus["indexing_status"] == "IND":
print("Re-indexing complete")
break
elif corpus["indexing_status"] == "ERR":
print("Re-indexing failed")
break
time.sleep(10)
Atomic Updates with Verification
Atomic Updates with Verification
# Get current state
original = requests.get(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers
).json()
try:
# Attempt full update
updated = requests.put(
f"{base_url}/api/corpora/{corpus_id}/",
headers=headers,
json={
"corpora_name": "renamed_corpus",
"description": "Updated description",
"is_published": True,
"index_type": original["index_type"] # Keep same type
}
).json()
# Verify critical fields
assert updated["corpora_name"] == "renamed_corpus"
assert updated["is_published"] == True
print("Update verified successfully")
except Exception as e:
print(f"Update failed: {e}")
# Original corpus state is unchanged on failure
400 Bad Request indicates either a name collision or attempt to modify read-only fields like creator, id, or created_at.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"
payload = {
"corpora_name": "support_playbooks",
"description": "Updated description",
"is_published": True,
"index_type": "VSI",
}
response = requests.put(
f"{BASE_URL}/api/corpora/{CORPUS_ID}/",
headers={
"Authorization": f"Bearer {TOKEN}",
"Content-Type": "application/json",
},
json=payload,
timeout=30,
)
response.raise_for_status()
updated = response.json()
const BASE_URL = "https://your-soar-instance.com";
const token = process.env.SOAR_LABS_TOKEN!;
async function updateCorpus(corpusId: string) {
const response = await fetch(`${BASE_URL}/api/corpora/${corpusId}/`, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({
corpora_name: "support_playbooks",
description: "Updated description",
is_published: true,
index_type: "VSI",
}),
});
if (!response.ok) {
throw new Error(`Update 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 = "{" +
"\"corpora_name\":\"support_playbooks\"," +
"\"description\":\"Updated description\"," +
"\"is_published\":true," +
"\"index_type\":\"VSI\"" +
"}";
var request = HttpRequest.newBuilder(URI.create(BASE_URL + "/api/corpora/" + corpusId + "/"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.PUT(HttpRequest.BodyPublishers.ofString(json))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 400) {
throw new RuntimeException("Update 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?

