Skip to main content
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
string
Auth ID of the subaccount.
auth_token
string
Auth Token of the subaccount.
name
string
Name of the subaccount.
enabled
boolean
Whether the subaccount is enabled.
account
string
URI to the parent account.
created
string
Date the subaccount was created.
modified
string
Date the subaccount was last modified.
resource_uri
string
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

name
string
required
A human-readable name for the subaccount.
enabled
boolean
Whether the subaccount should be enabled. Default: false.

Example

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

No arguments required.

Example

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

limit
integer
Results per page. Maximum 20.
offset
integer
Pagination offset.

Example

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

name
string
required
Name of the subaccount.
enabled
boolean
Whether the subaccount should be enabled.

Example

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

cascade
boolean
If true, deletes associated Applications, Endpoints, and Numbers. If false, maps them to the main account. Default: false.

Example

import plivo

client = plivo.RestClient('<auth_id>', '<auth_token>')

response = client.subaccounts.delete(
    auth_id='SA2025RK4E639VJFZAMM',
    cascade=True)
print(response)

Response

HTTP Status Code: 204