# Update a campaign

Updates a campaign.

```http
PUT https://api.pozy.ai/v1/ads/campaigns/{campaignId}
```

- Area: Ads / Ad Campaigns
- Auth: Authorization: Bearer pz_live_...

## Path parameters

- `campaignId` (string, required)

## Request body

Content type: `application/json`

- `platform`, string, required: One of `facebook`, `instagram`, `tiktok`, `linkedin`, `pinterest`, `google`, `twitter`, `openai`, `reddit`
- `accountId`, string
- `bidStrategy`, object
- `bidAmount`, number
- `roasAverageFloor`, number
- `portfolioBidStrategyId`, string: Matches `^\d+$`
- `allowSharedBudgetUpdate`, boolean: Default `false`
- `targetImpressionShare`, object
  - `location`, string, required: One of `ANYWHERE_ON_PAGE`, `TOP_OF_PAGE`, `ABSOLUTE_TOP_OF_PAGE`
  - `percent`, number, required: At most 100
  - `maxCpc`, number, required
- `manualCpc`, object
  - `maxCpc`, number, required
- `networkSettings`, object
  - `searchPartners`, boolean
  - `displayNetwork`, boolean
- `trackingUrlTemplate`, string
- `finalUrlSuffix`, string
- `sharedBudgetId`, string: Matches `^\d+$`. Can be null
- `budget`, object
  - `amount`, number, required
  - `type`, string, required: One of `daily`, `lifetime`
- `name`, string: Up to 255 characters
- `platformSpecificData`, object
  - `spendCap`, number: Can be null

## Example request

```bash
curl -X PUT "https://api.pozy.ai/v1/ads/campaigns/65a3737dd8b11ea61f199e6e" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "platform": "facebook"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/ads/campaigns/65a3737dd8b11ea61f199e6e", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    platform: "facebook"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.put(
    "https://api.pozy.ai/v1/ads/campaigns/65a3737dd8b11ea61f199e6e",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "platform": "facebook",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `updated`, integer
- `budget`, object
  - `amount`, number, required
  - `type`, string, required: One of `daily`, `lifetime`
  - `amountMicros`, string: Matches `^\d+$`
  - `explicitlyShared`, boolean: Can be null
  - `resourceName`, string: Can be null
  - `deliveryMethod`, string: Can be null
- `budgetLevel`, string: One of `campaign`
- `bidStrategy`, string: One of `LOWEST_COST_WITHOUT_CAP`, `LOWEST_COST_WITH_BID_CAP`, `COST_CAP`, `LOWEST_COST_WITH_MIN_ROAS`
- `bidAmount`, number
- `roasAverageFloor`, number
- `portfolioBidStrategyId`, string
- `targetImpressionShare`, object
  - `location`, string, required: One of `ANYWHERE_ON_PAGE`, `TOP_OF_PAGE`, `ABSOLUTE_TOP_OF_PAGE`
  - `percent`, number, required: At most 100
  - `maxCpc`, number, required
- `manualCpc`, object
  - `maxCpc`, number, required
- `networkSettings`, object
  - `searchPartners`, boolean
  - `displayNetwork`, boolean
- `trackingUrlTemplate`, string
- `finalUrlSuffix`, string
- `sharedBudgetId`, string: Can be null
- `platformSpecificData`, object

```json
{
  "updated": 1,
  "budget": {
    "amount": 12.5,
    "type": "daily",
    "amountMicros": "string",
    "explicitlyShared": true,
    "resourceName": "Acme",
    "deliveryMethod": "string"
  },
  "budgetLevel": "campaign",
  "bidStrategy": "LOWEST_COST_WITHOUT_CAP",
  "bidAmount": 12.5,
  "roasAverageFloor": 12.5,
  "portfolioBidStrategyId": "657ef37139bac4c6428f5f10",
  "targetImpressionShare": {
    "location": "ANYWHERE_ON_PAGE",
    "percent": 12.5,
    "maxCpc": 12.5
  },
  "manualCpc": {
    "maxCpc": 12.5
  },
  "networkSettings": {
    "searchPartners": true,
    "displayNetwork": true
  },
  "trackingUrlTemplate": "https://pozy.ai/media/example-1.jpg",
  "finalUrlSuffix": "https://pozy.ai/media/example-1.jpg",
  "sharedBudgetId": "6251639fc36f449486902b2e",
  "platformSpecificData": {}
}
```
