Add IPs
The Twilio SendGrid IP Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts' IPs. This API is for companies that have a formal reseller partnership with Twilio SendGrid.
You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio SendGrid Subusers feature, which is available with Pro and Premier plans.
The IP Provisioning API IP operations allow you to add, list, and remove IPs from customer accounts.
The Add IPs operation allows you to provision and add one or more IP addresses to a customer account. The Add IPs operation requires a JSON request body specifying the number of IPs to provision and the region where they should be provisioned.
The request body contains two required fields:
count: The number of IP addresses to provision and add to the customer account. You can add between 1 and 10 IP addresses per request.region: The geographic region where the IP addresses should be provisioned. Valid values areeu(Europe) orus(United States). All IP addresses in a single request must be from the same region.
The account_id parameter in the URL path identifies the customer account to which the IP addresses will be added. This account ID is the Twilio SendGrid account ID that was returned when the customer account was created. You should have this ID stored in your database for managing customer accounts.
The response to a successful Add IPs operation returns a 201 Created status code. The response body contains an array of the provisioned IP addresses and the region where they are located.
POST/v3/partners/accounts/{accountID}/ips
Base url: https://api.sendgrid.com (for global users and subusers)
Base url: https://api.eu.sendgrid.com (for EU regional subusers)
Adds IP(s) to the specified account.
Bearer <<YOUR_API_KEY_HERE>>Twilio SendGrid account ID
application/jsonNumber of IPs to add (maximum 10 per request)
1Maximum: 10The region where the IPs should be provisioned (all IPs in a single request must be from the same region)
euusCreated
Optional
Optional
The region where the IP addresses are located
euus1const client = require("@sendgrid/client");2client.setApiKey(process.env.SENDGRID_API_KEY);34const accountID = "accountID";5const data = {6count: 2,7region: "us",8};910const request = {11url: `/v3/partners/accounts/${accountID}/ips`,12method: "POST",13body: data,14};1516client17.request(request)18.then(([response, body]) => {19console.log(response.statusCode);20console.log(response.body);21})22.catch((error) => {23console.error(error);24});
1const client = require("@sendgrid/client");2client.setApiKey(process.env.SENDGRID_API_KEY);34const accountID = "accountID";5const data = {6count: 2,7region: "us",8};910const request = {11url: `/v3/partners/accounts/${accountID}/ips`,12method: "POST",13body: data,14};1516client17.request(request)18.then(([response, body]) => {19console.log(response.statusCode);20console.log(response.body);21})22.catch((error) => {23console.error(error);24});