---
title: "Update an existing rule"
type: reference
method: POST
path: /rest-api/rule/{ruleId}/update.do
tag: "Targeting Rules"
---

# Update an existing rule

`POST https://YOUR-NETWORK-DOMAIN/rest-api/rule/{ruleId}/update.do`

Updates an existing targeting rule identified by its numeric ID. The request body is a JSON object with the fields to update: name, type, active status, default-for flags, and an optional ruleMatches array. Missing fields in the request body are populated from the existing rule's values, allowing partial updates. In ruleMatches, a match sent by id changes only the fields it carries, a match without id is added, and the rule's matches the request does not list stay (remove one with matches/remove); an id that is not one of this rule's matches is refused with 400 and nothing changes. Duplicate rule match entries are rejected with a validation error. Returns a JSON object with 'success: true' on success, or validation error details. Requires authentication and UPDATE permission on the RULES static ACL identity.

## Path params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `ruleId` | integer | yes | `200` | The unique numeric identifier of the rule to update |

## 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 updated successfully
- `400` — A ruleMatches id that is not one of this rule's matches
- `401` — Unauthorized - authentication error
- `403` — Forbidden - insufficient permissions
- `404` — Rule not found
- `500` — Internal server error

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/rule/200/update.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-update