> For the complete documentation index, see [llms.txt](https://startbutton.gitbook.io/startbutton-product-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://startbutton.gitbook.io/startbutton-product-api/security/ip-whitelisting.md).

# IP Whitelisting

## IP Whitelisting

This security feature limits access to a system or network exclusively to approved IP addresses. By rejecting requests from non-whitelisted IPs, it enhances protection against unauthorized access.

**To Get Started:**

| Header        | Value                            |
| ------------- | -------------------------------- |
| Authorization | `Bearer {{MERCHANT_AUTH_TOKEN}}` |
| Content-type  | `application/json`               |

> To generate `{{MERCHANT_AUTH_TOKEN}}`: Log in to your account via the API.

Make a request to the URL below. See [Environments & Base URLs](/startbutton-product-api/getting-started/environments-and-base-urls.md) for the base URL.

**Endpoint:** `PATCH` - `{{baseUrl}}/merchant/ip-whitelist/configure`

Add your IP(s) to be whitelisted just as in the sample request below.

**Sample Request:**

```json
{
    "whitelistedIps": ["127.0.0.1"],
    "password": "@mypassword"
}
```

**Sample Response:**

```json
{
    "success": true,
    "message": "Whitelisted IPs updated successfully",
    "data": {
        "whitelistedIps": [
            "127.0.0.1"
        ]
    }
}
```

> **Note:** Once you whitelist your IP, the system validates the IP address in your request for all endpoints that require a PRIVATE/SECRET\_KEY Authorization. If it's invalid, the request will fail.

If a request is made with a non-whitelisted IP address, you get the response below:

**403 Error:**

```json
{
    "message": "Access denied: IP not whitelisted",
    "success": false
}
```
