|
| 1 | +--- |
| 2 | +seo: |
| 3 | + title: How to Create a Subuser with the API |
| 4 | + description: How to Create a Subuser with the API |
| 5 | + keywords: subuser, api, IP, account, new, create, /customer. |
| 6 | +title: How to Create a Subuser with the API |
| 7 | +weight: 0 |
| 8 | +layout: page |
| 9 | +zendesk_id: 201750787 |
| 10 | +navigation: |
| 11 | + show: true |
| 12 | +--- |
| 13 | + |
| 14 | +<center>Creating a new subuser through SendGrid's API is a multi-step process. This guide will walk you through the necessary steps in order to create a new subuser account using only API calls.</center> |
| 15 | + |
| 16 | +**1. Establish the New Subuser ** (required) |
| 17 | + |
| 18 | +With the [subuser creation API call](http://sendgrid.com/docs/API_Reference/Customer_Subuser_API/subusers.html) you will be able to establish the new subuser's account and profile settings. This call will create the new subuser account, however it does not apply the sending IP for the account, nor does it establish a whitelabel entry or enable website/SMTP access for the subuser. |
| 19 | + |
| 20 | +**Call Example: ** https://api.sendgrid.com/apiv2/customer.add.json?api\[email protected]&api\_key=xxxxxx&username=newsubuser\_username&website=yourdomain.com&password=newsubuser\_password&confirm\_password=newsubuser\_password&first\_name=Ryan&last\_name=Burrer&address=555\_anystreet&city=any\_city&state=CO&zip=80203&[email protected]&country=US&phone=555-5555 |
| 21 | + |
| 22 | +<center> |
| 23 | +<strong>Success Message<br></strong><img src="http://content.screencast.com/users/Ryan.Burrer/folders/Jing/media/5e355c42-487e-442a-bd2b-89c9d80dd7d0/00000094.png" alt=""><center><strong> <br>Failure Message<br></strong></center> |
| 24 | +<img src="http://content.screencast.com/users/Ryan.Burrer/folders/Jing/media/d8482205-976f-4f82-ad3a-77503e867c2f/00000095.png" alt=""> <strong><span class="wysiwyg-font-size-medium"><br><br></span></strong> |
| 25 | +</center> |
| 26 | + |
| 27 | +**2. Assign an IP to be Used by the New Subuser** (required) |
| 28 | + |
| 29 | +Now that you have created the new subuser account, you will need to [add an IP](http://sendgrid.com/docs/API_Reference/Customer_Subuser_API/ip_management.html#-Subuser-IP-Assignment) so that it can send emails. We advise that you first find an available IP for this subuser. You can do so by using the following call: |
| 30 | + |
| 31 | +**Call Example: ** https://api.sendgrid.com/apiv2/customer.ip.xml?api\[email protected]&api\_key=xxxxxx&list=all |
| 32 | + |
| 33 | +When defining the parameter 'list' there are a few options you can choose: |
| 34 | + |
| 35 | +- **All ** = Will list all of the IPs on your account, taken or available. |
| 36 | +- **Free ** = Will list all the free IPs on your account. For instance, if an IP is in use by a subuser or parent account then that IP will not be listed. |
| 37 | +- **Taken ** = Will list all of the IP addresses that are assigned to your parent and/or subuser accounts. |
| 38 | +- **Available ** = Will list all of the unassigned IP addresses for the account. If a subuser is deactivated _and it _is assigned an IP, that IP will show up on this list since that IP address is not technically in use. |
| 39 | +<center> |
| 40 | +<strong>Response Example<br></strong><img src="http://content.screencast.com/users/Ryan.Burrer/folders/Jing/media/0dc1923b-fff9-4446-aff1-5dcab41929a4/00000096.png" alt="" align="middle"> |
| 41 | +</center> |
| 42 | + |
| 43 | +After you have selected the IP that you wish to assign to your subuser account, simply make the API call to [append the IP address](http://sendgrid.com/docs/API_Reference/Customer_Subuser_API/ip_management.html#-Subuser-IP-Assignment). |
| 44 | + |
| 45 | +**Call Example: ** https://api.sendgrid.com/apiv2/customer.sendip.json?api\[email protected]&api\_key=xxxxxx&task=append&set=specify&user=newsubuser\_username&ip[]=255.255.255.250&ip []=255.255.255.255 |
| 46 | + |
| 47 | +When defining this call's 'set' parameter, you have a few options for appending the subuser's IP: |
| 48 | + |
| 49 | +- **None ** = removes all of the IPs on the associated account. |
| 50 | +- **All ** = applies all of the possible IPs to the account. |
| 51 | +- **Specify** = Specify the IPs to the subuser |
| 52 | +<center> |
| 53 | +<strong>Success Message</strong> |
| 54 | +<p class="wysiwyg-text-align-left"><img src="http://content.screencast.com/users/Ryan.Burrer/folders/Jing/media/5e355c42-487e-442a-bd2b-89c9d80dd7d0/00000094.png" alt="" align="middle"></p> |
| 55 | +<strong>Failure Message</strong> |
| 56 | +<p class="wysiwyg-text-align-left"><img src="http://content.screencast.com/users/Ryan.Burrer/folders/Jing/media/d8482205-976f-4f82-ad3a-77503e867c2f/00000095.png" alt="" align="middle"></p> |
| 57 | +</center> |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +**3. Assign a Whitelabel for the Subuser Account ** (optional) |
| 62 | + |
| 63 | +After you have created the subuser account and have appended an IP address, you are now ready to assign an _existing_ [whitelabel](https://sendgrid.zendesk.com/hc/en-us/articles/200548228-All-You-Need-to-Know-About-Whitelabeling) to the account. If you have not yet created the required records for whitelabeling for your chosen domain then this step should be skipped. Unfortunately, new whitelabel records cannot be established through API calls. |
| 64 | + |
| 65 | +First, you should find out what whitelabel entries you have associated with your account. This call will [list your available whitelabel domains](http://sendgrid.com/docs/API_Reference/Customer_Subuser_API/whitelabel.html#-List): |
| 66 | + |
| 67 | +**Call Example: ** https://api.sendgrid.com/apiv2/customer.whitelabel.json?api\[email protected]&api\_key=xxxxxx&task=list |
| 68 | + |
| 69 | +<center> |
| 70 | +<strong>Response Example</strong> |
| 71 | +<p class="wysiwyg-text-align-left"><img src="http://content.screencast.com/users/Ryan.Burrer/folders/Jing/media/9d491f57-d3c8-4376-a31d-a04b49590747/00000097.png" alt=""></p> |
| 72 | +</center> |
| 73 | + |
| 74 | +The API response above shows that email.sendgrid.com and email.example.com are both already established whitelabel entries, and can be used by this subuser. If none are displayed then the next step in this process should be skipped. |
| 75 | + |
| 76 | +If you have a whitelabel entry that you wish to apply to your subuser then you will need to [append the whitelabel entry](http://sendgrid.com/docs/API_Reference/Customer_Subuser_API/whitelabel.html#-Append) to your subuser: |
| 77 | + |
| 78 | +**Call Example: ** https://api.sendgrid.com/apiv2/customer.whitelabel.json?api\[email protected]&api\_key=xxxxxx&task=append&user=newsubuser\_username&mail\_domain=YOUR.ALREADY.EXISTING.WHITELABEL |
| 79 | + |
| 80 | +<center> |
| 81 | +<strong>Success Message</strong> |
| 82 | +<p class="wysiwyg-text-align-left"><img src="http://content.screencast.com/users/Ryan.Burrer/folders/Jing/media/5e355c42-487e-442a-bd2b-89c9d80dd7d0/00000094.png" alt="" align="middle"></p> |
| 83 | +<strong>Failure Message</strong> |
| 84 | +<p><img src="http://content.screencast.com/users/Ryan.Burrer/folders/Jing/media/d8482205-976f-4f82-ad3a-77503e867c2f/00000095.png" alt=""></p> |
| 85 | +</center> |
| 86 | + |
| 87 | +**4. Authenticating the Subuser to Have Website/SMTP Access ** (required) |
| 88 | + |
| 89 | +The final step in creating your new subuser requires you to simply [activate the subuser](http://sendgrid.com/docs/API_Reference/Customer_Subuser_API/authenticate_a_subuser.html) account so that they have website and SMTP access. |
| 90 | + |
| 91 | +**Call Example: ** https://api.sendgrid.com/apiv2/customer.auth.json?api\[email protected]&api\_key=xxxxxx&user=newsubuser\_username&password=newsubuser\_password |
| 92 | + |
| 93 | +<center> |
| 94 | +<strong>Success Message</strong> |
| 95 | +<p><img src="http://content.screencast.com/users/Ryan.Burrer/folders/Jing/media/5e355c42-487e-442a-bd2b-89c9d80dd7d0/00000094.png" alt="" align="middle"></p> |
| 96 | +<strong>Failure Message</strong> |
| 97 | +<p><img src="http://content.screencast.com/users/Ryan.Burrer/folders/Jing/media/d8482205-976f-4f82-ad3a-77503e867c2f/00000095.png" alt=""></p> |
| 98 | +</center> |
| 99 | +<center> |
| 100 | +<br><strong>That's All, Folks!</strong> |
| 101 | +</center> |
| 102 | + |
| 103 | +If you have followed all of these steps then you have just created a new subuser using the Subuser API. Give yourself a high five! |
| 104 | + |
| 105 | +But wait, there's more... |
| 106 | + |
| 107 | +Now that you have created a new subuser you can change the [Event Notification URL](http://sendgrid.com/docs/API_Reference/Customer_Subuser_API/event_notification_url.html), the subuser's enabled [apps](http://sendgrid.com/docs/API_Reference/Customer_Subuser_API/apps.html), and even set [account limits](http://sendgrid.com/docs/API_Reference/Customer_Subuser_API/account_limits.html) for the subuser. |
| 108 | + |
| 109 | +<center> |
| 110 | +<p> </p> |
| 111 | +</center> |
| 112 | + |
| 113 | + |
0 commit comments