Validate a unified campaign plan with 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:
AdCampaignPlanValidationwithvalid,issues,targets.
The OpenAPI document has each field’s type.
Examples
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" } }],
},
],
});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 -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"}}]}]}'pnio ads validate-campaign-plan --file campaign-plan.jsonasync () => {
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 and most operations 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.