---
updatedAt: 2026-11-02T12:00:34.000Z
agentTools:
  projectIndex: https://developers.kaleyra.io/llms.txt
---

# Create a Subaccount

POST Method

Kaleyra.io offers an API that enables you to create sub-account. You can configure the entities of the sub-account while creating them. Also, you have the option to change later the entities of the sub-account based on your business requirements.

## Base URL

`https://<api_domain>/v1/<SID>`

## API Domain and Value

| api\_domain | Value             |
| :---------- | :---------------- |
| IN pod      | api.in.kaleyra.io |
| SG Pod      | api.ap.kaleyra.io |
| EU Pod      | api.eu.kaleyra.io |

## API request to create sub-account

To create a sub-account, use the `/subaccounts` endpoint with the following request method:

## Request Format

```curl
curl --location --request POST 'https://<api_domain>/api/v1/<sid>/subaccounts' \
--header 'api-key: <api-key>' \
--header 'Content-Type: <content-type>' \
--data-raw '{
    "account_name" : "<account-name>",
    "email" : "<email-address>",
    "is_invited" : <is-invited>,
    "country_iso_code": "<country-iso-code>",
    "channels" :["<channels>"],
    "subaccount_credit_type" : "<subaccount-credit-type>"
}'
```

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

<Table align={["left","left","left","left","left","left"]}>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Data Type
      </th>

      <th>
        Description
      </th>

      <th>
        Applicable
      </th>

      <th>
        Mandatory
      </th>

      <th>
        Example
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `sid`
      </td>

      <td>
        String
      </td>

      <td>
        Parent account SID (Security Identifier).
      </td>

      <td>
        Always applicable.
      </td>

      <td>
        Yes
      </td>

      <td>
        HXXXXXXX071IN
      </td>
    </tr>

    <tr>
      <td>
        `content-type`
      </td>

      <td>
        String
      </td>

      <td>
        The format in which the data is sent.
      </td>

      <td>
        Always applicable.
      </td>

      <td>
        Yes
      </td>

      <td>
        application/json
      </td>
    </tr>

    <tr>
      <td>
        `api-key`
      </td>

      <td>
        String
      </td>

      <td>
        Parent account API key.
      </td>

      <td>
        Always applicable.
      </td>

      <td>
        Yes
      </td>

      <td>
        Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3
      </td>
    </tr>

    <tr>
      <td>
        `account_name`
      </td>

      <td>
        String - only alphanumeric, no special characters
      </td>

      <td>
        Sub-account name.
      </td>

      <td>
        Always applicable.
      </td>

      <td>
        Yes
      </td>

      <td>
        John Doe
      </td>
    </tr>

    <tr>
      <td>
        `email_address`
      </td>

      <td>
        String - with valid email
      </td>

      <td>
        Sub-account user email address.
      </td>

      <td>
        Always applicable.
      </td>

      <td>
        Yes
      </td>

      <td>
        `[john.doe@kaleyra.com]`
      </td>
    </tr>

    <tr>
      <td>
        `is_invited`
      </td>

      <td>
        Boolean
      </td>

      <td>
        Identifier to send an invitation email to a sub-account user.

        * *True** - Invitation email will be sent to a sub-account user.
        * *False** - Invitation email will not be sent to a sub-account user.
      </td>

      <td>
        Always applicable.
      </td>

      <td>
        Yes
      </td>

      <td>
        True/False
      </td>
    </tr>

    <tr>
      <td>
        `country_iso_code`
      </td>

      <td>
        String - two-letter country ISO code.
      </td>

      <td>
        Country code for which you want to create Sub-account.
      </td>

      <td>
        Always applicable.
      </td>

      <td>
        Yes
      </td>

      <td>
        IN
      </td>
    </tr>

    <tr>
      <td>
        `channels`
      </td>

      <td>
        String
      </td>

      <td>
        Channels for which you want to give access to sub-account users. The supported channel is SMS.
      </td>

      <td>
        Always applicable.
      </td>

      <td>
        Yes
      </td>

      <td>
        sms
      </td>
    </tr>

    <tr>
      <td>
        `subaccount_credit_type`
      </td>

      <td>
        String
      </td>

      <td>
        Any one of the following Credit Types can be assigned to Subaccount:

        * *Assigned** - If you want to assign a specific credit amount to a sub-account.
        * *Shared** - If you want to share the usage with a sub-account.
      </td>

      <td>
        Always applicable.
      </td>

      <td>
        Yes
      </td>

      <td>
        assigned
      </td>
    </tr>

    <tr>
      <td>
        `low_balance_alert`
      </td>

      <td>
        Boolean
      </td>

      <td>
        Identifier to send low balance alerts to specified email addresses.
      </td>

      <td>
        Applicable only when `subaccount_credit_type` = assigned.
      </td>

      <td>
        No
      </td>

      <td>
        True/False
      </td>
    </tr>

    <tr>
      <td>
        `low_balance_limit`
      </td>

      <td>
        Number
      </td>

      <td>
        The threshold amount to send alert email if sub-account’s balance goes below it.
      </td>

      <td>
        Applicable only when `subaccount_credit_type` = assigned and `low_balance_alert` is true.
      </td>

      <td>
        No
      </td>

      <td>
        500
      </td>
    </tr>

    <tr>
      <td>
        `low_balance_emails`
      </td>

      <td>
        Array of strings
      </td>

      <td>
        The email addresses to which low balance alert is sent. You can add more than one email address separated by a comma (,).
      </td>

      <td>
        Applicable only when `subaccount_credit_type` = assigned and `low_balance_alert` is true.
      </td>

      <td>
        No
      </td>

      <td>
        `[jean.doe@kaleyra.com]`
      </td>
    </tr>

    <tr>
      <td>
        `initial_credit_amount`
      </td>

      <td>
        Number
      </td>

      <td>
        Initial credit amount you want to assign to the sub-account user.
      </td>

      <td>
        Applicable only when `subaccount_credit_type` = assigned.
      </td>

      <td>
        No
      </td>

      <td>
        1000
      </td>
    </tr>

    <tr>
      <td>
        `monthly_limit`
      </td>

      <td>
        Number
      </td>

      <td>
        The monthly limit you want to set for a sub-account user.
      </td>

      <td>
        Applicable only when a `Monthly_limit` is enabled for Parent account and when `subaccount_credit_type` = shared.
      </td>

      <td>
        No
      </td>

      <td>
        3000
      </td>
    </tr>

    <tr>
      <td>
        `ip_config_name`
      </td>

      <td>
        String
      </td>

      <td>
        The IP configuration created by Parent account. If passed in the request, by default it will be shared with sub-account and will be applied to the sub-account api_key as a whitelisted IP addresses/ranges.
      </td>

      <td>
        Applicable only if a parent is allowed to share `ip_config`.
      </td>

      <td>
        No
      </td>

      <td>
        test1
      </td>
    </tr>
  </tbody>
