Skip to contentSkip to navigationSkip to topbar
On this page

Assign a Batch of Subusers to an IP



API Overview

api-overview page anchor

The IP Address Management API combines functionality that was previously split between the Twilio SendGrid IP Address API and IP Pools API. This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. More details about each operation can be found in the descriptions and schemas for each endpoint.

(information)

Info

(warning)

Warning

The IP Address Management API is in public beta at this time. This means the API and documentation are still in development and subject to change without advanced notice.


POST/v3/send_ips/ips/{ip}/subusers:batchAdd

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

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

This operation appends a batch of Subusers to a specified IP address. This endpoint requires all Subuser assignments to succeed. If a Subuser assignment fails, this endpoint will return an error.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
ipstringrequired

The ip path parameter specifies an IP address to make the request against.

Encoding type:application/json
SchemaExample
Property nameTypeRequiredDescriptionChild properties
subusersarray[string]required

An array of Subuser IDs to be assigned to the specified IP address. All Subuser assignments must succeed.

200400401500

OK

SchemaExample
Property nameTypeRequiredDescriptionChild properties
ipstring

The IP address the Subusers were assigned to.


subusersarray[string]

An array of Subuser IDs that were assigned to the specified IP address.

Assign a Batch of Subusers to an IPLink to code sample: Assign a Batch of Subusers to an IP
1
const client = require('@sendgrid/client');
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const ip = "ZGkrHSypTsudrGkmdpJJ";
5
const data = {
6
"subusers": [
7
"12345",
8
"67890"
9
]
10
};
11
12
const request = {
13
url: `/v3/send_ips/ips/${ip}/subusers:batchAdd`,
14
method: 'POST',
15
body: data
16
}
17
18
client.request(request)
19
.then(([response, body]) => {
20
console.log(response.statusCode);
21
console.log(response.body);
22
})
23
.catch(error => {
24
console.error(error);
25
});