Subaccounts let you manage multiple customer accounts under your main account. Each subaccount has its own Auth ID and Token, while charges deduct from the main account.
API Endpoint
https://api.plivo.com/v1/Account/{auth_id}/Subaccount/
The Subaccount Object
Attributes
Auth ID of the subaccount.
Auth Token of the subaccount.
Whether the subaccount is enabled.
URI to the parent account.
Date the subaccount was created.
Date the subaccount was last modified.
URI to the subaccount resource.
Example Object
{
"account" : "/v1/Account/MA2025RK4E639VJFZAGV/" ,
"api_id" : "968f0a22-9237-11e7-a51d-0245fa790d9e" ,
"auth_id" : "SA2025RK4E639VJFZAMM" ,
"auth_token" : "NWM3YjliMjk0ZGYxMGM2YjJiYWE0MjEwZDM5YWU5" ,
"created" : "2022-09-05" ,
"enabled" : true ,
"modified" : null ,
"name" : "Subaccount Test" ,
"resource_uri" : "/v1/Account/MA2025RK4E639VJFZAGV/Subaccount/SA2025RK4E639VJFZAMM/"
}
Create a Subaccount
Creates a new subaccount.
POST https://api.plivo.com/v1/Account/{auth_id}/Subaccount/
Arguments
A human-readable name for the subaccount.
Whether the subaccount should be enabled. Default: false.
Example
Python
Node.js
Ruby
PHP
Java
.NET
Go
cURL
import plivo
client = plivo.RestClient( '<auth_id>' , '<auth_token>' )
response = client.subaccounts.create(
name = 'Wayne Enterprises Subaccount' ,
enabled = True )
print (response)
Response
{
"api_id" : "324a7dd8-0db2-11e4-8a4a-123140008edf" ,
"auth_id" : "SA2025RK4E639VJFZAMM" ,
"auth_token" : "MTZjYWM0YzVjNjMwZmVmODFiNWJjNPJmOGJjZjgw" ,
"message" : "created"
}
Retrieve a Subaccount
Get details of a specific subaccount.
GET https://api.plivo.com/v1/Account/{auth_id}/Subaccount/{subauth_id}/
Arguments
Example
Python
Node.js
Ruby
PHP
Java
.NET
Go
cURL
import plivo
client = plivo.RestClient( '<auth_id>' , '<auth_token>' )
response = client.subaccounts.get( auth_id = 'SA2025RK4E639VJFZAMM' )
print (response)
Response
{
"account" : "/v1/Account/MA2025RK4E639VJFZAGV/" ,
"api_id" : "323972b2-0db3-11e4-a2d1-22000ac5040c" ,
"auth_id" : "SA2025RK4E639VJFZAMM" ,
"auth_token" : "MTZjYWM0YzVjNjMwZmVmODFiNWJjNWJmOGJjZjgw" ,
"created" : "2022-07-17" ,
"enabled" : false ,
"modified" : null ,
"name" : "Han Solo" ,
"resource_uri" : "/v1/Account/MA2025RK4E639VJFZAGV/Subaccount/SA2025RK4E639VJFZAMM/"
}
List All Subaccounts
Returns all subaccounts sorted by creation date, newest first.
GET https://api.plivo.com/v1/Account/{auth_id}/Subaccount/
Arguments
Results per page. Maximum 20.
Example
Python
Node.js
Ruby
PHP
Java
.NET
Go
cURL
import plivo
client = plivo.RestClient( '<auth_id>' , '<auth_token>' )
response = client.subaccounts.list( offset = 0 , limit = 5 )
print (response)
Response
{
"api_id" : "b38bf42e-0db4-11e4-8a4a-123140008edf" ,
"meta" : {
"limit" : 20 ,
"next" : null ,
"offset" : 0 ,
"previous" : null ,
"total_count" : 2
},
"objects" : [
{
"account" : "/v1/Account/MA2025RK4E639VJFZAGV/" ,
"auth_id" : "SA2025RK4E639VJFZAMM" ,
"auth_token" : "MTZjYWM0YzVjNjMwZmVmODFiNWJjNWJmOGJjZjgw" ,
"created" : "2022-07-17" ,
"enabled" : false ,
"modified" : null ,
"name" : "Chewbacca" ,
"resource_uri" : "/v1/Account/MA2025RK4E639VJFZAGV/Subaccount/SA2025RK4E639VJFZAMM/"
}
]
}
Update a Subaccount
Updates a subaccount. Parameters not provided remain unchanged.
POST https://api.plivo.com/v1/Account/{auth_id}/Subaccount/{subauth_id}/
Arguments
Whether the subaccount should be enabled.
Example
Python
Node.js
Ruby
PHP
Java
.NET
Go
cURL
import plivo
client = plivo.RestClient( '<auth_id>' , '<auth_token>' )
response = client.subaccounts.update(
auth_id = 'SA2025RK4E639VJFZAMM' ,
name = 'Updated Subaccount Name' )
print (response)
Response
{
"message" : "changed" ,
"api_id" : "5a9fcb68-523d-11e1-86da-6ff39efcb949"
}
Delete a Subaccount
Permanently deletes a subaccount.
DELETE https://api.plivo.com/v1/Account/{auth_id}/Subaccount/{subauth_id}/
Arguments
If true, deletes associated Applications, Endpoints, and Numbers. If false, maps them to the main account. Default: false.
Example
Python
Node.js
Ruby
PHP
Java
.NET
Go
cURL
import plivo
client = plivo.RestClient( '<auth_id>' , '<auth_token>' )
response = client.subaccounts.delete(
auth_id = 'SA2025RK4E639VJFZAMM' ,
cascade = True )
print (response)
Response