IP Management

List

全IPアドレスのリストを取得します。アドレスの種類(未使用、使用中、利用可能)を取得することができます。

URI引数 必須 条件 説明
list Yes 以下のいずれか:
all free taken available
引数に指定したアカウントで利用可能なIPアドレスを返します

listパラメータの簡単な説明を以下に示します:

  • all: アカウントで利用可能な全てのIPアドレスです。サブユーザによってIPアドレスが使用中か否かによらず取得します。
  • free: アカウントで利用可能な全ての未使用IPアドレスです。サブユーザが使用中の場合、リストには含まれません。
  • taken: アカウントで使用中の全てのIPアドレスです。サブユーザが使用中の場合のみリストに含まれます。
  • available: 未使用IPアドレスを含むアカウントで利用可能な全てのIPアドレスです。無効化されたサブユーザにIPアドレスが割り当てられていた場合、そのIPアドレスは誰も使用していないためリストに含まれます。
Parameter Value Requirements Description
1
3050497759

Call

POST https://api.sendgrid.com/apiv2/customer.ip.json
POST Data api_user=apikey&api_key=your_sendgrid_api_key&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=apikey&api_key=your_sendgrid_api_key&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引数 必須 条件 説明
task Yes listを指定します サブユーザによって使用されているIPアドレスを取得します
user Yes 親アカウント配下に登録されているサブユーザ IPアドレスを取得するサブユーザ
Parameter Value Requirements Description
1
2862950808

Call

POST https://api.sendgrid.com/apiv2/customer.sendip.json
POST Data api_user=apikey&api_key=your_sendgrid_api_key&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=apikey&api_key=your_sendgrid_api_key&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

サブユーザに対して少なくとも一つのIPアドレスを割り当てる必要があります。

URI引数 必須 条件 説明
task Yes appendを指定します 指定したサブユーザにIPアドレスを追加します
user Yes 親アカウント配下に登録されているサブユーザ IPアドレスを追加するサブユーザ
set Yes 以下のいずれか:
none all specify
none: 全てのIPアドレスを削除します。
all: 全てのIPアドレスを割り当てます。
specify: 指定したIPアドレスを割り当てます。適切なIPアドレスである必要があります(適切なIPアドレスはList APIで取得します)
ip[] No IPアドレスの配列 setパラメータの値がspecifyの場合、ip[]パラメータを使用してIPアドレスを指定する必要があります: ip[]=255.255.255.0[]=255.255.255.1
Parameter Value Requirements Description
1
9348659679

Call

POST https://api.sendgrid.com/apiv2/customer.sendip.json
POST Data api_user=apikey&api_key=your_sendgrid_api_key&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=apikey&api_key=your_sendgrid_api_key&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>