TypeScript
const { results, deleted_count } = await uc.deleteMany(['ctx_abc123', 'ctx_def456'])
for (const r of results) {
if (r.deleted) console.log(`Deleted ${r.id}`)
else console.log(`Failed ${r.id}: ${r.error}`)
}result = uc.delete_many(['ctx_abc123', 'ctx_def456'])
for r in result['results']:
if r['deleted']:
print(f"Deleted {r['id']}")
else:
print(f"Failed {r['id']}: {r.get('error')}")curl -X POST https://api.ultracontext.ai/contexts/delete-many \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"ids": ["ctx_abc123", "ctx_def456"]}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({ids: ['<string>']})
};
fetch('https://api.ultracontext.ai/contexts/delete-many', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ultracontext.ai/contexts/delete-many",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ultracontext.ai/contexts/delete-many"
payload := strings.NewReader("{\n \"ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ultracontext.ai/contexts/delete-many")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ultracontext.ai/contexts/delete-many")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"id": "<string>",
"deleted": true,
"error": "<string>"
}
],
"deleted_count": 123
}{
"results": [
{
"id": "<string>",
"deleted": true,
"error": "<string>"
}
],
"deleted_count": 123
}{
"error": "<string>"
}{
"results": [
{
"id": "<string>",
"deleted": true,
"error": "<string>"
}
],
"deleted_count": 123
}Contexts
Delete multiple contexts permanently
Permanently delete up to 100 contexts in one call. Each context and all its versions are irreversibly removed.
POST
/
contexts
/
delete-many
TypeScript
const { results, deleted_count } = await uc.deleteMany(['ctx_abc123', 'ctx_def456'])
for (const r of results) {
if (r.deleted) console.log(`Deleted ${r.id}`)
else console.log(`Failed ${r.id}: ${r.error}`)
}result = uc.delete_many(['ctx_abc123', 'ctx_def456'])
for r in result['results']:
if r['deleted']:
print(f"Deleted {r['id']}")
else:
print(f"Failed {r['id']}: {r.get('error')}")curl -X POST https://api.ultracontext.ai/contexts/delete-many \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"ids": ["ctx_abc123", "ctx_def456"]}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({ids: ['<string>']})
};
fetch('https://api.ultracontext.ai/contexts/delete-many', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ultracontext.ai/contexts/delete-many",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ultracontext.ai/contexts/delete-many"
payload := strings.NewReader("{\n \"ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ultracontext.ai/contexts/delete-many")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ultracontext.ai/contexts/delete-many")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"id": "<string>",
"deleted": true,
"error": "<string>"
}
],
"deleted_count": 123
}{
"results": [
{
"id": "<string>",
"deleted": true,
"error": "<string>"
}
],
"deleted_count": 123
}{
"error": "<string>"
}{
"results": [
{
"id": "<string>",
"deleted": true,
"error": "<string>"
}
],
"deleted_count": 123
}Authorizations
API key from your UltraContext dashboard
Body
application/json
Array of context IDs to permanently delete (max 100)
Required array length:
1 - 100 elements⌘I