# Manage ads

Pause or resume Microsoft Ads campaigns, ad groups and ads, change a campaign's daily budget, and delete them.

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

Microsoft keeps an on/off switch at each level, and Zernio writes to the level you call.

## Pause or resume

`PUT /v1/ads/{adId}/status` sets the ad's own switch. Its ad group, campaign and sibling ads keep theirs.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: paused } = await zernio.adcampaigns.updateAdStatus({
  path: { adId: '6ae0968fa23091cc35b72121' },
  body: { status: 'paused' }
});
```
</Tab>
<Tab value="Python">
```python
paused = client.ad_campaigns.update_ad_status(
    ad_id="6ae0968fa23091cc35b72121",
    status="paused",
)
```
</Tab>
<Tab value="curl">
```bash
curl -X PUT "https://zernio.com/api/v1/ads/6ae0968fa23091cc35b72121/status" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "status": "paused" }'
```
</Tab>
</Tabs>

Response (`200`):

```json
{ "updated": 1, "skipped": 0, "status": "paused", "configuredStatus": "PAUSED" }
```

`PUT /v1/ads/campaigns/{campaignId}/status` and `PUT /v1/ads/ad-sets/{adSetId}/status` set the campaign's or the ad group's switch the same way.

## Other changes

| Change | Call | Microsoft behaviour |
|--------|------|---------------------|
| Budget | `budget: { amount, type: "daily" }` on `PUT /v1/ads/{adId}` or `PUT /v1/ads/campaigns/{campaignId}` | Changes the campaign's daily budget |
| Delete | `DELETE /v1/ads/{adId}` or `DELETE /v1/ads/campaigns/{campaignId}` | Deletes on Microsoft Advertising |

## How it behaves

- An ad reads `paused` while its campaign or ad group is paused, even when its own switch is on: `configuredStatus` shows the ad's own switch.
- Deleting an ad Zernio created deletes its whole campaign, because Zernio built that campaign for the ad. Deleting a synced ad deletes only the ad.
- Rename, bid, targeting and creative changes are not available.
- A campaign, ad group or ad deleted in Microsoft Advertising settles as `cancelled` on the next sync.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| `422` with `param: "budget.type"` | A lifetime budget | Send `type: "daily"`. |
| `501` with code `feature_not_available` | A rename, bid, targeting or creative change, or deleting an ad group | Make the change in Microsoft Advertising, or create a new ad. |

## Related

- [Pause or resume a single ad](/ad-campaigns/update-ad-status): the switch and its read-back.
- [Update ad](/ad-campaigns/update-ad) and [Update a campaign](/ad-campaigns/update-ad-campaign): the budget change.
- [Get campaign tree](/ad-campaigns/get-ad-tree): every level with its status.