</Table>

## Sample Request

The following is the sample request:

```curl
curl --location --request POST 'https://api.in.kaleyra.io/api/v1/HXXXXXXX071IN/subaccounts' \
--header 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
--header 'Content-Type: application/json' \
--data-raw '{
    "account_name" : "John Doe",
    "email" : "john.doe@kaleyra.com",
    "is_invited" : True,
    "country_iso_code": "IN",
    "channels" :["sms"],
    "subaccount_credit_type" : "Assigned"
}'
```

## Sample Success Response

The following are the sample success response for different cases:

<Accordion title="When assigned credit type with low balance alert disabled" icon="fa-circle-user-circle-plus">
  ```json
  {
    "code": "RBC103",
    "message": "Request executed successfully",
    "data": {
      "account_name": "John Doe",
      "api_key": "A2XXXXXXXXXd888a1f851b65d6692f33",
      "balance": 0,
      "channels": [
        "sms"
      ],
      "email": "john.doe@tatacommunications.com",
      "low_balance_alert": false,
      "sid": "HXAXXXXXXXX394GL_117845",
      "status": "active",
      "subaccount_credit_type": "assigned"
    },
    "error": {},
    "status": 200
  }
  ```
</Accordion>

<Accordion title="When assigned credit type with low balance alert enabled" icon="fa-circle-user-circle-plus">
  ```json
  {
    "code": "RBC103",
    "message": "Request executed successfully",
    "data": {
      "account_name": "JOhn Doe",
      "api_key": "Aa3aXXXXXXXXXX564b6c97bc9fb4fb04b",
      "balance": 1,
      "channels": [
        "sms"
      ],
      "email": "john.doe@tatacommunications.com",
      "low_balance_alert": true,
      "low_balance_emails": "jean.doe@kaleyra.com",
      "low_balance_limit": 1,
      "sid": "HXAXXXXXXXX94GL_117846",
      "status": "active",
      "subaccount_credit_type": "assigned"
    },
    "error": {},
    "status": 200
  }
  ```
</Accordion>

<Accordion title="When shared credit type without monthly limit" icon="fa-circle-user-circle-plus">
  ```json
  {
    "code": "RBC103",
    "message": "Request executed successfully",
    "data": {
      "account_name": "JOhn Doe",
      "api_key": "A50aXXXXXXXXXX6e9590b82a2ca365688",
      "balance": 0,
      "channels": [
        "sms"
      ],
      "email": "john.doe@tatacommunications.com",
      "low_balance_alert": false,
      "sid": "HXAXXXXXXXXXX394GL_117848",
      "status": "active",
      "subaccount_credit_type": "shared"
    },
    "error": {},
    "status": 200
  }
  ```
</Accordion>

<Accordion title="When shared credit type with monthly limit" icon="fa-circle-user-circle-plus">
  ```json
  {
    "code": "RBC103",
    "message": "Request executed successfully",
    "data": {
      "account_name": "John Doe",
      "api_key": "A036XXXXXXXXXXec524ddd57c1429fc0e",
      "balance": 0,
      "channels": [
        "sms"
      ],
      "email": "john.doe@tatacommunications.com",
      "low_balance_alert": false,
      "monthly_limit": 5,
      "sid": "HXAXXXXXXXXXX4GL_117851",
      "status": "active",
      "subaccount_credit_type": "shared"
    },
    "error": {},
    "status": 200
  }
  ```
</Accordion>

## Sample Failure Response

The following is a sample failure response:

```json JSON
{
    "code": "RBC2320",
    "message": "Error Occured in Rbac Register Wrapper API",
    "data": {},
    "error": {
        "Subaccount": "Subaccount with the same name already exists"
    },
    "status": 400
}
```

For more information about response codes and statuses for creating sub-account, see [Response Codes and Statuses for Creating Subaccounts](https://developers.kaleyra.io/docs/platform-apis-response-codes-and-statuses#response-codes-and-statuses-for-creating-subaccounts).