curl --request DELETE \
--url https://api.visceralai.dev/v1/workspaces/{workspace_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.visceralai.dev/v1/workspaces/{workspace_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.visceralai.dev/v1/workspaces/{workspace_id}', 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.visceralai.dev/v1/workspaces/{workspace_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.visceralai.dev/v1/workspaces/{workspace_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.visceralai.dev/v1/workspaces/{workspace_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.visceralai.dev/v1/workspaces/{workspace_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Delete Workspace
Soft-delete a workspace: stamp deleted_at, revoke its keys, audit it.
The row and everything under it survive for the purge job that still owes
the S3 payloads a delete (migration 0034). What makes the deletion real
immediately is the pair of auth chokepoints — member_workspace and
resolve_workspace both filter deleted_at IS NULL — plus revoking every
key, which is what actually stops an SDK mid-run from writing into a
workspace the customer just deleted.
Three GUCs are in play and none is optional. member_workspace sets
app.current_user_id; the UPDATE additionally needs app.current_org_id
(workspaces’ only FOR ALL policy is workspaces_org_isolation, so without
it the statement matches zero rows and this endpoint 204s having done
nothing), and the audit INSERT needs app.current_workspace_id for
audit_log_workspace_isolation’s WITH CHECK. All three are SET LOCAL and
there is exactly one commit, at the end, so none of them is cleared
mid-handler. workspace_api_keys carries no RLS by design (0025).
curl --request DELETE \
--url https://api.visceralai.dev/v1/workspaces/{workspace_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.visceralai.dev/v1/workspaces/{workspace_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.visceralai.dev/v1/workspaces/{workspace_id}', 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.visceralai.dev/v1/workspaces/{workspace_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.visceralai.dev/v1/workspaces/{workspace_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.visceralai.dev/v1/workspaces/{workspace_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.visceralai.dev/v1/workspaces/{workspace_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}