curl -X DELETE "https://app.runtm.com/api/cloud/organizations/org_abc123/cleanup" \
-H "Authorization: Bearer runtm_xxx" \
-H "X-Organization-Id: org_abc123"
import requests
response = requests.delete(
"https://app.runtm.com/api/cloud/organizations/org_abc123/cleanup",
headers={
"Authorization": "Bearer runtm_xxx",
"X-Organization-Id": "org_abc123",
},
)
data = response.json()
print(f"Sessions converted: {data['sessions_converted']}")
print(f"Keys converted: {data['keys_converted']}")
const response = await fetch(
"https://app.runtm.com/api/cloud/organizations/org_abc123/cleanup",
{
method: "DELETE",
headers: {
"Authorization": "Bearer runtm_xxx",
"X-Organization-Id": "org_abc123",
},
}
);
const data = await response.json();
console.log(`Sessions converted: ${data.sessions_converted}`);
console.log(`Keys converted: ${data.keys_converted}`);
{
"organization_id": "org_abc123",
"sessions_converted": 12,
"keys_converted": 3,
"preferences_deleted": true
}
{
"detail": "Organization context required"
}
Guardrails
Org Cleanup
Post-deletion cleanup of organization resources
DELETE
/
api
/
organizations
/
{org_id}
/
cleanup
curl -X DELETE "https://app.runtm.com/api/cloud/organizations/org_abc123/cleanup" \
-H "Authorization: Bearer runtm_xxx" \
-H "X-Organization-Id: org_abc123"
import requests
response = requests.delete(
"https://app.runtm.com/api/cloud/organizations/org_abc123/cleanup",
headers={
"Authorization": "Bearer runtm_xxx",
"X-Organization-Id": "org_abc123",
},
)
data = response.json()
print(f"Sessions converted: {data['sessions_converted']}")
print(f"Keys converted: {data['keys_converted']}")
const response = await fetch(
"https://app.runtm.com/api/cloud/organizations/org_abc123/cleanup",
{
method: "DELETE",
headers: {
"Authorization": "Bearer runtm_xxx",
"X-Organization-Id": "org_abc123",
},
}
);
const data = await response.json();
console.log(`Sessions converted: ${data.sessions_converted}`);
console.log(`Keys converted: ${data.keys_converted}`);
{
"organization_id": "org_abc123",
"sessions_converted": 12,
"keys_converted": 3,
"preferences_deleted": true
}
{
"detail": "Organization context required"
}
Runs post-org-delete cleanup: converts org-scoped sessions and API keys to personal ownership (nulls
organization_id), deletes organization preferences, and cleans up organization secrets.
This is an administrative action intended to be called after an organization has been deleted from the auth system.
Path Parameters
string
required
The organization ID to clean up
Headers
string
required
Bearer token.
Authorization: Bearer runtm_xxxstring
required
Must match the
org_id path parameterResponse
string
The organization ID that was cleaned up
integer
Number of sessions converted from org-scoped to personal
integer
Number of API keys converted from org-scoped to personal
boolean
Whether organization preferences were deleted
curl -X DELETE "https://app.runtm.com/api/cloud/organizations/org_abc123/cleanup" \
-H "Authorization: Bearer runtm_xxx" \
-H "X-Organization-Id: org_abc123"
import requests
response = requests.delete(
"https://app.runtm.com/api/cloud/organizations/org_abc123/cleanup",
headers={
"Authorization": "Bearer runtm_xxx",
"X-Organization-Id": "org_abc123",
},
)
data = response.json()
print(f"Sessions converted: {data['sessions_converted']}")
print(f"Keys converted: {data['keys_converted']}")
const response = await fetch(
"https://app.runtm.com/api/cloud/organizations/org_abc123/cleanup",
{
method: "DELETE",
headers: {
"Authorization": "Bearer runtm_xxx",
"X-Organization-Id": "org_abc123",
},
}
);
const data = await response.json();
console.log(`Sessions converted: ${data.sessions_converted}`);
console.log(`Keys converted: ${data.keys_converted}`);
{
"organization_id": "org_abc123",
"sessions_converted": 12,
"keys_converted": 3,
"preferences_deleted": true
}
{
"detail": "Organization context required"
}
Scopes
| Method | Required scope |
|---|---|
| DELETE | guardrails:write |