# Create a TikTok Ads campaign from an agent

Creating a TikTok Ads campaign takes two calls: `ads.validateCampaignPlan`, a dry run, then `ads.createCampaignPlan`, which leaves `operation_status: DISABLE` on the campaign, ad group, and ad. A signed-in workspace owner activates it in the web app; MCP refuses.

## What PubNio supports in a TikTok plan

Beyond a name, an objective, and a budget, a TikTok plan needs:

- `targets[].actorAccountId`: the connected TikTok account the ad posts as; TikTok receives its ID as the ad's identity. Without it the dry run answers `actor_required`.
- A plan budget, which goes on the ad group; without one the dry run answers `budget_required`.
- `creative.providerSettings.videoId` or `imageIds` on every ad; without either the dry run answers `creative_media_required`.

| Plan objective | TikTok receives |
| --- | --- |
| awareness, reach | `REACH` |
| engagement | `ENGAGEMENT` |
| leads | `LEAD_GENERATION` |
| sales | `PRODUCT_SALES` |
| conversions | `CONVERSIONS` |
| app_promotion | `APP_PROMOTION` |
| video_views | `VIDEO_VIEWS` |
| traffic, unknown | `TRAFFIC` |

## Spend controls

- `ads.validateCampaignPlan` compiles the plan and checks account readiness, capabilities, budget, currency, and the spend policy without calling the provider.
- Activating a campaign takes `confirmation: "activate_spend"` from a signed-in workspace owner in the web app; an API key or an MCP session gets 403 `human_actor_required`.

## 1. Validate the plan (dry run)

```http
POST /api/v1/ads/campaigns/validate?workspaceId=3d9a1f20-7c4b-4e8a-9f61-2b5c8d7e0a14
Authorization: Bearer <token>
Content-Type: application/json

{
  "name": "Cold brew video views",
  "objective": "video_views",
  "budget": {
    "amountMinor": 3000,
    "currency": "USD",
    "kind": "daily"
  },
  "targets": [
    {
      "accountId": "7f3c2a10-5b4e-4d6f-8a9b-0c1d2e3f4a5b",
      "actorAccountId": "2b8d9e10-4c5f-4a6b-9c7d-8e9f0a1b2c3d"
    }
  ],
  "adGroups": [
    {
      "name": "Coffee fans 18 to 34",
      "targeting": {
        "locationIds": [
          "6252001"
        ],
        "ageGroups": [
          "AGE_18_24",
          "AGE_25_34"
        ]
      },
      "ads": [
        {
          "name": "Pour over in 15 seconds",
          "creative": {
            "body": "Cold brew without the wait.",
            "destinationUrl": "https://coffee.example.com/cold-brew",
            "providerSettings": {
              "videoId": "v10044g50000cold7brew"
            }
          }
        }
      ]
    }
  ]
}
```

A ready account gets 200 with `valid: true` and no issues. TikTok's adapter checks every draft locally first.

## 2. Create it paused

Send the same plan with `Idempotency-Key: plan-tiktok-ads-1`: PubNio answers 202 `queued`, and `ads.getOperation` reports when every level exists paused. The same key with the same plan returns the same `planId`; with another plan it gets 400 `idempotency_conflict`.

## Limits

- PubNio does not check TikTok's ad group budget minimum before create.

## Related

- [TikTok Ads through PubNio](https://pubnio.com/ads/tiktok-ads)
- [All ad providers](https://pubnio.com/ads)
- API reference: [ads.createCampaignPlan](https://pubnio.com/docs/reference/ads-create-campaign-plan/)
- [TikTok error 40100](https://pubnio.com/docs/errors/tiktok/40100/)

