Account

The following actions can be performed with the Account APIs:

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

Get Account Details

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

Response

The API sends back the following response:

HTTP Status:200

JSON:
{
  "cash_credits": "1000.00000",
  "state": "",
  "recharge_choices": "stripe",
  "plan": {
    "voice_rate": "0.00400",
    "messaging_rate": "0.00140",
    "name": "evangelist",
    "monthly_cloud_credits": "1000.00000"
  },
  "gw_type": "plivo",
  "address": "",
  "cloud_credits": "100000.00000",
  "cps_allowed": -1,
  "auth_id": "MAGWNTM3ZTK1M2YZMDYUU",
  "city": "",
  "name": "Mike account",
  "created": "2011-10-26",
  "enabled": true,
  "modified": "2012-02-04",
  "timezone": "UTC",
  "billing_mode": "prepaid",
  "auto_recharge": true,
  "api_id": "a0ed83b2-5828-11e1-86da-6ff39efcb949",
  "resource_uri": "/v1/Account/MAGWNTM3ZTK1M2YZMDUU/"
}

Modify an Account

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

Optional Parameters

Parameter Description
name Change account name
city Change city name
address Change address

Response

HTTP Status: 202

JSON:
{
  "message": "changed",
  "api_id": "73421724-5829-11e1-86da-6ff39efcb949"
}

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.

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

Parameters

The following parameters are required to create a subaccount:

Required Parameters

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

Response

HTTP Status: 201

JSON:
{
  "auth_token": "NzczYzBhZjFkMzRiNzRlM2JiNThlNzU0YjI0YTdk",
  "message": "created",
  "api_id": "2ff24d8e-2d2d-11e2-bd72-12314001783b",
  "auth_id": "SAOWUYZTYYYTM2MWNLMJ"
}

Modify a Subaccount

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

Parameters

The following parameters are required to modify your subaccount.

Required Parameters

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

Response

HTTP Status: 202

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

Get Details Of a Specific Subaccount

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

Parameters

The following parameters are required to get the details of a specific subaccount.

Required Parameters

Parameter Description
subauth_id Id of the subaccount for which the details are required.

The following optional parameters can be specified:

Optional Parameters

Parameter Description
limit Used to display the number of results per page. The maximum number of results that can be fetched is 20.
offset 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: 200

JSON:
{
  "meta": {
    "previous": null,
    "total_count": 1,
    "offset": 0,
    "limit": 20,
    "next": null
  },
  "api_id": "0e8551a6-582a-11e1-86da-6ff39efcb949",
  "objects": [{
    "account": "/v1/Account/MAGWNTM3ZTK1M2YZMDUU/",
    "name": "sub test",
    "created": "2012-02-04",
    "auth_token": "NzczYzBhZjFkMzRiNzRlM2JiNThlNzU0YjI0YTdk"
    "enabled": true,
    "modified": "2012-02-04",
    "api_id": "68485a54-2fe2-11e2-8b13-123140016ef1",
    "auth_id": "SAZJIWMJK2MJIXOGQZII",
    "resource_uri": "/v1/Account/MAGWNTM3ZTK1M2YZMDYX/Subaccount/SAZJIWMJK2MJIXOGQZII/"
  }]
}

Get Details Of All Subaccounts

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

Parameters

This API does not have any mandatory parameters. The following optional parameters can be specified:

Optional Parameters

Parameter Description
limit Used to display the number of results per page. The maximum number of results that can be fetched is 20.
offset 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: 200

JSON:
{
  "meta": {
    "previous": null,
    "total_count": 1,
    "offset": 0,
    "limit": 20,
    "next": null
  },
  "api_id": "0e8551a6-582a-11e1-86da-6ff39efcb949",
  "objects": [{
    "account": "/v1/Account/MAGWNTM3ZTK1M2YZMDUU/",
    "name": "sub test",
    "created": "2012-02-04",
    "enabled": true,
    "modified": "2012-02-04",
    "auth_id": "SAZJIWMJK2MJIXOGQZII",
    "resource_uri": "/v1/Account/MAGWNTM3ZTK1M2YZMDYX/Subaccount/SAZJIWMJK2MJIXOGQZII/"
  }]
}

Delete a Subaccount

The following API is used to delete a subaccount.

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

Parameters

None

Response

HTTP Status: 204

Asynchronous Mode

All Plivo APIs can be invoked in asynchronous mode with the inclusion of the callback_url parameter. Note: In asynchronous mode, you will only get back a response with the api_id. The response is sent to the callback_url which is fired immediately after execution of the Plivo API. See API Request and API Response for more information.

Asynchronous Parameters

Parameter Description
callback_url The URL that is notified by the API when the response is available and to which the response is sent.
callback_method The method used to notify the callback_url URL. Defaults to POST.

Asynchronous Response

The Asynchronous Response is sent in json format in the response field.

See the API Response section for more information.