Skip to contentSkip to navigationSkip to topbar
On this page

Account Provisioning API Overview


The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid.

You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio SendGrid Subusers feature, which is available with Pro and Premier plans(link takes you to an external page).


Authentication and authorization

authentication-and-authorization page anchor

The Account Provisioning API uses standard Twilio Sendgrid API Keys for authentication and authorization. Once onboarded as a reseller, any API keys you create will have access to the Account Provisioning API. Twilio SendGrid recommends creating an Admin API key to manage your Account Provisioning API account. An Admin key is also known as a Full Access key in the Twilio SendGrid user interface(link takes you to an external page).

If you are new to Twilio SendGrid API keys, see the API key docs to create an API key. The Twilio SendGrid v3 APIs expect the key to be passed as a Bearer Token in an Authorization header. See How to Use the SendGrid v3 API for instructions.


The following documentation refers to the owner of an Account Provisioning API account as the reseller. The accounts a reseller owns and manages through this API are referred to as customer accounts. The operations available are provided to you, the reseller, in order to manage your customer accounts.


The Twilio SendGrid Account Provisioning API allows you to create and manage your customers' accounts. This page provides an overview of the most common operations a reseller will perform:

  • Creating a customer account.
  • Understanding account state.
  • Managing customer account offerings.
  • Deactivating and removing account resources.
  • Authenticating customers with single sign-on (SSO).

For information about the other Account Provisioning API operations available, see the API reference documentation for each operation.

Creating a new customer account

creating-a-new-customer-account page anchor

Creating a new customer account is done with a single POST operation that will return the unique Twilio SendGrid account ID for the newly created account. The Create Account operation requires a JSON request body containing a profile object and an array of offerings objects.

Profile object

profile-object page anchor

The profile object contains a customer's identity information such as their first_name, last_name, and email. The fields in the profile object are optional — the customer will be prompted at their first login to enter any profile information you choose not to include when creating the account. See the API reference for all profile fields.

The offerings array contains offering objects that list the offering's name, type, and quantity. The offerings array is required, and it defines the Twilio SendGrid features or offerings available to the customer's account. The offerings available will depend on your agreement with Twilio SendGrid.

To retrieve a list of all the offerings that you can assign to a customer account, use the List Offerings endpoint. Because the available offerings will change infrequently, you may wish to cache the List Offerings response rather than call the endpoint before each account creation or update. A new account may start on any email offering at any price point. Upgrades and downgrades are also available immediately after account provisioning.

Account creation request payload and response

account-creation-request-payload-and-response page anchor

The following JSON block shows a common request body used to create a new customer account.

1
{
2
"profile": {
3
"first_name": "Jane",
4
"last_name": "Doe",
5
"company_name": "Cake or Pie Bakery",
6
"company_website": "www.example.com",
7
"email": "jdoe@example.com",
8
"phone": "+15555555555",
9
"timezone": "Asia/Tokyo"
10
},
11
"offerings": [
12
{
13
"name": "milne.ei.pro-100k.v1",
14
"type": "package",
15
"quantity": 1
16
}
17
]
18
}

The response to a new account creation is the Twilio Sendgrid account ID. This account ID is used in all subsequent calls to the Account Provisioning API, so you should record it in your database for future use.

1
{
2
"account_id": "sg2a2bcd3ef4ab5c67d8efab91c01de2fa"
3
}

Creating a new customer test account

creating-a-new-customer-test-account page anchor

To create a new customer test account with Account Provisioning API, you must pass in a custom header as follows:

T-Test-Account: true

A test account will not be allocated a dedicated IP and will be limited to sending 100 email per day irrespective of the offerings used to create the account. An account not created as a test account using this custom header cannot be updated to be a test account.

Working with account state

working-with-account-state page anchor

A customer account can be in one of five states, activated, deactivated, suspended, banned, or indeterminate*. Setting the customer account state is done with a single PUT operation using one of these states. Retrieving the customer account state is done with a single GET operation that will return the state for the account. The following table shows the actions available to an account based on its state.

Table of account states and immediately affected actions

ACCOUNT STATELOGINSEND MAILSUBUSERS REMOVEDDEDICATED IPS REMOVEDAPI KEYS DEACTIVATED
Activatedyesyesnonono
Suspendedyesnononono
Deactivatednonononoyes
Bannednonoyesyesyes

* If you find an account in the indeterminate state, please contact Twilio SendGrid support(link takes you to an external page) for assistance.

Managing customer account offerings

