Menu

Expand

This documentation is for the SendGrid Web API v2

To access all the latest features and upcoming developments, please see our v3 API.

Rate this page:

IP Management

List

Obtain a complete list of all IPs associated with your account and whether they are free, taken, or available.

URI Parameter Required Requirements Description
list Yes

Must be set to one of the following:
all free

taken

available

Will return the IPs on the account that match the argument

The list argument will restrict the IPs returned:

  • all: All IP addresses available on account, regardless of whether or not the IP is used by a subuser.
  • free: All free IP addresses for the account. IPs that are not in use by any subusers.
  • taken: All taken IP addresses for the account. IP addresses that are in use by one or more subusers.
  • available: All available IP addresses for the account including all free IP addresses. If a subuser is deactivated and assigned an IP, that IP will show up on this list since that IP address is not actually being used.

Call

POST https://api.sendgrid.com/apiv2/customer.ip.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&list=all

Response

[
  {
    "ip": "255.255.255.250"
  },
  {
    "ip": "255.255.255.251"
  },
  {
    "ip": "255.255.255.252"
  }
]

Call

POST https://api.sendgrid.com/apiv2/customer.ip.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&list=all

Response

<ips>
   <ip>255.255.255.250</ip>
   <ip>255.255.255.251</ip>
   <ip>255.255.255.252</ip>
</ips>

Subuser IP List

URI Parameter Required Requirements Description
task Yes Must be set to list Task to return the IPs in use by the subuser
user Yes Subuser must be under your account Subuser to get the IPs of

Call

POST https://api.sendgrid.com/apiv2/customer.sendip.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&task=list&user=subuser_username

Response

{
  "success": "success",
  "outboundcluster": "SendGrid MTA",
  "ips": [
    {
      "ip": "255.255.255.250"
    },
    {
      "ip": "255.255.255.251"
    },
    {
      "ip": "255.255.255.251"
    },
    {
      "ip": "255.255.255.252"
    },
    {
      "ip": "255.255.255.253"
    },
    {
      "ip": "255.255.255.254"
    }
  ]
}

Call

POST https://api.sendgrid.com/apiv2/customer.sendip.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&task=list&user=subuser_username

Response

<sendips>
   <ocluster>SendGrid MTA</ocluster>
   <ips>
      <ip>255.255.255.250</ip>
      <ip>255.255.255.251</ip>
      <ip>255.255.255.252</ip>
      <ip>255.255.255.253</ip>
      <ip>255.255.255.254</ip>
   </ips>
</sendips>

Subuser IP Assignment

You need to assign at least ONE IP to your subuser.

URI Parameter Required Requirements Description
task Yes Must be set to append Task to add ip to a subuser
user Yes Subuser must be under your account Subuser that is adding IPs
set Yes Must be either:
none all specify
none: Remove all ips.
all: Apply all possible ips to subuser.
specify: Specify the ips to the subser
ip[] No Must be a valid set of IPs (use the list call to determine valid IPs) If the set parameter is specify, then you must specify the IPs. Use the ip[] parameter to specify an IP: ip[]=255.255.255.0[]=255.255.255.1

Call

POST https://api.sendgrid.com/apiv2/customer.sendip.json
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&task=append&set=specify&user=subuser_username&ip[]=255.255.255.250&ip[]=255.255.255.255

Response

{
  "message": "success"
}

Call

POST https://api.sendgrid.com/apiv2/customer.sendip.xml
POST Data api_user=your_sendgrid_username&api_key=your_sendgrid_password&task=append&set=specify&user=subuser_username&ip[]=255.255.255.250&ip[]=255.255.255.255

Response

<result>
   <message>success</message>
</result>
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the SendGrid tag on Stack Overflow.

      
      
      

      Thank you for your feedback!

      We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

      Sending your feedback...
      🎉 Thank you for your feedback!
      Something went wrong. Please try again.

      Thanks for your feedback!

      Refer us and get $10 in 3 simple steps!

      Step 1

      Get link

      Get a free personal referral link here

      Step 2

      Give $10

      Your user signs up and upgrade using link

      Step 3

      Get $10

      1,250 free SMSes
      OR 1,000 free voice mins
      OR 12,000 chats
      OR more