---
title: "Update a placement's content replacement rule"
type: reference
method: POST
path: /rest-api/placements/{placementId}/content-replacement/{ruleId}/update.do
tag: "Placements"
---

# Update a placement's content replacement rule

`POST https://YOUR-NETWORK-DOMAIN/rest-api/placements/{placementId}/content-replacement/{ruleId}/update.do`

Changes one rule as editing a row of the placement's Content replacement card does. A field not sent keeps its value; an empty 'replacement' makes the rule delete its target from the markup. A new 'target' follows the create rules: not blank, up to 255 characters, not a target another rule of the placement already has. Requires the PLACEMENT_CONTENT_REPLACEMENT permission and update rights on the placement's site. Parameters that were sent but not applied are listed in 'ignoredFields', each with its reason in 'ignoredFieldReasons'.

## Path params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `placementId` | integer | yes | `4001` | Placement id |
| `ruleId` | integer | yes | `51` | Rule id, as the list returns it |

## Form params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `replacement` | string | no | `https://cdn.northwind.example/` | What every occurrence of the target becomes; may contain macros such as $$RANDOM$$. Empty or omitted on create removes the target from the markup. |
| `target` | string | no | `http://cdn.northwind.example/` | The exact text to find in every ad markup the placement serves — literal, no wildcards or regex; up to 255 characters, unique within the placement. Required on create. |

## Responses

- `200` — Rule updated: {success, placementId, rule:{id, target, replacement}}
- `400` — Field errors under 'errors': target blank, too long or already used; replacement too long
- `401` — Authentication error
- `403` — The role lacks PLACEMENT_CONTENT_REPLACEMENT, or no update rights on the placement's site
- `404` — The placement does not exist or is deleted, or it has no rule with this id

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/placements/4001/content-replacement/51/update.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'replacement=https://cdn.northwind.example/' \
  --data-urlencode 'target=http://cdn.northwind.example/'
```

Source: https://epom.com/ad-server/docs/api/placements/post-placements-content-replacement-update