Accounts

Managing Twilio accounts is straightforward. Update your own account information or create and manage multiple subaccounts.

For more information, see the Account REST Resource documentation.

Updating Account Information

Use the Account.update() to modify one of your accounts. Right now the only valid attribute is friendly_name.

require 'twilio-ruby'

# To find these visit https://www.twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXX"
auth_token = "YYYYYYYYYYYYYYYYYY"

@client = Twilio::REST::Client.new account_sid, auth_token
@account = @client.accounts.get(account_sid)
@account.update(friendly_name: "My Awesome Account")

Creating Subaccounts

Subaccounts are easy to make.

require 'twilio-ruby'

# To find these visit https://www.twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXX"
auth_token = "YYYYYYYYYYYYYYYYYY"

@client = Twilio::REST::Client.new account_sid, auth_token
@subaccount = @client.accounts.create(name: "My Awesome SubAccount")

Managing Subaccounts

Say you have a subaccount for Client X with an account sid AC123

require 'twilio-ruby'

# To find these visit https://www.twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXX"
auth_token = "YYYYYYYYYYYYYYYYYY"

@client = Twilio::REST::Client.new account_sid, auth_token

# Client X's subaccount
@subaccount = @client.accounts.get('AC123')

Client X hasn’t paid you recently, so let’s suspend their account.

@subaccount.update(status: 'suspended')

If it was just a misunderstanding, reenable their account.

@subaccount.update(status: 'active')

Otherwise, close their account permanently.

@subaccount.update(status: 'closed')

Warning

This action can’t be undone.