Invite and Manage Sub-Accounts 

You can use the TextMagic SMS API to invite other people to become sub-accounts. You can also manage them as and when needed.

Sub-account roles

There are two types of sub-accounts: regular user and administrator.

  • A regular user sub-account allows the user to do everything except buy SMS credit and manage other sub-accounts.
  • An administrator sub-account has access to all features including buying SMS credit and managing other sub-accounts.

Only parent users and administrators can manage sub-accounts.

Get sub-accounts list

To get a list of all your sub-accounts, use:

GET /api/v2/subaccounts 

with the parameters:

Name
Required?
Example
Description
page No

3

Fetch the specified results page. The default is 1.

limit No 25 The number of results per page. The default is 10.

You will receive the standard paginated response:

Parameter
Example
Description
page 3 The current fetched page.
limit 25 The number of results per page.
pageCount 150 The total number of pages.
resources Array of user resources See Account section for details.

Get sub-account information

To get information about a single sub-account, use:

GET /api/v2/subaccounts/{id} 

where id is the numeric ID of a sub-account. Note, this command has no parameters.

The response format is the same as the user resource’s:

Parameter
Example
Description
id 305 Sub-account ID.
username charles.conway Username.
email charles@example.com User email address.
status

A

T

C

Current account status:

  • A for Active.
  • T for Trial.
  • C for Closed. Closed sub-accounts remain in your sub-accounts list.
balance 208.64 Account balance (in account currency).
currency currency resource See currency resource details in Account chapter.
firstName Charles Account first name.
lastName Conway Account last name.
company Example Ltd. Account company name.
subaccountType A

Type of current account:

  • P for Parent User
  • A for Administrator Sub-Account
  • U for Regular User
timezone timezone  See timezone details in the  Account section.

Invite a new sub-account

To invite someone to be a sub-account, use:

POST /api/v2/subaccounts

with the following parameters:

Name
Required?
Example
Description
email Yes

john@example.com

Invitation email will be sent to this email address.

role Yes A

Type of account:

  • A for Administrator sub-account
  • U for Regular User
company Yes Example Ltd. Account company name.

If successful, you’ll receive the standard 204 No Content response, otherwise the standard error response will be returned.

Close a sub-account

To close one of your sub-accounts use:

DELETE /api/v2/subaccounts/{id}

where id is the sub-account ID. Note, this command has no parameters. If successful, the standard delete response (204 No Content) will be returned.

The next step

Now you’ve learned how to manage sub-accounts via the TextMagic API, the next section will show you how to get Messaging statistics via API.