Manage IP Addresses

Endpoints

Manage IP Addresses

The Manage IP Addresses endpoints let you view, add, and replace the CIDR ranges that are permitted to call the nHance API Endpoints for a given API key.

Early Access

IP whitelisting is currently in Early Access and is available for Enterprise clients only. Please contact our support team to enable this feature for your organization.

Endpoint Details

MethodURLDescription
GET/api/v1/list-ipsRetrieve all configured CIDR ranges for the API key
POST/api/v1/manage-ipsReplace the CIDR allowlist for the API key

Request Parameters

Headers

HeaderTypeRequiredDescription
X-Client-IdstringYesClient ID from the API keys page
X-Client-SecretstringYesClient secret from the API keys page
Content-TypestringYes (POST only)Must be application/json

Request Body (POST)

ParameterTypeRequiredDescription
ip_addressesarray of stringsYesList of IPv4 CIDR ranges

Validation Rules

  • Must be in CIDR notation (e.g., 8.8.8.8/32)
  • Must be a valid IPv4 address — IPv6 is not supported
  • CIDR prefix length must be between 0 and 32
  • Maximum of 5 CIDR ranges per API key
  • Private, loopback (127.x.x.x) & link-local (169.254.x.x) addresses are rejected

Request Examples

1. List associated CIDR ranges

2. Replace the CIDR allowlist

The POST endpoint replaces the current allowlist with the provided array. To add a single IP without losing existing ones, retrieve the current list first, append your new entry, and send the full combined array.

3. Remove specific CIDR ranges

Because POST replaces the entire allowlist, removing an entry is a read-then-write operation: fetch the current list, remove the unwanted entry, and POST the remaining entries.

The example below removes 198.51.100.0/24 while keeping 203.0.113.10/32.

4. Clear all CIDR ranges

Pass an empty array to POST to remove all IP restrictions from the key.

Removing all the IP restriction means that the request from any IP for that API key will be accepted.

Response Format

GET 200 OK

POST 200 OK

Error response

All errors follow the same envelope:

Response Fields

FieldTypePresent onDescription
client_idstringAllThe client ID used in the request
messagestringPOST onlyConfirmation of the action performed
ip_addressesarray of stringAllCurrent configured CIDR ranges after the operation
errorstringError responsesHuman-readable description of the error

Status and Error Codes

HTTP CodeMessage
200Request processed successfully
400ip_addresses is requiredip_addresses field is missing from the body
400Invalid CIDR format — entry is not valid CIDR notation
400Only IPv4 CIDR ranges are supported — IPv6 addresses are not accepted
400Maximum of 5 CIDR ranges allowed per API key
400CIDR range already exists — duplicate entry in a POST request
400Private IP addresses are not allowed — loopback, link-local, or RFC-1918 range
401X-Client-Id and X-Client-Secret are not valid
403IP filtering is not enabled for this organization
429Too many requests — see Rate Limits
500Internal server error
504API gateway timeout

Best Practices

Use the narrowest CIDR possible. A /32 pins enforcement to a single IP. Wider ranges like /16 or /8 increase your exposure surface.

Read before writing. The POST endpoint replaces the entire list. Always GET first, merge your changes locally, and then POST the full updated array. This avoids accidentally removing entries that were set by another process.

Keep the list minimal. Only add ranges that correspond to known egress IPs (e.g., your CI/CD runner, production NAT gateway). Remove stale entries when infrastructure changes.

Test with a non-production key first. Because a bad allowlist can lock out a key, validate your CIDR entries against the validation rules before applying them to a key used in production.

Next Steps