# Record a marketing activity

Records a marketing activity. Works with Shopify accounts.

```http
PUT https://api.pozy.ai/v1/commerce/marketing-activities
```

- Area: Commerce / Commerce
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `accountId`, string, required
- `remoteId`, string, required: Up to 255 characters
- `title`, string, required
- `url`, string (URL), required
- `previewImageUrl`, string (URL)
- `utm`, object
  - `campaign`, string, required
  - `source`, string, required
  - `medium`, string, required
- `tactic`, string, required: One of `ad`, `post`, `message`, `newsletter`, `link`, `affiliate`, `retargeting`, `loyalty`, `seo`
- `channel`, string, required: One of `social`, `search`, `display`, `email`, `referral`
- `status`, string, required: One of `active`, `inactive`, `paused`, `scheduled`
- `budget`, object
  - `type`, string, required: One of `daily`, `lifetime`
  - `amount`, string, required
- `adSpend`, string
- `startedAt`, string (date-time)
- `endedAt`, string (date-time)

## Example request

```bash
curl -X PUT "https://api.pozy.ai/v1/commerce/marketing-activities" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "accountId": "696e0b682d0a31188e7a2ba9",
  "remoteId": "6f548f9d20d8d19954bd9bff",
  "title": "Launch day",
  "url": "https://pozy.ai/media/example-1.jpg",
  "tactic": "ad",
  "channel": "social",
  "status": "active"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/commerce/marketing-activities", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    accountId: "696e0b682d0a31188e7a2ba9",
    remoteId: "6f548f9d20d8d19954bd9bff",
    title: "Launch day",
    url: "https://pozy.ai/media/example-1.jpg",
    tactic: "ad",
    channel: "social",
    status: "active"
  }),
});
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/commerce/marketing-activities",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "accountId": "696e0b682d0a31188e7a2ba9",
        "remoteId": "6f548f9d20d8d19954bd9bff",
        "title": "Launch day",
        "url": "https://pozy.ai/media/example-1.jpg",
        "tactic": "ad",
        "channel": "social",
        "status": "active",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `marketingActivity`, object
  - `id`, string
  - `remoteId`, string

```json
{
  "marketingActivity": {
    "id": "6bfebd43ddc270f6d2c56fc5",
    "remoteId": "6f548f9d20d8d19954bd9bff"
  }
}
```
