# Validate campaign targeting `POST /platform/v1/campaigns/validate-targeting` Validate a campaign's targeting without persisting anything. `200` means the targeting would be accepted and returns the scope it resolves to right now — every catalog, channel, surface and Intent it can serve, enumerated; `422` lists every problem in `exception_details.problems`, each with a stable `code`, its `dimension` and the offending `values`. `match` and `rules` are not checked. ## Request example ```bash curl --request POST \ --url 'https://api.eu1.luigisbox.ai/platform/v1/campaigns/validate-targeting' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "catalog_ids": [ "example" ], "catalog_tags": [ "example" ], "channel_ids": [ "example" ], "channel_tags": [ "example" ], "intents": [ "search" ], "organization_id": "example", "surface_ids": [ "example" ], "surface_tags": [ "example" ] }' ``` ## Request Body **Required.** ### application/json Schema: `object` #### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `catalog_ids` | `Array` | No | Catalog Ids | — | | `catalog_tags` | `Array` | No | Catalog Tags | — | | `channel_ids` | `Array` | No | Channel Ids | — | | `channel_tags` | `Array` | No | Channel Tags | — | | `intents` | `Array` | No | Surface Intents this campaign targets — the kind of discovery it applies to. Empty means **every** Intent, not none. Narrowing by Intent is mutually exclusive with narrowing by `surface_ids` / `surface_tags`: an Intent targets whole families of surfaces, so combining the two is rejected with `intents_conflict`. A targeted Intent no scoped catalog hosts a surface for is rejected with `catalog_without_targeted_intent` — it could never trigger. | — | | `organization_id` | `string` | Yes | Organization Id | — | | `surface_ids` | `Array` | No | Surface Ids | — | | `surface_tags` | `Array` | No | Surface Tags | — | #### Request body example ```json { "catalog_ids": [ "example" ], "catalog_tags": [ "example" ], "channel_ids": [ "example" ], "channel_tags": [ "example" ], "intents": [ "search" ], "organization_id": "example", "surface_ids": [ "example" ], "surface_tags": [ "example" ] } ``` ## Responses | Status | Description | Content | |---|---|---| | `200` | Successful Response | application/json: object | | `401` | Missing or invalid credentials | application/json: object | | `403` | Authenticated but not permitted | application/json: object | | `422` | Request validation failed. A targeting rejection lists every problem at once in `exception_details.problems`. | application/json: anyOf(object, object) | ### 200 Successful Response #### application/json Schema: `object` ##### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `effective_scope` | `object` | Yes | What a campaign's targeting resolves to right now, fully enumerated.

Explicit picks are unioned with the picked tags' **current** members and resolved against
the catalogs, channels and surfaces that exist at read time. That makes this what the
campaign is *meant* to cover rather than what it is covering: a dimension narrowed by a
tag serves the members that tag held when the campaign was last saved, so after a tag edit
this reports the new members while serving still follows the old ones until the campaign
is saved again.

A dimension with no reference at all widens to its universe — all catalogs of the
organization, all channels and surfaces of those catalogs. An empty list therefore means
the campaign targets **nothing** in that dimension, with one exception spelled out for
``channel_ids`` below.
``intents`` is derived from ``surfaces`` rather than echoing the stored array: a
campaign whose targeted surface was deleted reports no surfaces and no Intents.

