---
title: "Set campaign frequency capping"
type: reference
method: POST
path: /rest-api/campaign/{campaignId}/frequency-capping/set.do
tag: "Capping"
---

# Set campaign frequency capping

`POST https://YOUR-NETWORK-DOMAIN/rest-api/campaign/{campaignId}/frequency-capping/set.do`

Creates a new frequency capping rule for a campaign, limiting how many times an ad impression is shown within a time window. A new capping record is always created (multiple rules can coexist for different subject types). The response JSON contains the newly created capping record ID in the 'id' field. Requires UPDATE permission and the MANAGE_CAPPING_AND_LIMITATIONS privilege; using IP or LES_IP subjects requires additional CAPPING_SUBJECT_IP / CAPPING_SUBJECT_LES_IP permissions.

## Path params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `campaignId` | integer | yes | `2001` | Numeric ID of the campaign to configure frequency capping for |

## Form params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `period` | integer | yes | `24` | Length of the capping time window, expressed in units defined by periodType (e.g. 24 when periodType is HOUR means 24 hours) |
| `periodType` | string | yes | `HOUR` | Unit of the capping period. Allowed values: SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, YEAR |
| `amount` | integer | no | `1000` | Maximum number of impressions allowed within the specified period. Optional; if omitted the capping has no amount limit. |
| `evenDistribution` | boolean | no | `true` | When true, impressions are distributed evenly across the period instead of being served as fast as possible |
| `subject` | string | no | `USER_COOKIE` | Entity used to identify unique users for capping. Defaults to USER_COOKIE if omitted. Allowed values: USER_COOKIE, USER_SERVER_SIDE, USER_MIXED, IP, LES_IP |

## Responses

- `200` — Frequency capping set successfully
- `400` — Invalid request parameters
- `401` — Authentication error
- `403` — Not enough permissions
- `404` — Campaign not found

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/campaign/2001/frequency-capping/set.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'period=24' \
  --data-urlencode 'periodType=HOUR' \
  --data-urlencode 'amount=1000' \
  --data-urlencode 'evenDistribution=true' \
  --data-urlencode 'subject=USER_COOKIE'
```

Source: https://epom.com/ad-server/docs/api/capping/post-campaign-frequency-capping-set