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: ["1.1.1.1", "2.2.2.2"],
9
region: "global",
10
include_region: true,
11
};
12
13
const request = {
14
url: `/v3/subusers`,
15
method: "POST",
16
body: data,
17
};
18
19
client
20
.request(request)
21
.then(([response, body]) => {
22
console.log(response.statusCode);
23
console.log(response.body);
24
})
25
.catch((error) => {
26
console.error(error);
27
});

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.