Delete a Subaccount

DELETE Method

Kaleyra.io offers an API that enables you to delete sub-account associated with a parent account. Deleting a sub-account can impact the tasks associated with it. For example, a scheduled campaign will be terminated.

If you delete a Subaccount the associated credit balance (if any) will be reverted to the parent account.

Base URL

<https://api.kaleyra.io>

To delete a sub-account, perform the following steps:

API request to delete sub-account

To delete a sub-account, use the /subaccounts/<subaccount_sid> endpoint with the following request method:

Request Format

curl --location --request DELETE '<url>/api/v1/<sid>/subaccounts/<subaccount_sid>' \
--header 'api-key: <api-key>' \
--data-raw ''

The following table describes the parameter used for deleting sub-account:

ParameterData TypeDescriptionApplicableMandatoryExample
sidStringParent account SID (Security Identifier).Always applicable.YesHXXXXXXX071IN
subaccount_sidStringSubaccount SID (Security Identifier).Always applicable.YesHXXXXXXX071IN_1707
api-keyStringParent account API key.Always applicable.YesAxxxxxxxxxxxxxxxxxxxxxxxxxxxx3

Sample Request

The following is the sample request:

curl --location --request DELETE 'https://api.kaleyra.io/api/v1/HXXXXXXX071IN/subaccounts/HXXXXXXX071IN_1707' \
--header 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
--data-raw ''

Sample Success Response

The following is the sample success response for deleting the sub-account:

{
    "code": "RBC2347",
    "message": "Account deleted successfully!",
    "data": {
        "account_name": "John Doe1",
        "email": "[email protected]",
        "status": "deleted",
        "sid": "HXXXXXXX071IN_1707",
        "api_key": "Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3"
        "channels": [
            "sms"
        ],
        "low_balance_alert": false,
        "subaccount_credit_type": "assigned",
        "balance": 0
    },
    "error": {},
    "status": 200
}

Sample Failure Response

The following is a sample failure response:

{
    "code": "RBC422",
    "message": "Access Denied! Unauthorized action!",
    "data": {},
    "error": {},
    "status": 401
}

For more information about response codes and statuses for deleting sub-account, see Response Codes and Statuses for Deleting Subaccounts.