Skip to contentSkip to navigationSkip to topbar
Rate this page:
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

This endpoint allows you to create a new subuser.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
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 Subuser

create-subuser page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_29
const client = require('@sendgrid/client');
_29
client.setApiKey(process.env.SENDGRID_API_KEY);
_29
_29
const data = {
_29
"username": "John@example.com",
_29
"email": "John@example.com",
_29
"password": "johns_password",
_29
"ips": [
_29
"1.1.1.1",
_29
"2.2.2.2"
_29
],
_29
"region": "global",
_29
"include_region": true
_29
};
_29
_29
const request = {
_29
url: `/v3/subusers`,
_29
method: 'POST',
_29
body: data
_29
}
_29
_29
client.request(request)
_29
.then(([response, body]) => {
_29
console.log(response.statusCode);
_29
console.log(response.body);
_29
})
_29
.catch(error => {
_29
console.error(error);
_29
});


Rate this page: