Delete Tenant
Delete a tenant by passing it’s ID. Deletion does not affect in-flight notifications, which complete with the settings that were in effect at trigger time. When the tenant has sub-tenants, use children_action in the request body to control what happens to them.
curl --request DELETE \
--url https://hub.suprsend.com/v1/tenant/{tenant_id}/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"children_action": "reassign",
"reassign_to": "acme-corp"
}
'import requests
url = "https://hub.suprsend.com/v1/tenant/{tenant_id}/"
payload = {
"children_action": "reassign",
"reassign_to": "acme-corp"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({children_action: 'reassign', reassign_to: 'acme-corp'})
};
fetch('https://hub.suprsend.com/v1/tenant/{tenant_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://hub.suprsend.com/v1/tenant/{tenant_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'children_action' => 'reassign',
'reassign_to' => 'acme-corp'
]),
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://hub.suprsend.com/v1/tenant/{tenant_id}/"
payload := strings.NewReader("{\n \"children_action\": \"reassign\",\n \"reassign_to\": \"acme-corp\"\n}")
req, _ := http.NewRequest("DELETE", 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.delete("https://hub.suprsend.com/v1/tenant/{tenant_id}/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"children_action\": \"reassign\",\n \"reassign_to\": \"acme-corp\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.suprsend.com/v1/tenant/{tenant_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"children_action\": \"reassign\",\n \"reassign_to\": \"acme-corp\"\n}"
response = http.request(request)
puts response.read_body{
"code": 400,
"error_code": "error",
"type": "ValidationError",
"message": "{\"reassign_to\": [\"This field may not be blank.\"]}",
"detail": {
"reassign_to": [
"This field may not be blank."
]
}
}{
"code": 404,
"error_code": "not_found",
"type": "NotFound",
"message": "No tenant found for tenant_id 12",
"detail": "No tenant found for tenant_id 12"
}Authorizations
Pass as Bearer <API_KEY>. Get API Key from SuprSend dashboard Developers -> API Keys section.
Path Parameters
unique identifier of the tenant to delete
Body
Only applies when the tenant has sub-tenants. orphan (default) promotes sub-tenants to root tenants. reassign moves sub-tenants under reassign_to tenant. delete deletes every sub-tenant in the subtree. Ignored for tenants with no sub-tenants.
orphan, reassign, delete "reassign"
Target parent when children_action = reassign. Required in that case; must reference an existing tenant. See sub-tenants.
"acme-corp"
Response
204 - No Content
Was this page helpful?
curl --request DELETE \
--url https://hub.suprsend.com/v1/tenant/{tenant_id}/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"children_action": "reassign",
"reassign_to": "acme-corp"
}
'import requests
url = "https://hub.suprsend.com/v1/tenant/{tenant_id}/"
payload = {
"children_action": "reassign",
"reassign_to": "acme-corp"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({children_action: 'reassign', reassign_to: 'acme-corp'})
};
fetch('https://hub.suprsend.com/v1/tenant/{tenant_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://hub.suprsend.com/v1/tenant/{tenant_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'children_action' => 'reassign',
'reassign_to' => 'acme-corp'
]),
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://hub.suprsend.com/v1/tenant/{tenant_id}/"
payload := strings.NewReader("{\n \"children_action\": \"reassign\",\n \"reassign_to\": \"acme-corp\"\n}")
req, _ := http.NewRequest("DELETE", 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.delete("https://hub.suprsend.com/v1/tenant/{tenant_id}/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"children_action\": \"reassign\",\n \"reassign_to\": \"acme-corp\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.suprsend.com/v1/tenant/{tenant_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"children_action\": \"reassign\",\n \"reassign_to\": \"acme-corp\"\n}"
response = http.request(request)
puts response.read_body{
"code": 400,
"error_code": "error",
"type": "ValidationError",
"message": "{\"reassign_to\": [\"This field may not be blank.\"]}",
"detail": {
"reassign_to": [
"This field may not be blank."
]
}
}{
"code": 404,
"error_code": "not_found",
"type": "NotFound",
"message": "No tenant found for tenant_id 12",
"detail": "No tenant found for tenant_id 12"
}