Pause or archive an ad group with POST /api/v1/ads/accounts/{accountId}/ad-groups/{adGroupId}/status. Requires an API key with the ads_manage scope or a signed-in workspace member.
Request
Requires the current expectedRevision. Pausing and archiving only stop spend, so members and ads_manage keys may, on any plan. Resuming is the owner-only ads.resumeAdGroup. An archived ad group cannot be reactivated. The provider call reads the ad group back before the operation succeeds.
| Parameter | In | Type | Required |
|---|---|---|---|
accountId |
path | UUID | Yes |
adGroupId |
path | UUID | Yes |
workspaceId |
query | UUID | Yes |
| Body field | Type | Required |
|---|---|---|
status |
"paused", "archived" |
Yes |
expectedRevision |
integer | Yes |
Response
- HTTP 202:
AdOperationwithid,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.updatestatus:queued,preflight,creating,recording,reviewing,activating,succeeded,partial,failed,unresolved,cancelledstep:queued,preflight,create,record,review,activate,finish
The OpenAPI document has each field’s type.
Examples
const operation = await workspace.ads.setAdGroupStatus(accountId, adGroupId, {
status: "paused",
expectedRevision: 2,
});operation = workspace.ads.set_ad_group_status(
account_id,
ad_group_id,
status="paused",
expected_revision=2,
)curl -X POST "https://pubnio.com/api/v1/ads/accounts/$ACCOUNT_ID/ad-groups/$AD_GROUP_ID/status?workspaceId=$WORKSPACE_ID" \
-H "Authorization: Bearer $PUBNIO_API_KEY" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H "Content-Type: application/json" \
-d '{"status":"paused","expectedRevision":2}'pnio ads set-ad-group-status "$ACCOUNT_ID" "$AD_GROUP_ID" --status paused --expected-revision 2async () => {
const accountId = "<accountId>";
const adGroupId = "<adGroupId>";
// 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}/ad-groups/${adGroupId}/status`,
query: { workspaceId: codemode.workspaceId },
headers: { "Idempotency-Key": idempotencyKey },
body: { status: "paused", expectedRevision: 2 },
});
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
- Field lengths and ranges are in the OpenAPI document.