JavaScript
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/api/data/strings/{id}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request DELETE \
--url https://api.example.com/api/data/strings/{id}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/api/data/strings/{id}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.delete("https://api.example.com/api/data/strings/{id}/")
.header("Authorization", "Bearer <token>")
.asString();Resources
Delete a String
Remove an embedded text snippet from a corpus.
DELETE
/
api
/
data
/
strings
/
{id}
/
JavaScript
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/api/data/strings/{id}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request DELETE \
--url https://api.example.com/api/data/strings/{id}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/api/data/strings/{id}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)HttpResponse<String> response = Unirest.delete("https://api.example.com/api/data/strings/{id}/")
.header("Authorization", "Bearer <token>")
.asString();Overview
Permanently delete a text snippet resource along with its metadata and vector embeddings. This immediately removes the string content from search results and retrieval operations.Irreversible: Deletion cannot be undone. The string record and its vector embeddings are permanently removed.
Use cases: Retracting outdated guidance, removing obsolete policies, correcting misinformation, or managing corpus content quality.
Authentication
Requires valid JWT token or session authentication. You must own the parent corpus.Path Parameters
UUID
required
String resource identifier. Must belong to a corpus you own.Example:
b43bbf35-9819-47a8-8aff-d4eb4b3e8219Example request
curl -X DELETE https://{your-host}/api/data/strings/b43bbf35-9819-47a8-8aff-d4eb4b3e8219/ \
-H "Authorization: Bearer $SOAR_LABS_TOKEN"
Response Codes
No Content
String successfully deleted. No response body returned.
Not Found
String does not exist, was already deleted, or belongs to a corpus you don’t own.
What Gets Deleted
- String record - Database entry with title and content
- Vector embeddings - All chunks removed from Qdrant
- Metadata - Creation timestamp and character count
Immediate effect: Vector cleanup happens synchronously, so deletions immediately affect retrieval quality and query results.
Verification
Confirm successful deletion:# This should return 404 after deletion
curl -X GET https://{your-host}/api/data/strings/{string-id}/ \
-H "Authorization: Bearer $SOAR_LABS_TOKEN"
Common Use Cases
Batch String Deletion
Batch String Deletion
Remove multiple strings matching criteria:
# Get all strings in corpus
strings = requests.get(
f"{base_url}/api/data/strings/?corpora={corpus_id}",
headers=headers
).json()
# Delete outdated strings
deleted_count = 0
for string in strings["results"]:
# Example: Delete strings containing specific keyword
if "[DEPRECATED]" in string["title"]:
try:
response = requests.delete(
f"{base_url}/api/data/strings/{string['id']}/",
headers=headers
)
if response.status_code == 204:
deleted_count += 1
print(f"Deleted: {string['title']}")
except Exception as e:
print(f"Failed to delete {string['title']}: {e}")
print(f"Total deleted: {deleted_count}")
Replace Outdated Content
Replace Outdated Content
Update guidance by deleting old version and adding new:
# Step 1: Delete outdated string
requests.delete(
f"{base_url}/api/data/strings/{old_string_id}/",
headers=headers
)
# Step 2: Add updated content
response = requests.post(
f"{base_url}/api/data/strings/",
headers=headers,
json={
"corpora": corpus_id,
"strings": [{
"title": "Updated SLA Policy",
"string": "Critical tickets must be responded to within 5 minutes (updated Q4 2024)."
}]
}
)
new_string = response.json()[0]
print(f"New string ID: {new_string['id']}")
Version tracking: Include version dates or identifiers in string titles for easy tracking and replacement.
Clean Up Duplicates
Clean Up Duplicates
Find and remove duplicate string content:
# Get all strings
strings = requests.get(
f"{base_url}/api/data/strings/?corpora={corpus_id}",
headers=headers
).json()["results"]
# Find duplicates by content
seen_content = {}
duplicates = []
for string in strings:
content = string["string"].strip().lower()
if content in seen_content:
duplicates.append(string["id"])
print(f"Duplicate found: {string['title']}")
else:
seen_content[content] = string["id"]
# Delete duplicates
for dup_id in duplicates:
requests.delete(
f"{base_url}/api/data/strings/{dup_id}/",
headers=headers
)
print(f"Removed {len(duplicates)} duplicate strings")
Policy Retraction Workflow
Policy Retraction Workflow
Safely retract policy or guidance:Compliance note: Maintain audit logs for all content deletions to meet regulatory requirements.
# Step 1: Verify string content before deletion
string = requests.get(
f"{base_url}/api/data/strings/{string_id}/",
headers=headers
).json()
print(f"Title: {string['title']}")
print(f"Content: {string['string'][:100]}...")
print(f"Created: {string['created_at']}")
# Step 2: Log the deletion for audit trail
audit_log = {
"action": "string_deletion",
"string_id": string_id,
"title": string["title"],
"timestamp": datetime.now().isoformat(),
"reason": "Policy superseded by new guidance"
}
# Save audit log
with open("deletion_audit.json", "a") as f:
f.write(json.dumps(audit_log) + "\n")
# Step 3: Delete the string
response = requests.delete(
f"{base_url}/api/data/strings/{string_id}/",
headers=headers
)
if response.status_code == 204:
print("String retracted successfully")
print("Audit log saved")
Selective Corpus Cleanup
Selective Corpus Cleanup
Clean up strings based on age or usage:
from datetime import datetime, timedelta
# Get all strings
strings = requests.get(
f"{base_url}/api/data/strings/?corpora={corpus_id}",
headers=headers
).json()["results"]
# Delete strings older than 1 year
cutoff_date = datetime.now() - timedelta(days=365)
old_strings = []
for string in strings:
created = datetime.fromisoformat(string["created_at"].replace("Z", "+00:00"))
if created < cutoff_date:
old_strings.append(string)
print(f"Found {len(old_strings)} strings older than 1 year")
# Delete with confirmation
if input("Proceed with deletion? (yes/no): ") == "yes":
for string in old_strings:
requests.delete(
f"{base_url}/api/data/strings/{string['id']}/",
headers=headers
)
print(f"Deleted {len(old_strings)} old strings")
Content quality: Regularly review and remove outdated strings to maintain high-quality retrieval results and corpus relevance.
Client examples
- Python
- TypeScript / JavaScript
- Java
import os
import requests
BASE_URL = "https://your-soar-instance.com"
TOKEN = os.environ["SOAR_LABS_TOKEN"]
STRING_ID = "b43bbf35-9819-47a8-8aff-d4eb4b3e8219"
response = requests.delete(
f"{BASE_URL}/api/data/strings/{STRING_ID}/",
headers={"Authorization": f"Bearer {TOKEN}"},
timeout=30,
)
if response.status_code != 204:
response.raise_for_status()
const BASE_URL = "https://your-soar-instance.com";
const token = process.env.SOAR_LABS_TOKEN!;
async function deleteString(stringId: string) {
const response = await fetch(`${BASE_URL}/api/data/strings/${stringId}/`, {
method: "DELETE",
headers: {
Authorization: `Bearer ${token}`,
},
});
if (response.status !== 204) {
throw new Error(`Delete string failed: ${response.status}`);
}
}
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 stringId = "b43bbf35-9819-47a8-8aff-d4eb4b3e8219";
var request = HttpRequest.newBuilder(URI.create(BASE_URL + "/api/data/strings/" + stringId + "/"))
.header("Authorization", "Bearer " + token)
.DELETE()
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.discarding());
if (response.statusCode() != 204) {
throw new RuntimeException("Delete string failed: " + response.statusCode());
}
Was this page helpful?

