---
title: "Save Campaign Targeting Admin"
method: PUT
path: "/admin/campaigns/{campaign_id}/targeting"
tags: ["admin", "campaigns"]
---

# Save Campaign Targeting Admin

`PUT /admin/campaigns/{campaign_id}/targeting`

## Request

- Base URL: `https://api-docs.upsmith.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api-docs.upsmith.com/admin/campaigns/{campaign_id}/targeting`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer

Cross-org save of rule-builder wire groups.

Accepts the same wire shape the org ``PUT /campaigns/{id}/rules`` accepts,
converts groups → ``{rule_type_key, params, sort_order}`` and proxies to
campaign-service. The raw ``PUT /rules`` above is left untouched for callers
that already send converted rows. Legacy YAML campaigns 409 here so the
admin save can't persist rules the YAML engine never applies.

## Path parameters

- `campaign_id` string, required

## Headers

- `organization-id` string, nullable
- `timezone` string
- `x-user-id` string, nullable
- `x-actor-email` string, nullable
- `x-request-source` string, nullable
- `x-operation-id` string, nullable
- `x-commit-message` string, nullable
- `x-confirmation-id` string, nullable
- `x-chat-id` string, nullable

## Request body

- SaveCampaignTargetingBody: Full replacement rule set in the rule-builder's wire shape. Each entry is a rule group as produced by the frontend serializer (``source``, ``mode``, ``match``, ``filters``, optional ``groups`` / ``groups_match``) — the same shape ``targeting-preview`` accepts, so what the user previewed is exactly what gets persisted.
  - `rules` object[], required

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/upsmith/apis/upsmith-api.md) - [All operations](https://skmtc.dev/upsmith/apis/upsmith-api/llms.txt) - [OpenAPI document](https://skmtc.dev/upsmith/apis/upsmith-api/revisions/86e2c2bd93af?raw)