managing-customer-account-offerings page anchor

Once a customer account is created, the most common need is to upgrade or downgrade the account to a different email package, otherwise known as an "offering." In addition to common email infrastructure offerings, your partner organization may have "add-on" offerings available including features such as Marketing Campaigns, Dedicated IP Addresses, and Expert Services.

Changing an account's offerings is done with a single PUT operation requiring a JSON request body that contains an offerings array of offering objects.

Because the update operation is a PUT request, you can remove offerings by omitting them from the update request. This means you must also pass the endpoint any offerings you want the account to retain — each operation overwrites the existing offerings for the account entirely. To retrieve a list of all the offerings you may assign to a customer account, use the List Offerings endpoint. To see a list of the offerings currently assigned to an individual customer account, use the Get Account Offerings endpoint.

Update offerings request payload examples

update-offerings-request-payload-examples page anchor
Add package offering
add-package-offering page anchor
1
{
2
"offerings": [
3
{
4
"name": "milne.ei.pro-100k.v1",
5
"type": "package",
6
"quantity": 1
7
}
8
]
9
}
Update an account to have two dedicated IP addresses
update-an-account-to-have-two-dedicated-ip-addresses page anchor
1
{
2
"offerings": [
3
{
4
"name": "milne.ei.pro-100k.v1",
5
"type": "package",
6
"quantity": 1
7
},
8
{
9
"name": "milne.x.ip.v2",
10
"type": "addon",
11
"quantity": 2
12
}
13
]
14
}
Downgrade an account to one dedicated IP address
downgrade-an-account-to-one-dedicated-ip-address page anchor
1
{
2
"offerings": [
3
{
4
"name": "milne.ei.pro-100k.v1",
5
"type": "package",
6
"quantity": 1
7
},
8
{
9
"name": "milne.x.ip.v2",
10
"type": "addon",
11
"quantity": 1
12
}
13
]
14
}
On a subsequent call, remove all dedicated IP addresses from the account
on-a-subsequent-call-remove-all-dedicated-ip-addresses-from-the-account page anchor
1
{
2
"offerings": [
3
{
4
"name": "milne.ei.pro-100k.v1",
5
"type": "package",
6
"quantity": 1
7
}
8
]
9
}
(warning)

Warning

When removing an IP Address offering, the Account Provisioning API will remove the most recently added IP address from the account. Generally speaking, mail is evenly distributed across all IP addresses, and this is the recommended methodology by Twilio Sendgrid support. If you would like to remove a specific IP address, please contact support directly(link takes you to an external page).

Change offering response

change-offering-response page anchor

The response to a change offering request is the account's resulting offerings list, which is identical to what will be returned on subsequent calls to the Get Account Offerings endpoint.

Deactivating and removing account resources

deactivating-and-removing-account-resources page anchor

You can deactivate a customer account using the Update Account State operation to set the account state to deactivated.

1
{
2
"state": "deactivated"
3
}

You can remove features such as Subusers and Dedicated IP addresses from a customer account using the Update Account Offerings operation. Update the account with a free offerings payload.

Typical free offerings payload

typical-free-offerings-payload page anchor
1
{
2
"offerings": [
3
{
4
"name": "milne.ei.free-100.v1",
5
"type": "package",
6
"quantity": 1
7
}
8
]
9
}

Once a customer account is created, the reseller can trigger a login to the Twilio Sendgrid UI for the customer with no password needed.

Account Provisioning API SSO authentication flow.

In addition to providing a seamless customer experience for accessing the Twilio Sendgrid UI, our Account Provisioning SSO also removes the need for a Sendgrid-based username and password. The reseller can manage their customers' authentication credentials without sharing any of that information with Twilio SendGrid.

The redirect generated as part of this flow contains a one-time authorization code used to log the user into the Twilio SendGrid UI. This one-time code is good 60 seconds and can be used for login once, ensuring that any type of man-in-the-middle or replay attack can be securely blocked.

SSO will authenticate the customer as an Admin Teammate, with all the permissions to manage any aspect of the customer's account. From there, they can take all the usual steps of setting up API keys, creating additional teammates or subusers, and configuring their sender identity.

This SSO flow is limited to authentication on the base Admin Teammate. It cannot be used for SSO on a subsequently created teammate or subuser.

(warning)

Warning

The Account Provisioning API does not currently support Twilio SendGrid's SAML-based SSO offering for customer accounts. All Teammates belonging to a customer account will authenticate with a username and password managed through Twilio SendGrid.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.