Skip to content

Create a paused Facebook Page post boost

PubNio API ads.createBoost: create a paused Facebook Page post boost. Request fields, examples in five clients, errors, and idempotency.

Create a paused Facebook Page post boost with POST /api/v1/ads/accounts/{accountId}/boosts. Requires an API key with the ads_manage scope or a signed-in workspace member.

Request

Creates a Meta campaign, ad set, creative, and ad, all PAUSED, from a published Facebook Page post. The provider post ID is frozen at admission. The same Idempotency-Key and intent return the same operation; a different intent returns 400. Provider IDs are read back before the operation succeeds. Spend is not activated by this call.

Parameter In Type Required
accountId path UUID Yes
workspaceId query UUID Yes
Body field Type Required
postId UUID Yes
postTargetId UUID No
actorAccountId UUID No
budget AdBudget Yes
schedule AdSchedule No
targeting object No

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.createBoost(accountId, {
  postId,
  budget: { amountMinor: 5000, currency: "USD", kind: "lifetime" },
});
operation = workspace.ads.create_boost(
    account_id,
    post_id=post_id,
    budget={"amountMinor": 5000, "currency": "USD", "kind": "lifetime"},
)
curl -X POST "https://pubnio.com/api/v1/ads/accounts/$ACCOUNT_ID/boosts?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"postId":"'"$POST_ID"'","budget":{"amountMinor":5000,"currency":"USD","kind":"lifetime"}}'
pnio ads create-boost "$ACCOUNT_ID" --file boost.json
async () => {
  const accountId = "<accountId>";
  const postId = "<postId>";
  // 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}/boosts`,
    query: { workspaceId: codemode.workspaceId },
    headers: { "Idempotency-Key": idempotencyKey },
    body: {
      postId: postId,
      budget: { amountMinor: 5000, currency: "USD", kind: "lifetime" },
    },
  });
  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

Type to search…

↑↓ navigate↵ selectEsc close