Skip to main content
DELETE
/
api
/
data
/
strings
/
{id}

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

id
UUID
required
String resource identifier. Must belong to a corpus you own.Example: b43bbf35-9819-47a8-8aff-d4eb4b3e8219

Example request

curl -X DELETE https://{your-host}/api/data/strings/b43bbf35-9819-47a8-8aff-d4eb4b3e8219/ \
  -H "Authorization: Bearer $SOAR_LABS_TOKEN"

Response Codes

204
No Content
String successfully deleted. No response body returned.
404
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

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}")
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.
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")
Safely retract policy or guidance:
# 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")
Compliance note: Maintain audit logs for all content deletions to meet regulatory requirements.
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

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()

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string<uuid>
required

A UUID string identifying this String.

Response

204

No response body