---
title: "Create campaign IP range targeting"
type: reference
method: POST
path: /rest-api/campaign/{campaignId}/targeting/ip-range/create.do
tag: "Targeting Rules"
---

# Create campaign IP range targeting

`POST https://YOUR-NETWORK-DOMAIN/rest-api/campaign/{campaignId}/targeting/ip-range/create.do`

Creates an IP range targeting rule for the specified campaign. Supports both IPv4 and IPv6 addresses. The ipFrom must be less than or equal to ipTo. Targeting is automatically enabled if it was previously disabled. Requires UPDATE permission on the campaign and MANAGE_DEMAND_TARGETING user permission.

## Path params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `campaignId` | integer | yes | `1234` | Unique numeric ID of the campaign |

## Form params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `ipFrom` | string | yes | `192.168.1.0` | Start of IP range |
| `ipTo` | string | yes | `192.168.1.255` | End of IP range |
| `rule` | string | yes | `INCLUDE` | Targeting rule type — INCLUDE for whitelist or EXCLUDE for blacklist |

## Responses

- `200` — Success
- `400` — Invalid IP range or ipFrom exceeds ipTo
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Campaign not found
- `500` — Internal server error

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/campaign/1234/targeting/ip-range/create.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'ipFrom=192.168.1.0' \
  --data-urlencode 'ipTo=192.168.1.255' \
  --data-urlencode 'rule=INCLUDE'
```

Source: https://epom.com/ad-server/docs/api/targeting-rules/post-campaign-targeting-ip-range-create