Account

The Account API lets you perform actions on your Plivo account. When you sign up on Plivo, you will be given your own account. 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.

The following actions can be performed with the Account API

BaseURI: https://api.plivo.com/v1/Account/

Get Account Details

You can call this API to retrieve details like email address, cash credits, postal address, auto recharge settings, etc which is associated with your Plivo account. Returns an object representing your Plivo account.

GET https://api.plivo.com/v1/Account/{auth_id}/

Arguments

None

Response

The API returns the following response:

HTTP Status Code: 200

{
    "account_type": "standard",
    "address": "340 Pine St, San Francisco, CA - 94104",
    "api_id": "c31b36be-0da2-11e4-bd8a-12313f016a39",
    "auth_id": "MANWVLYTK4ZWU1YTY4ZT",
    "auto_recharge": true,
    "billing_mode": "prepaid",
    "cash_credits": "23.79822",
    "city": "San Francisco",
    "name": "Han Solo",
    "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/",
    "state": "California",
    "timezone": "America/Los_Angeles"
}

Response Attributes

account_type
string The type of your Plivo account. All accounts with funds are standard accounts. If your account is on free trial, this attribute will return developer.
address
string The postal address of the account which will be reflected in the invoices.
auth_id
string The auth id of the account.
auto_recharge
boolean Auto recharge settings associated with the account. If this value is true, we will recharge your account if the credits fall below a certain threshold.
billing_mode
boolean The billing mode of the account. Can be prepaid or postpaid.
cash_credits
string Credits of the account.
city
string The city of the account.
name
string The name of the account holder.
state
string The state of the account holder.
timezone
string The timezone of the account. A list of timezones possible timezone values are located at IANA Timezones

Modify an Account

If you would like to modify your account details, you could do so with this API. You can make changes to the name, city and the address fields.

POST https://api.plivo.com/v1/Account/{auth_id}/

Arguments

Parameter Description
name Name of the account holder or business.
city City of the account holder.
address Address of the account holder.

Response

HTTP Status Code: 202

{
    "api_id": "ea43d134-0db0-11e4-a2d1-22000ac5040c",
    "message": "changed"
}

Create a Subaccount

A subaccount is an account that is owned by a parent account. Using a subaccount makes it easier to segment, manage, and keep track of the account usages of each user independently.

POST https://api.plivo.com/v1/Account/{auth_id}/Subaccount/

Arguments

The following parameters are required to create a subaccount:

Parameter Description
name (mandatory) Name of the subaccount
enabled (optional) Specify if the subaccount should be enabled or not. Takes a value of True or False. Defaults to False

Response

HTTP Status Code: 201

{
    "api_id": "324a7dd8-0db2-11e4-8a4a-123140008edf",
    "auth_id": "SAMTVIYJDIYWYYMZHLYZ",
    "auth_token": "MTZjYWM0YzVjNjMwZmVmODFiNWJjNPJmOGJjZjgw",
    "message": "created"
}

Modify a Subaccount

If you would like to modify your subaccount, you could do so with this API. You can make changes to the name of the subaccount and specify whether to enable or disable it.

POST https://api.plivo.com/v1/Account/{auth_id}/Subaccount/{subauth_id}/

Arguments

The following arguments are required to modify your subaccount.

Parameter Description
name (mandatory) Name of the subaccount
enabled (optional) Specify if the subaccount should be enabled or not. Takes a value of True or False.

Response

{
  "message": "changed",
  "api_id": "5a9fcb68-523d-11e1-86da-6ff39efcb949"
}

Get Details of a Specific Subaccount

You can call this API to retrieve details of a subaccount like auth_id, auth_token, etc. Returns an object representing your Plivo subaccount.

GET https://api.plivo.com/v1/Account/{auth_id}/Subaccount/{subauth_id}/

Arguments

None

Response

HTTP Status Code: 200

{
    "account": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/",
    "api_id": "323972b2-0db3-11e4-a2d1-22000ac5040c",
    "auth_id": "SAMTVIYJDIYWYYMZHLYZ",
    "auth_token": "MTZjYWM0YzVjNjMwZmVmODFiNWJjNWJmOGJjZjgw",
    "created": "2014-07-17",
    "enabled": false,
    "modified": null,
    "name": "Chewbacca",
    "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Subaccount/SAMTVIYJDIYWYYMZHLYZ/"
}

Response Attributes

auth_id
string The auth ID of the subaccount.
auth_token
string The auth token of the subaccount.
created
string The date on which the subaccount was created.
enabled
boolean Status of the account if it is available.
name
string Name of the subaccount.

Get Details of all Subaccounts

You can get details of all subaccounts associated with your main Plivo account. We return a list of all subaccounts.

GET https://api.plivo.com/v1/Account/{auth_id}/Subaccount/

Arguments

Parameter Description
limit (optional) Used to display the number of results per page. The maximum number of results that can be fetched is 20.
offset (optional) Denotes the number of value items by which the results should be offset. Eg:- If the result contains a 1000 values and limit is set to 10 and offset is set to 705, then values 706 through 715 are displayed in the results. This parameter is also used for pagination of the results.

Response

HTTP Status Code: 200

{
    "api_id": "b38bf42e-0db4-11e4-8a4a-123140008edf",
    "meta": {
        "limit": 20,
        "next": null,
        "offset": 0,
        "previous": null,
        "total_count": 2
    },
    "objects": [
        {
            "account": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/",
            "auth_id": "SAMTVIYJDIYWYYMZHLYZ",
            "auth_token": "MTZjYWM0YzVjNjMwZmVmODFiNWJjNWJmOGJjZjgw",
            "created": "2014-07-17",
            "enabled": false,
            "modified": null,
            "name": "Chewbacca",
            "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Subaccount/SAMTVIYJDIYWYYMZHLYZ/"
        },
        {
            "account": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/",
            "auth_id": "SANJQ5NWEYNWZJNZE2MZ",
            "auth_token": "OTdhMjYwMWYxOGMyNpFjNzUwYWM3YWI3NjY4Y2Ey",
            "created": "2012-09-23",
            "enabled": true,
            "modified": "2012-09-23",
            "name": "new",
            "resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Subaccount/SANJQ5NWEYNWZJNZE2MZ/"
        }
    ]
}

Response Attributes

auth_id
string The auth ID of the subaccount.
auth_token
string The auth token of the subaccount.
created
string The date on which the subaccount was created.
enabled
boolean Status of the account if it is available.
modified
string Date on which the subaccount was last modified.
name
string Name of the subaccount

Delete a Subaccount

You can delete a subaccount with this API. This API would delete the subaccount and associate all Number, Endpoints and Applications (which are linked to the subaccount) to the main Plivo account.

DELETE https://api.plivo.com/v1/Account/{auth_id}/Subaccount/{subauth_id}/

Parameters

None

Response

HTTP Status Code: 204