# Manage ads

Pause and resume LinkedIn campaign groups, campaigns and creatives, change a campaign's budget, swap a creative's media, rename, duplicate and delete.

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';

By the end of this page, you can stop and restart a LinkedIn ad, change what it spends and looks like, copy it and remove it.

## Before you start

You need a `linkedinads` [account](/platforms/linkedin-ads#connect) and an ad. Zernio's levels map onto LinkedIn's like this:

| Zernio | LinkedIn | Id on the created ad |
|---|---|---|
| Campaign | Campaign Group | `platformCampaignId` |
| Ad set | Campaign | `platformAdSetId` |
| Ad | Creative | `platformAdId` |

## Pause or resume

`PUT /v1/ads/campaigns/{campaignId}/status` writes the Campaign Group's own switch and nothing else. Its Campaigns and Creatives keep their own switches.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: paused } = await zernio.adcampaigns.updateAdCampaignStatus({
  path: { campaignId: '645412093' },
  body: { status: 'paused', platform: 'linkedin' }
});
```
</Tab>
<Tab value="Python">
```python
from zernio import Zernio

client = Zernio()

paused = client.ad_campaigns.update_ad_campaign_status(
    campaign_id="645412093",
    status="paused",
    platform="linkedin",
)
```
</Tab>
<Tab value="curl">
```bash
curl -X PUT "https://zernio.com/api/v1/ads/campaigns/645412093/status" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "status": "paused", "platform": "linkedin" }'
```
</Tab>
</Tabs>

Response (`200`):

```json
{ "status": "paused", "platformCampaignStatus": null, "statusReadAt": null, "updated": 1, "skipped": 0 }
```

LinkedIn has no single Campaign Group read, so `platformCampaignStatus` and `statusReadAt` are always `null` and the write always goes out.

Resuming a group lets each Campaign and Creative deliver again only if its own switch is on. Narrower scopes take the same `status`:

| Scope | Call | LinkedIn switch |
|---|---|---|
| One Campaign | `PUT /v1/ads/ad-sets/{adSetId}/status` | The Campaign |
| One Creative | `PUT /v1/ads/{adId}/status` | The Creative, so sibling Creatives keep running |

A Creative still in `DRAFT` is already held off, and LinkedIn refuses to pause it before its review is approved. Pausing one writes nothing.

## Change the budget

Send `budget` on `PUT /v1/ads/{adId}`. Zernio writes it to the ad's LinkedIn Campaign, so it covers every Creative in that Campaign.

```json
{ "budget": { "amount": 40, "type": "daily" } }
```

LinkedIn's minimums still apply ([Budget minimums](/platforms/linkedin-ads/create-ads#budget-minimums)).

## Swap the creative

Send `creative` on `PUT /v1/ads/{adId}` with new media in `imageUrl` or `videoUrl`, plus `headline`, `body`, `description`, `callToAction` and `linkUrl` as needed.

Zernio uploads the media, creates a new Creative on the same Campaign and deletes the old one, because LinkedIn cannot edit a Creative's content. The ad's `platformAdId` changes to the new Creative.

A text-only update returns `400`, because LinkedIn needs new media. `videoId` and `existingCreativeId` are Meta-only and return `400`.

## Rename

`name` on `PUT /v1/ads/ad-sets/{adSetId}` renames the LinkedIn Campaign.

LinkedIn Creatives cannot be renamed: `name` on `PUT /v1/ads/{adId}` returns `501`.

## Duplicate a campaign

Call `POST /v1/ads/campaigns/{campaignId}/duplicate` with `platform: "linkedin"` and the source Campaign Group id.

LinkedIn has no native copy endpoint. Zernio walks the source Campaign Group, its Campaigns and their Creatives and recreates the tree.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: copy } = await zernio.adcampaigns.duplicateAdCampaign({
  path: { campaignId: '645412093' },
  body: {
    platform: 'linkedin',
    statusOption: 'PAUSED',
    renameStrategy: 'DEEP_RENAME',
    renameSuffix: ' (Copy)'
  }
});
```
</Tab>
<Tab value="Python">
```python
copy = client.ad_campaigns.duplicate_ad_campaign(
    campaign_id="645412093",
    platform="linkedin",
    status_option="PAUSED",
    rename_strategy="DEEP_RENAME",
    rename_suffix=" (Copy)",
)
```
</Tab>
<Tab value="curl">
```bash
curl -X POST "https://zernio.com/api/v1/ads/campaigns/645412093/duplicate" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "linkedin",
    "statusOption": "PAUSED",
    "renameStrategy": "DEEP_RENAME",
    "renameSuffix": " (Copy)"
  }'
```
</Tab>
</Tabs>

