---
title: "Create campaign API JSON field targeting"
type: reference
method: POST
path: /rest-api/campaign/{campaignId}/targeting/api-json-field/create.do
tag: "Targeting Rules"
---

# Create campaign API JSON field targeting

`POST https://YOUR-NETWORK-DOMAIN/rest-api/campaign/{campaignId}/targeting/api-json-field/create.do`

Creates an API JSON field targeting rule. Requires UPDATE permission on the campaign, MANAGE_DEMAND_TARGETING user permission and API_JSON_FIELD targeting permission (TARGETING_API_JSON_FIELD).

## Path params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `campaignId` | integer | yes | `1234` | Unique numeric ID of the campaign |

## Form params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `apiUrl` | string | yes | `https://api.example.com/data` | URL of the API endpoint to query |
| `jsonField` | string | yes | `user.status` | JSON field path to evaluate |
| `jsonFieldValue` | string | yes | `active` | Expected JSON field value |
| `rule` | string | yes | `INCLUDE` | Targeting rule type |

## Responses

- `200` — Success
- `400` — Invalid targeting value
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Campaign not found
- `500` — Internal server error

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/campaign/1234/targeting/api-json-field/create.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'apiUrl=https://api.example.com/data' \
  --data-urlencode 'jsonField=user.status' \
  --data-urlencode 'jsonFieldValue=active' \
  --data-urlencode 'rule=INCLUDE'
```

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