A channel referenced explicitly, or through a channel tag, is always listed in
``channel_ids``. A campaign that narrows by no channel is unrestricted by channel at
request time, whatever ``channel_ids`` reports. | — | | `effective_scope.catalog_ids` | `Array` | Yes | Catalog Ids | — | | `effective_scope.channel_ids` | `Array` | Yes | The channels the campaign narrows to, excluding each catalog's implicit default channel. Empty therefore means it narrows to no channel you created, not that it reaches none: a campaign that does not narrow by channel is dispatched to every channel of its catalogs. | — | | `effective_scope.intents` | `Array` | Yes | The distinct Intents of `surfaces`, sorted — **derived** at read time, never the stored targeting echoed back. A campaign whose targeted surface has since been deleted reports no surfaces and no Intents. | — | | `effective_scope.surfaces` | `Array` | Yes | Surfaces | — | | `effective_scope.surfaces[].catalog_id` | `string` | Yes | Catalog Id | — | | `effective_scope.surfaces[].surface_id` | `string` | Yes | Surface Id | — | ##### Response example ```json { "effective_scope": { "catalog_ids": [ "example" ], "channel_ids": [ "example" ], "intents": [ "search" ], "surfaces": [ { "catalog_id": "example", "surface_id": "example" } ] } } ``` ### 401 Missing or invalid credentials #### application/json Schema: `object` ##### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `exception_details` | `object` | No | Machine-readable error context; empty object when there is nothing to add. | — | | `exception_details.validation_errors` | `anyOf(Array, null)` | No | Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value. | — | | `exception_details.validation_errors[].loc` | `Array` | Yes | Path to the offending value from the request root, e.g. `["body", "filters", 0, "operator"]`. | — | | `exception_details.validation_errors[].msg` | `string` | Yes | What is wrong with the value at `loc`. | — | | `exception_details.validation_errors[].type` | `string` | Yes | Stable machine code for the problem, e.g. `missing` or `string_too_short`. | — | | `exception_details.*` | `any` | No | Additional property. | — | | `reason` | `string` | Yes | Human-readable, actionable error message. | — | | `request_id` | `anyOf(string, null)` | No | Request correlation ID (matches the X-Request-Id response header). | — | ##### Response example ```json { "exception_details": { "validation_errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ] }, "reason": "example", "request_id": "example" } ``` ### 403 Authenticated but not permitted #### application/json Schema: `object` ##### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `exception_details` | `object` | No | Machine-readable error context; empty object when there is nothing to add. | — | | `exception_details.validation_errors` | `anyOf(Array, null)` | No | Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value. | — | | `exception_details.validation_errors[].loc` | `Array` | Yes | Path to the offending value from the request root, e.g. `["body", "filters", 0, "operator"]`. | — | | `exception_details.validation_errors[].msg` | `string` | Yes | What is wrong with the value at `loc`. | — | | `exception_details.validation_errors[].type` | `string` | Yes | Stable machine code for the problem, e.g. `missing` or `string_too_short`. | — | | `exception_details.*` | `any` | No | Additional property. | — | | `reason` | `string` | Yes | Human-readable, actionable error message. | — | | `request_id` | `anyOf(string, null)` | No | Request correlation ID (matches the X-Request-Id response header). | — | ##### Response example ```json { "exception_details": { "validation_errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ] }, "reason": "example", "request_id": "example" } ``` ### 422 Request validation failed. A targeting rejection lists every problem at once in `exception_details.problems`. #### application/json Schema: `anyOf(object, object)` ##### Attributes | Attribute | Type | Required | Description | Constraints | |---|---|---|---|---| | `exception_details` | `object` | Yes | The ``exception_details`` of a rejected targeting set: every problem found at once. | — | | `exception_details.problems` | `Array` | Yes | Every targeting violation found in one pass; never truncated. | — | | `exception_details.problems[].code` | `string` | Yes | Stable machine code of the violated rule. | allowed values: catalog_scope_required, intents_conflict, catalog_not_in_organization, channel_not_in_organization, tag_not_found, tag_dimension_mismatch, surface_not_in_catalog_scope, catalog_without_targeted_surface, channel_outside_catalog_scope, catalog_without_targeted_intent | | `exception_details.problems[].dimension` | `string` | Yes | The targeting axis the violation is about. | allowed values: catalog, channel, surface, intent | | `exception_details.problems[].message` | `string` | Yes | Human-readable explanation of the violation. | — | | `exception_details.problems[].values` | `Array` | Yes | The offending values on that axis. | — | | `reason` | `string` | Yes | Human-readable, actionable error message. | — | | `request_id` | `anyOf(string, null)` | No | Request correlation ID (matches the X-Request-Id response header). | — | | `exception_details.validation_errors` | `anyOf(Array, null)` | No | Every field-level problem found in the request, when validation is what failed. Absent when the rejection is not about a specific value. | — | | `exception_details.validation_errors[].loc` | `Array` | Yes | Path to the offending value from the request root, e.g. `["body", "filters", 0, "operator"]`. | — | | `exception_details.validation_errors[].msg` | `string` | Yes | What is wrong with the value at `loc`. | — | | `exception_details.validation_errors[].type` | `string` | Yes | Stable machine code for the problem, e.g. `missing` or `string_too_short`. | — | | `exception_details.*` | `any` | No | Additional property. | — | ##### Response example ```json { "exception_details": { "problems": [ { "code": "catalog_scope_required", "dimension": "catalog", "message": "example", "values": [ "example" ] } ] }, "reason": "example", "request_id": "example" } ```