List

Obtain a complete list of all IPs on your account and which are free, taken or available.

URI Parameter Required Requirements Description
list Yes Must be set to one of:
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.
Parameter Value Requirements Description

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

1
2
3
4
5
6
7
8
9
10
11
[
  {
    "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

1
2
3
4
5
<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
Parameter Value Requirements Description

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
  "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

1
2
3
4
5
6
7
8
9
10
<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
Parameter Value Requirements Description

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

1
2
3
{
  "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

1
2
3
<result>
   <message>success</message>
</result>