IP Access Management

IP Access Management is a set of endpoints to control IP whitelisting.

Activity

Resources related to IP access history. This will return a list of IPs that have accessed the user's account through the web or API.

History Collection [GET]

URI Parameter Required Requirements Description
limit No number Number of IP activity entries to return. Defaults to 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

Resources related to IP whitelisting. IP whitelisting allows users to specify IPs that can access the user's account through the web, API, or mail send.

Get Whitelisted IPs [GET]

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 Whitelisted IPs [POST]

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
    }
  ]
}

Delete Whitelisted IPs [DELETE]

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

Get Whitelisted IP [GET]

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
}

Delete Whitelisted IP [DELETE]

Request

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

Response

1
HTTP/1.1 204