<

Getting started with Accounts & Subaccounts

A Plivo account is created whenever you signup on Plivo. You can retrieve your account details like email, available cash credits, name and time zone using the Account API. You can also modify your city and address to reflect in your invoices using the Account modify API.

Get Account Details

You can retrieve an Account object by calling the Account API. An Account object contains details of your account like email address, cash credits, postal address, auto recharge settings, etc. To know more about what the Accounts API can offer, please refer to the API reference for Account.

The following snippet of code will help you get your account details:

1
2
3
4
5
import plivo


client = plivo.Client()
response = client.account.get()

Modify Account Details

If you would like to modify your account details, you can make changes to the name, city and the address fields.

The following snippet of code will help you modify your account details:

1
2
3
4
5
6
7
8
9
import plivo


client = plivo.Client()
response = client.account.update(
    name='Test Account',
    city='Bengaluru',
    address='Test Address',
)

Subaccounts

Subaccounts are “child accounts” linked to a parent account. If you have multiple customers to whom you wish to expose Plivo’s capabilities, you can use Subaccounts to segment, manage, and keep track of the account usages of each user independently. To know more about what the Subaccount API can offer, please refer to the API reference for Subaccount.

You can achieve the following use subaccounts:

  • Separate authentication of subaccounts
  • Track usage for each subaccount
  • Assign Applications to a subaccount
  • Link phone numbers to a subaccount.
  • Get call details for a subaccount
  • Link Endpoints to a subaccount

Create a Subaccount

You can create a Subaccount with a specified name and receive auth ID and auth Token dedicated to the Subaccount. You can also enforce whether the Subaccount is disabled or enabled. The Subaccount remains disabled by default.

You can use the following code snippet to create a subaccount:

1
2
3
4
5
6
7
8
import plivo


client = plivo.Client()
response = client.subaccounts.create(
    name='Test Subaccount',
    enabled=True,
)

Modify a Subaccount

You can modify a Subaccount name and enable or disable a Subaccount.

You can use the following code snippet to modify a Subaccount.

1
2
3
4
5
6
7
8
import plivo


client = plivo.Client()
response = client.subaccounts.update(
    auth_id='SAYJBMZJZHMDY1NJNLMG',
    name='Updated Subaccount Name',
)