Skip to content

Activate one paused campaign

PubNio API ads.activateCampaign: activate one paused campaign. Request fields, examples in five clients, errors, and idempotency.

Activate one paused campaign with POST /api/v1/ads/accounts/{accountId}/campaigns/{campaignId}/activate. Requires a signed-in workspace owner, in the web app or the CLI; API keys are not accepted and MCP cannot call it. Send confirmation: "activate_spend".

Request

Requires the current expectedRevision, confirmation activate_spend, a configured monthly cap (an owner sets it with ads.updateSpendPolicy; without one the call returns AdSpendForbidden monthly_cap_required), a clear kill switch, and committed budgets within every cap. The provider call sets the campaign ACTIVE and reads it back, then resumes the campaign’s paused ad groups and ads, because providers create them paused and a campaign delivers only when every level is on. Each child re-checks the same gates. The operation result reports activatedAdGroups, activatedAds, and leftPaused; the status is partial when a child stayed paused, and an owner resumes it with ads.resumeAdGroup or ads.resumeAd. API keys cannot activate spend.

Parameter In Type Required
accountId path UUID Yes
campaignId path UUID Yes
workspaceId query UUID Yes
Body field Type Required
expectedRevision integer Yes
confirmation "activate_spend" Yes

Response

  • HTTP 202: AdOperation with id, accountId, kind, status, step, input, result, issues, attempts, canRetry, nextAction, createdAt, updatedAt, startedAt, completedAt.
    • kind: boost.create, campaign.create, campaign.activate, campaign.pause, campaign.archive, ad_group.status, ad_group.create, ad.status, ad.attach, creative.create, campaign.duplicate, budget.update
    • status: queued, preflight, creating, recording, reviewing, activating, succeeded, partial, failed, unresolved, cancelled
    • step: queued, preflight, create, record, review, activate, finish

The OpenAPI document has each field’s type.

Examples

const operation = await workspace.ads.activateCampaign(accountId, campaignId, {
  expectedRevision: 3,
  confirmation: "activate_spend",
});

Create this client with a signed-in person’s accessToken, not an apiKey.

The Python SDK authenticates with a workspace API key, which this operation does not accept, so it has no method for it.

curl -X POST "https://pubnio.com/api/v1/ads/accounts/$ACCOUNT_ID/campaigns/$CAMPAIGN_ID/activate?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_TOKEN" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"expectedRevision":3,"confirmation":"activate_spend"}'
pnio ads activate-campaign "$ACCOUNT_ID" "$CAMPAIGN_ID" --expected-revision 3 --confirmation activate_spend
async () => {
  const accountId = "<accountId>";
  const campaignId = "<campaignId>";
  // One key per intent; reuse it only to retry this same request.
  const idempotencyKey = crypto.randomUUID();
  const response = await codemode.request({
    method: "POST",
    path: `/api/v1/ads/accounts/${accountId}/campaigns/${campaignId}/activate`,
    query: { workspaceId: codemode.workspaceId },
    headers: { "Idempotency-Key": idempotencyKey },
    body: { expectedRevision: 3, confirmation: "activate_spend" },
  });
  return response.data;
};

Errors

It declares no problem of its own.

It declares the problems every Ads operation and most operations declare.

Idempotency

Required. A retry with the same Idempotency-Key returns the first result for 24 hours. Make one key per intent, such as crypto.randomUUID() or Python’s uuid4(), and reuse it only to retry the same request. The TypeScript SDK makes a key for each call unless you pass idempotencyKey. See Idempotency.

Limits

  • API keys and MCP cannot call it. A signed-in person runs it from the CLI after pnio auth login or in the web app.

Type to search…

↑↓ navigate↵ selectEsc close