Permanently deletes a Subaccount. Optionally associates all Numbers, Endpoints, and Applications that were linked to the deleted Subaccount to the main Plivo Account.
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
importplivoclient=plivo.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)
## Example for Subaccount Delete#require'rubygems'require'plivo'includePlivoincludePlivo::Exceptionsapi=RestClient.new("<auth_id>","<auth_token>")beginresponse=api.subaccounts.delete('SA2025RK4E639VJFZAMM’,
true
)
puts response
rescue PlivoRESTError => e
puts 'Exception:'+e.messageEnd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Example for Subaccount deletevarplivo=require('plivo');(functionmain(){'use strict';// If auth id and auth token are not specified, Plivo will fetch them from the environment variables.varclient=newplivo.Client("<auth_id>","<auth_token>");client.subaccounts.delete("SA2025RK4E639VJFZAMM",// subauth idtrue//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';usePlivo\RestClient;usePlivo\Exceptions\PlivoRestException;$client=newRestClient("<auth_id>","<auth_token>");try{$response=$client->subaccounts->delete('SA2025RK4E639VJFZAMM',true);print_r($response);}catch(PlivoRestException$ex){print_r($ex);}
packagecom.plivo.api.samples.subaccount;importjava.io.IOException;importcom.plivo.api.Plivo;importcom.plivo.api.exceptions.PlivoRestException;importcom.plivo.api.models.account.Subaccount;/**
* Example for Subaccount delete
*/classSubaccountDelete{publicstaticvoidmain(String[]args){Plivo.init("<auth_id>","<auth_token>");try{Subaccount.deleter("SA2025RK4E639VJFZAMM").cascade(true).delete();System.out.println("Deleted successfully.");}catch(PlivoRestException|IOExceptione){e.printStackTrace();}}}
/**
* Example for Subaccount Delete
*/usingSystem;usingSystem.Collections.Generic;usingPlivo;usingPlivo.Exception;namespacePlivoExamples{internalclassProgram{publicstaticvoidMain(string[]args){varapi=newPlivoApi("<auth_id>","<auth_token>");try{varresponse=api.Subaccount.Delete(id:"SA2025RK4E639VJFZAMM",cascade:true);Console.WriteLine(response);}catch(PlivoRestExceptione){Console.WriteLine("Exception: "+e.Message);}}}}
// Example for Subaccount deletepackagemainimport("fmt""github.com/plivo/plivo-go/v7")funcmain(){client,err:=plivo.NewClient("<auth_id>","<auth_token>",&plivo.ClientOptions{})iferr!=nil{fmt.Print("Error",err.Error())return}err=client.Subaccounts.Delete("SA2025RK4E639VJFZAMM",plivo.SubaccountDeleteParams{Cascade:true},)iferr!=nil{fmt.Print("Error",err.Error())return}fmt.Println("Deleted successfully.")}
Example Request
1
2
3
4
5
6
7
8
9
10
11
12
13
importplivoauth_id="<auth_id>"auth_token="<auth_token>"p=plivo.RestAPI(auth_id,auth_token)params={# Auth ID of the subacccount to be deleted
'subauth_id':'SA2025RK4E639VJFZAMM'}response=p.delete_subaccount(params)printstr(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require'rubygems'require'plivo'includePlivoAUTH_ID="<auth_id>"AUTH_TOKEN="<auth_token>"p=RestAPI.new(AUTH_ID,AUTH_TOKEN)params={# Auth ID of the subacccount to be deleted'subauth_id'=>'SA2025RK4E639VJFZAMM'}response=p.delete_subaccount(params)printresponse
1
2
3
4
5
6
7
8
9
10
11
12
13
varplivo=require('plivo');varp=plivo.RestAPI({authId:'<auth_id>',authToken:'<auth_token>'});varparams={// Auth ID of the subacccount to be deleted'subauth_id':'SA2025RK4E639VJFZAMM'};varresponse=p.delete_subaccount(params);console.log(response);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?phprequire'vendor/autoload.php';usePlivo\RestAPI;$auth_id="<auth_id>";$auth_token="<auth_token>";$p=newRestAPI($auth_id,$auth_token);$params=array(# Auth ID of the subacccount to be deleted'subauth_id'=>'SA2025RK4E639VJFZAMM');$response=$p->delete_subaccount($params);print_r($response);?>
packageplivoexample;importjava.util.LinkedHashMap;importcom.plivo.helper.api.client.*;importcom.plivo.helper.api.response.response.GenericResponse;importcom.plivo.helper.exception.PlivoException;publicclassApp{publicstaticvoidmain(String[]args)throwsIllegalAccessException{Stringauth_id="<auth_id>";Stringauth_token="<auth_token>";RestAPIapi=newRestAPI(auth_id,auth_token,"v1");LinkedHashMap<String,String>params=newLinkedHashMap<String,String>();// Auth ID of the subacccount to be deletedparams.put("subauth_id","SA2025RK4E639VJFZAMM");try{GenericResponseresp=api.deleteSubaccount(params);System.out.println(resp);}catch(PlivoExceptione){System.out.println(e.getLocalizedMessage());}}}
usingSystem;usingSystem.Collections.Generic;usingRestSharp;usingPlivo.API;namespaceapps{classProgram{staticvoidMain(string[]args){RestAPIplivo=newRestAPI("<auth_id>","<auth_token>");IRestResponse<GenericResponse>res=plivo.delete_subaccount(newDictionary<string,string>(){// Auth ID of the subacccount to be deleted{"subauth_id","SA2025RK4E639VJFZAMM"}});//Prints the responseConsole.Write(res.Content);}}}
// Example for Subaccount deletepackagemainimport("fmt""github.com/plivo/plivo-go/v7")funcmain(){client,err:=plivo.NewClient("<auth_id>","<auth_token>",&plivo.ClientOptions{})iferr!=nil{fmt.Print("Error",err.Error())return}err=client.Subaccounts.Delete("SA2025RK4E639VJFZAMM",plivo.SubaccountDeleteParams{Cascade:true},)iferr!=nil{fmt.Print("Error",err.Error())return}fmt.Println("Deleted successfully.")}
Rate this page
🥳 Thank you! It means a lot to us!
×
Help Us Improve
Thank you so much for rating the page, we would like to get your input
for further improvements!