IP Access Management

IP Access Management

IP Access Managementは接続元IPアドレスベースのアクセス制限を行うためのエンドポイントです。

Activity

IPアクセス履歴に関連したリソースです。このエンドポイントはWebまたはAPI経由でアカウントにアクセスしたIPアドレスのリストを返します。

Retrieve all recent access attempts [GET]

URI引数 必須 条件 説明
limit No number 結果を取得する件数。デフォルト値:20.
Example: 20

Request

1
GET https://api.sendgrid.com/v3/access_settings/activity?limit={limit} HTTP/1.1

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
HTTP/1.1 200
{
  "result": [
    {
      "allowed": false,
      "auth_method": "basic",
      "first_at": 1444087966,
      "ip": "1.1.1.1",
      "last_at": 1444406672,
      "location": "Australia"
    },
    {
      "allowed": false,
      "auth_method": "basic",
      "first_at": 1444087505,
      "ip": "1.2.3.48",
      "last_at": 1444087505,
      "location": "Mukilteo, Washington"
    }
  ]
}

Rules

Allow List関連のリソースです。Allow ListはWeb、APIまたはメール送信にアクセス可能なIPアドレスを制限します。

Retrieve a list of currently allowed IPs [GET]

Allow Listに登録されたIPアドレスを取得します。

Request

1
GET https://api.sendgrid.com/v3/access_settings/whitelist HTTP/1.1

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
HTTP/1.1 200
{
  "result": [
    {
      "id": 1,
      "ip": "192.168.1.1/32",
      "created_at": 1441824715,
      "updated_at": 1441824715
    },
    {
      "id": 2,
      "ip": "192.168.1.2/32",
      "created_at": 1441824715,
      "updated_at": 1441824715
    },
    {
      "id": 3,
      "ip": "192.168.1.3/32",
      "created_at": 1441824715,
      "updated_at": 1441824715
    }
  ]
}

Add one or more IPs to the allow list [POST]

Allow ListにIPアドレスを追加します。

Request

1
POST https://api.sendgrid.com/v3/access_settings/whitelist HTTP/1.1
Request Body
1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "ips": [
    {
      "ip": "192.168.1.1"
    },
    {
      "ip": "192.*.*.*"
    },
    {
      "ip": "192.168.1.3/32"
    }
  ]
}

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
HTTP/1.1 201
{
  "result": [
    {
      "id": 1,
      "ip": "192.168.1.1/32",
      "created_at": 1441824715,
      "updated_at": 1441824715
    },
    {
      "id": 2,
      "ip": "192.0.0.0/8",
      "created_at": 1441824715,
      "updated_at": 1441824715
    },
    {
      "id": 3,
      "ip": "192.168.1.3/32",
      "created_at": 1441824715,
      "updated_at": 1441824715
    }
  ]
}

Remove one or more IPs from the allow list [DELETE]

Allow ListからIPアドレスを削除します。

Request

1
DELETE https://api.sendgrid.com/v3/access_settings/whitelist HTTP/1.1
Request Body
1
2
3
4
5
6
7
{
  "ids": [
    1,
    2,
    3
  ]
}

Response

1
HTTP/1.1 204

Retrieve a specific allowed IP [GET]

Allow Listに登録されたIPアドレスを取得します。

Request

1
GET https://api.sendgrid.com/v3/access_settings/whitelist/{rule_id} HTTP/1.1

Response

1
2
3
4
5
6
7
HTTP/1.1 200
{
  "id": 1,
  "ip": "192.168.1.1",
  "created_at": 1441824715,
  "updated_at": 1441824715
}

Remove a specific IP from the allowed list [DELETE]

Allow Listに登録されたIPアドレスを削除します。

Request

1
DELETE https://api.sendgrid.com/v3/access_settings/whitelist/{rule_id} HTTP/1.1

Response

1
HTTP/1.1 204