Bulk delete integrated accounts
/integrated-account/bulk-delete
This endpoint is polymorphic and supports two mutually exclusive modes:
1. Synchronous mode — { ids | tenant_id }
Delete up to 1000 integrated accounts immediately and return the result.
Provide exactly one of:
tenant_id— deletes accounts owned by that tenant in the environment. Capped at 1000 per request; if the tenant has more, repeat the call untilmatched_count < 1000.ids— deletes a specific list of integrated account UUIDs. Up to 99 ids per request.
Session-authenticated requests must also send environment_id (query or body) so Truto knows which environment to scope the delete to. API tokens are already scoped to one environment.
2. Legacy async mode — { query, dry_run? }
Enqueue a batch job that deletes accounts matching an arbitrary list filter. Results arrive via batch_job:* webhook events. This mode is preserved for backward compatibility with existing callers.
The endpoint detects the mode from the request body: if query or dry_run is present, it uses the async path; otherwise it expects ids or tenant_id and uses the synchronous path. If neither mode is identifiable, the request returns 400.
Examples
Synchronous: delete every integrated account for a tenant
{
"tenant_id": "acme-1"
}
Synchronous: delete a specific list of integrated accounts
{
"ids": [
"79a39d69-e27e-49cb-b9a9-79f5eea7aa26",
"0c74a4ad-7b8e-4f3a-9c1d-2e4f5a6b7c8d"
]
}
Async: delete matching accounts via batch job
{
"query": { "tenant_id": "acme-1", "status": { "ne": "active" } },
"dry_run": false
}
Request Body
Synchronous request · 3 properties
Required for session-auth requests (dashboard). API tokens are already environment-scoped and can omit this.
Specific integrated account ids to delete. Up to 99 ids per request. Mutually exclusive with tenant_id.
["79a39d69-e27e-49cb-b9a9-79f5eea7aa26","0c74a4ad-7b8e-4f3a-9c1d-2e4f5a6b7c8d"]Delete integrated accounts owned by this tenant in the environment. Capped at 1000 accounts per request; repeat the call until matched_count < 1000 if the tenant has more. Mutually exclusive with ids.
acme-1Async batch-job request · 3 properties
When true, the batch job reports what it would delete without actually deleting.
falseRequired for session-auth requests (dashboard). API tokens are already environment-scoped and can omit this.
Arbitrary list filter for integrated accounts. Supports the same filters as the List endpoint. Must be non-empty.
{"tenant_id":"acme-1"}Response Body
Synchronous response · 4 properties
Number of integrated accounts actually deleted. May be less than matched_count if accounts were deleted concurrently.
Number of integrated accounts that matched the filter.
Async response · 1 property
curl -X POST 'https://api.truto.one/integrated-account/bulk-delete' \
-H 'Authorization: Bearer <your_api_token>' \
-H 'Content-Type: application/json' \
-d '{
"tenant_id": "acme-1"
}'const body = {
"tenant_id": "acme-1"
};
const response = await fetch('https://api.truto.one/integrated-account/bulk-delete', {
method: 'POST',
headers: {
'Authorization': 'Bearer <your_api_token>',
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
const data = await response.json();
console.log(data);import requests
url = "https://api.truto.one/integrated-account/bulk-delete"
headers = {
"Authorization": "Bearer <your_api_token>",
"Content-Type": "application/json",
}
params = {
}
payload = {
"tenant_id": "acme-1"
}
response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())