---
title: "Create a new rule"
type: reference
method: POST
path: /rest-api/rule/create.do
tag: "Targeting Rules"
---

# Create a new rule

`POST https://YOUR-NETWORK-DOMAIN/rest-api/rule/create.do`

Creates a new targeting rule in the system. The request body must be a JSON object containing the rule's name, type (CAMPAIGN or INVENTORY), active status, default-for flags, and an optional ruleMatches array. Each rule match specifies categories (AdvertisingCategory IDs for CAMPAIGN type, PublisherCategory IDs for INVENTORY type), label IDs, a logical operator (AND/OR), and an include/exclude flag. Returns a JSON object with 'success: true' and the newly created 'ruleId', or validation errors if the input is invalid. Requires authentication and CREATE permission on the RULES static ACL identity.

## Body

A JSON body. An example, built from the field definitions:

```json
{
  "id": "200",
  "name": "Block Adult Content",
  "active": "true",
  "type": "CAMPAIGN"
}
```

## Responses

- `200` — Rule created successfully
- `400` — Missing name or type, or a rule match naming unknown categories or labels (per-field errors)
- `401` — Unauthorized - authentication error
- `403` — Forbidden - insufficient permissions
- `500` — Internal server error

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/rule/create.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "id": "200",
  "name": "Block Adult Content",
  "active": "true",
  "type": "CAMPAIGN"
}'
```

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