Response (`200`):

```json
{
  "copiedCampaignId": "645498211",
  "discovery": "triggered"
}
```

`discovery` reports whether Zernio started an ads sync for the copy. The sync runs after the response and makes the copy show up in [`GET /v1/ads/tree`](/ad-campaigns/get-ad-tree), usually within a few minutes.

- `triggered`: the sync started
- `skipped`: the request sent `syncAfter: false`
- `failed`: the sync could not start

The copy exists on LinkedIn in all 3 cases. Zernio only sees it once a sync finishes, so poll the tree. Until then, calls that take the copied id answer `404`.

The copy carries the campaign fields verbatim (`type`, `costType`, `creativeSelection`, `unitCost`, `optimizationTargetType`, `targetingCriteria`, `dailyBudget`, `totalBudget`, ...).

It also carries every Creative's content object, for DSC-authored, reference, document and thought-leader creatives alike.

`statusOption` takes one of:

- `PAUSED` (default): the whole clone stays `DRAFT`
- `ACTIVE`: the clone launches the moment LinkedIn approves it
- `INHERITED_FROM_SOURCE`: evaluated per entity. Any Group, Campaign or Creative whose source is `ACTIVE` gets its clone activated too.

If any step fails, only the entities the duplicate authored are cleaned up. The source tree is never touched.

<Callout type="warn">
`INHERITED_FROM_SOURCE` on an `ACTIVE` campaign starts a second front of spend the moment the clone activates. Keep `PAUSED` unless the caller wants a live clone.
</Callout>

## Delete

| Level | Call | What LinkedIn does |
|---|---|---|
| Ad | `DELETE /v1/ads/{adId}` | Removes the Creative. Its Campaign and Campaign Group go too, but only when Zernio created them and nothing else live is left in them. |
| Ad set | `DELETE /v1/ads/ad-sets/{adSetId}` | Moves the Campaign to `PENDING_DELETION`. It stays readable for reporting, and its ads are marked `cancelled`. |
| Campaign | `DELETE /v1/ads/campaigns/{campaignId}` | Moves the Campaign Group to `PENDING_DELETION`. Its ads are marked `cancelled`. |

If the Creative itself cannot be removed, the request fails and no parent is touched.

A Campaign Group with no ads in Zernio is deleted only after LinkedIn confirms it holds no Campaigns. To delete one, send `accountId` in the body or the query string.

## If it fails

| Error | Cause | Fix |
|---|---|---|
| `400` on `creative` | The update carries no `imageUrl` or `videoUrl`, or a Meta-only field | Send new media |
| `501` on `name` on an ad | LinkedIn Creatives cannot be renamed | Rename the Campaign with `PUT /v1/ads/ad-sets/{adSetId}` |
| `501` on `bidStrategy` on an ad set | Zernio does not change LinkedIn bidding after create | Set bidding in `platformSpecificData` at create ([Bidding](/platforms/linkedin-ads/create-ads#bidding)) |
| `409` `invalid_resource_state` on a campaign delete | The empty group was never synced, or LinkedIn still lists Campaigns in it | Sync the ad account (`POST /v1/ads/sync`) and delete again |
| `discovery: "failed"` on a duplicate | The sync after the copy could not start | The copy exists on LinkedIn, so poll [`GET /v1/ads/tree`](/ad-campaigns/get-ad-tree) |

## Related

- [Create a campaign](/platforms/linkedin-ads/create-ads): the hierarchy these calls manage.
- [Targeting](/platforms/linkedin-ads/targeting): change a running Campaign's audience.
- [Pause or resume a campaign](/ad-campaigns/update-ad-campaign-status) and [Update ad](/ad-campaigns/update-ad): every field.
- [Duplicate a campaign](/ad-campaigns/duplicate-ad-campaign) and [Delete a campaign](/ad-campaigns/delete-ad-campaign): the full bodies.