# Update ad account settings

Updates ad account settings. Fields you leave out keep their current values. Works with Meta Ads and Google Ads.

```http
PATCH https://api.pozy.ai/v1/ads/accounts
```

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

## Request body

Content type: `application/json`

- `accountId`, string, required
- `adAccountId`, string, required
- `name`, string: Up to 255 characters
- `spendCap`, number: Can be null
- `resetAmountSpent`, boolean
- `defaultDsaBeneficiary`, string: Up to 100 characters
- `defaultDsaPayor`, string: Up to 100 characters
- `trackingUrlTemplate`, string
- `finalUrlSuffix`, string

## Example request

```bash
curl -X PATCH "https://api.pozy.ai/v1/ads/accounts" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "accountId": "696e0b682d0a31188e7a2ba9",
  "adAccountId": "666219aad7bab67ace411e4f"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/ads/accounts", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    accountId: "696e0b682d0a31188e7a2ba9",
    adAccountId: "666219aad7bab67ace411e4f"
  }),
});
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.patch(
    "https://api.pozy.ai/v1/ads/accounts",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "accountId": "696e0b682d0a31188e7a2ba9",
        "adAccountId": "666219aad7bab67ace411e4f",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `adAccountId`, string
- `urlTracking`, object
  - `trackingUrlTemplate`, string
  - `finalUrlSuffix`, string
- `dsaDefaults`, object
  - `beneficiary`, string
  - `payor`, string
- `settings`, object
  - `name`, string
  - `currency`, string
  - `balance`, number
  - `amountSpent`, number
  - `spendCap`, number: Can be null
  - `fundingSource`, object: Can be null
    - `displayString`, string
    - `type`, integer

```json
{
  "adAccountId": "666219aad7bab67ace411e4f",
  "urlTracking": {
    "trackingUrlTemplate": "https://pozy.ai/media/example-1.jpg",
    "finalUrlSuffix": "https://pozy.ai/media/example-1.jpg"
  },
  "dsaDefaults": {
    "beneficiary": "string",
    "payor": "string"
  },
  "settings": {
    "name": "Acme",
    "currency": "USD",
    "balance": 12.5,
    "amountSpent": 12.5,
    "spendCap": 12.5,
    "fundingSource": {
      "displayString": "string",
      "type": 1
    }
  }
}
```
