---
title: "Validate a unified campaign plan"
description: "PubNio API ads.validateCampaignPlan: validate a unified campaign plan. Request fields, examples in five clients, errors, and idempotency."
---

> Documentation Index
> Fetch the complete documentation index at: https://pubnio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate a unified campaign plan

Validate a unified campaign plan with [`POST /api/v1/ads/campaigns/validate`](https://pubnio.com/api/v1/docs#tag/ads/POST/api/v1/ads/campaigns/validate). Requires an API key with the `read` scope or a signed-in workspace member.

## Request

Compiles one workspace campaign plan into per-target paused trees. Checks account readiness, provider capabilities, budget, currency, actor, media, schedule, and spend policy. Never calls a provider or reserves spend.

| Parameter     | In    | Type | Required |
| ------------- | ----- | ---- | -------- |
| `workspaceId` | query | UUID | Yes      |

| Body field         | Type                           | Required |
| ------------------ | ------------------------------ | -------- |
| `name`             | string                         | Yes      |
| `objective`        | one of 10 strings              | Yes      |
| `budget`           | AdBudget                       | No       |
| `schedule`         | AdSchedule                     | No       |
| `targets`          | array of AdCampaignPlanTarget  | Yes      |
| `adGroups`         | array of AdCampaignPlanAdGroup | Yes      |
| `providerSettings` | object                         | No       |

## Response

- HTTP 200: `AdCampaignPlanValidation` with `valid`, `issues`, `targets`.

The [OpenAPI document](https://pubnio.com/api/v1/openapi) has each field's type.

## Examples

### TypeScript

```ts
const validation = await workspace.ads.validateCampaignPlan({
  name: "Spring sale",
  objective: "traffic",
  targets: [{ accountId }],
  adGroups: [
    {
      name: "Returning visitors",
      ads: [{ name: "Spring sale ad", creative: { headline: "Spring sale" } }],
    },
  ],
});
```

### Python

```python
validation = workspace.ads.validate_campaign_plan(
    name="Spring sale",
    objective="traffic",
    targets=[{"accountId": account_id}],
    ad_groups=[
        {
            "name": "Returning visitors",
            "ads": [
                {
                    "name": "Spring sale ad",
                    "creative": {
                        "headline": "Spring sale",
                        "destinationUrl": "https://example.com/spring",
                    },
                },
            ],
        },
    ],
)
```

### cURL

```sh
curl -X POST "https://pubnio.com/api/v1/ads/campaigns/validate?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Spring sale","objective":"traffic","targets":[{"accountId":"'"$ACCOUNT_ID"'"}],"adGroups":[{"name":"Returning visitors","ads":[{"name":"Spring sale ad","creative":{"headline":"Spring sale","destinationUrl":"https://example.com/spring"}}]}]}'
```

### CLI

```sh
pnio ads validate-campaign-plan --file campaign-plan.json
```

### MCP execute

```js
async () => {
  const accountId = "<accountId>";
  const response = await codemode.request({
    method: "POST",
    path: "/api/v1/ads/campaigns/validate",
    query: { workspaceId: codemode.workspaceId },
    body: {
      name: "Spring sale",
      objective: "traffic",
      targets: [{ accountId: accountId }],
      adGroups: [
        {
          name: "Returning visitors",
          ads: [
            {
              name: "Spring sale ad",
              creative: {
                headline: "Spring sale",
                destinationUrl: "https://example.com/spring",
              },
            },
          ],
        },
      ],
    },
  });
  return response.data;
};
```

## Errors

It declares no problem of its own.

It declares the problems [every Ads operation](https://pubnio.com/docs/reference/#ads) and [most operations](https://pubnio.com/docs/reference/#shared-problems) declare.

## Idempotency

No key, so a retried `POST` is not deduplicated. Read the current state before you retry.

## Limits

- Field lengths and ranges are in the [OpenAPI document](https://pubnio.com/api/v1/openapi).

## Related

- [Ads operations](https://pubnio.com/docs/reference/#ads)

Source: https://pubnio.com/docs/reference/ads-validate-campaign-plan/index.mdx
