Skip to contentSkip to navigationSkip to topbar
On this page

Create Subuser



API Overview

api-overview page anchor

For more information about Subusers, visit the longform Subusers documentation. You can also manage Subusers in the SendGrid console(link takes you to an external page).


POST/v3/subusers

Base url: https://api.sendgrid.com (for global users and subusers)

Base url: https://api.eu.sendgrid.com (for EU regional subusers)

This endpoint allows you to create a new subuser.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Encoding type:application/json
SchemaExample
Property nameTypeRequiredDescriptionChild properties
usernamestringrequired

The username for this subuser.


emailstring<email>required

The email address of the subuser.


passwordstringrequired

The password this subuser will use when logging into SendGrid.


ipsarray[string<ipv4>]required

The IP addresses that should be assigned to this subuser.


regionenum<string>Optional

The region this Subuser should be assigned to. Can be global or eu. (Regional email is in Public Beta and requires SendGrid Pro plan or above.).

Default: globalPossible values:
globaleu

include_regionbooleanOptional

A flag that determines if the Subuser's region should be returned in the response. (Regional email is in Public Beta and requires SendGrid Pro plan or above.)

Default: false
200400401403500
SchemaExample
Property nameTypeRequiredDescriptionChild properties
usernamestring

The username of the subuser.


user_idnumber

The user ID for this subuser.


emailstring<email>

The email address for this subuser.


credit_allocationobject

regionenum<string>

The region this Subuser is assigned to. The property is returned only if the include_region parameter is included and set to true in the API request.

Default: globalPossible values:
globaleu
Create SubuserLink to code sample: Create Subuser
1
const client = require('@sendgrid/client');
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const data = {
5
"username": "John@example.com",
6
"email": "John@example.com",
7
"password": "johns_password",
8
"ips": [
9
"1.1.1.1",
10
"2.2.2.2"
11
],
12
"region": "global",
13
"include_region": true
14
};
15
16
const request = {
17
url: `/v3/subusers`,
18
method: 'POST',
19
body: data
20
}
21
22
client.request(request)
23
.then(([response, body]) => {
24
console.log(response.statusCode);
25
console.log(response.body);
26
})
27
.catch(error => {
28
console.error(error);
29
});

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.