Latest Legacy

Delete a Subaccount

Permanently deletes a Subaccount. Optionally associates all Numbers, Endpoints, and Applications that were linked to the deleted Subaccount to the main VTS Account.

API Endpoint

DELETE https://api.vtscom.net/v1/Account/{auth_id}/Subaccount/{subauth_id}/

Arguments

cascade boolean

If cascade is set to true, the Applications, Endpoints, and Numbers associated with the Subaccount are also deleted. When set to false, the Applications, Endpoints, and Numbers are mapped with the main Account.

Defaults to false.

Response

HTTP Status Code: 204

Example Request

1
2
3
4
5
6
7
8
9
10
11
12
13
import vts

client = vts.RestClient('<auth_id>','<auth_token>')
response = client.subaccounts.delete(
    auth_id='SA2025RK4E639VJFZAMM',
    cascade=True )
print(response)

# Or, you could delete the subaccount directly using the subaccount object
subaccount = client.subaccounts.get(
    auth_id='SA2025RK4E639VJFZAMM', )
response = subaccount.delete(cascade=True)
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Example for Subaccount Delete
#
require 'rubygems'
require 'vts'

include vts
include vts::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")

begin
  response = api.subaccounts.delete(
    'SA2025RK4E639VJFZAMM’,
     true
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
End
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Example for Subaccount delete

var vts = require('vts');

(function main() {
    'use strict';

   // If auth id and auth token are not specified, VTS will fetch them from the environment variables.
    var client = new vts.Client("<auth_id>","<auth_token>");
    client.subaccounts.delete(
        "SA2025RK4E639VJFZAMM", // subauth id
         true  //cascade=true/false
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
/**
 * Example for Subaccount delete
 */
require 'vendor/autoload.php';
use vts\RestClient;
use vts\Exceptions\VTSRestException;
$client = new RestClient("<auth_id>","<auth_token>");

try {
    $response = $client->subaccounts->delete(
        'SA2025RK4E639VJFZAMM',
         true
    );
    print_r($response);
}
catch (VTSRestException $ex) {
    print_r($ex);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package net.vtscom.api.samples.subaccount;

import java.io.IOException;
import net.vtscom.api.VTS;
import net.vtscom.api.exceptions.VTSRestException;
import net.vtscom.api.models.account.Subaccount;

/**
* Example for Subaccount delete
*/
class SubaccountDelete {
    public static void main(String [] args) {
        vts.init("<auth_id>","<auth_token>");
        try {
            Subaccount.deleter("SA2025RK4E639VJFZAMM").cascade(true)
                .delete();

            System.out.println("Deleted successfully.");
        } catch (VTSRestException | IOException e) {
            e.printStackTrace();
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Example for Subaccount Delete
 */
using System;
using System.Collections.Generic;
using vts;
using vts.Exception;

namespace VTSExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new VTSApi("<auth_id>","<auth_token>");
            try
            {
                var response = api.Subaccount.Delete(
                    id:"SA2025RK4E639VJFZAMM",
                    cascade: true
                );
                Console.WriteLine(response);
            }
            catch (VTSRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}
1
2
curl -X DELETE --user AUTH_ID:AUTH_TOKEN \
    https://api.vtscom.net/v1/Account/{auth_id}/Subaccount/{subauth_id}/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Example for Subaccount delete
package main

import (
	"fmt"

	"github.com/vts/vts-go/v7"
)

func main() {
	client, err := vts.NewClient("<auth_id>", "<auth_token>", &vts.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	err = client.Subaccounts.Delete(
		"SA2025RK4E639VJFZAMM",
		vts.SubaccountDeleteParams{Cascade: true},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Println("Deleted successfully.")
}