---
title: "Add rules group to campaign"
type: reference
method: POST
path: /rest-api/rules/campaign/{campaignId}/add.do
tag: "Targeting Rules"
---

# Add rules group to campaign

`POST https://YOUR-NETWORK-DOMAIN/rest-api/rules/campaign/{campaignId}/add.do`

Creates a new targeting rules group and associates it with the specified campaign. A rules group bundles one or more individual rules together with a logical operator (AND/OR) and an include/exclude flag that determines whether matching traffic is allowed or blocked. The response JSON contains 'success: true' and a 'ruleGroupId' field with the newly created group's ID. Requires UPDATE permission on the campaign's advertiser share and CAMPAIGN_RULES_MANAGEMENT permission. POST only: a GET answers 405, since a state change over GET can be triggered by a prefetch or an embedded link.

## Path params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `campaignId` | integer | yes | `1234` | The unique numeric identifier of the campaign to add the rules group to |

## Form params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `ruleIds` | array<integer> | yes | `200` | Array of rule IDs to include in the new rules group (at least one required) |
| `include` | boolean | yes | `true` | Whether the rules group is an inclusion (true) or exclusion (false) filter |
| `operator` | string | yes | `AND` | Logical operator for combining rules within the group: AND (all must match) or OR (any must match) |

## Responses

- `200` — Rules group added successfully
- `400` — Bad request - ruleIds is empty or names a rule that does not exist
- `401` — Unauthorized - authentication error
- `403` — Forbidden - insufficient permissions
- `404` — Campaign not found

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/rules/campaign/1234/add.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'ruleIds=200' \
  --data-urlencode 'include=true' \
  --data-urlencode 'operator=AND'
```

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