## Update a campaign (tenant:crm:write)

`PUT /api/crm/v1/campaigns/{id}`

Module: CRM · operationId: `updateCampaign` · Tag: Campaigns · Auth: access token (`Authorization: Bearer <accessToken>`)

Partial update: only the fields sent change. The resulting date range is checked
(`endDate` not before `startDate`, otherwise `400`). Emits `crm.campaign.updated`.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (uuid) | yes | Record ID (UUID). |

### Request body

`application/json` (required)

- `actualCost` (number (double)): Cost so far. (max 9999999999)
- `budget` (number (double)): Planned budget. (max 9999999999)
- `description` (string): Description. (max length 10000)
- `endDate` (string (date-time)): End of the campaign; not before `startDate`.
- `name` (string): Name of the campaign. (max length 255)
- `startDate` (string (date-time)): Start of the campaign.
- `status` (CampaignStatus): (one of `PLANNING`, `ACTIVE`, `COMPLETED`, `CANCELLED`)
- `type` (CampaignType): (one of `EMAIL`, `WEBINAR`, `TRADE_SHOW`, `ADS`, `EVENT`, `SOCIAL_MEDIA`, `OTHER`)

Example:

```json
{
  "actualCost": 1250.5,
  "status": "ACTIVE"
}
```

### Responses

- **200** The updated campaign (`application/json`)
- **400** Invalid input (`invalid`): `field` names the first invalid field, `details.fields` every one (JSON paths for
bodies, parameter names for the query). Some refusals have their own code (`invalid_sort`,
`invalid_stages`, `invalid_custom_fields`, `convert_target_required`, `invalid_csv`, …).
 (`application/json`)
- **401** Missing, invalid or expired token (no body).
- **403** The token lacks the permission (`insufficient permissions`) or has no active tenant.
 (`application/json`)
- **404** The record does not exist in the token's tenant. (`application/json`)
- **500** Unexpected error; details are only logged. (`application/json`)

Fields of the 200 answer:

- `actualCost` (number (double), required): Cost so far.
- `budget` (number (double), required): Planned budget.
- `createdAt` (string (date-time), required): Creation time.
- `customerNo` (string, required): Customer number of the tenant.
- `id` (string (uuid), required): Id of the campaign.
- `name` (string, required): Name of the campaign.
- `status` (CampaignStatus, required): (one of `PLANNING`, `ACTIVE`, `COMPLETED`, `CANCELLED`)
- `tenantName` (string, required): Tenant name.
- `type` (CampaignType, required): (one of `EMAIL`, `WEBINAR`, `TRADE_SHOW`, `ADS`, `EVENT`, `SOCIAL_MEDIA`, `OTHER`)
- `updatedAt` (string (date-time), required): Time of the last change.
- `description` (string): Omitted when not set.
- `endDate` (string (date-time)): Omitted when not set.
- `startDate` (string (date-time)): Omitted when not set.

Example 200 answer:

```json
{
  "actualCost": 11340,
  "budget": 12000,
  "createdAt": "2026-04-16T14:00:00Z",
  "customerNo": "99999",
  "description": "Gemeinschaftsstand mit Nordlicht IT-Distribution auf der regionalen IT-Messe; Schwerpunkt Netzwerk, WLAN und Managed Services.",
  "endDate": "2026-07-20T00:00:00Z",
  "id": "2a4c6e8a-0b2d-4f4a-8c6e-8a0c2e4a6c8e",
  "name": "Messe IT-Business Ostbayern",
  "startDate": "2026-07-18T00:00:00Z",
  "status": "COMPLETED",
  "tenantName": "DEMO",
  "type": "TRADE_SHOW",
  "updatedAt": "2026-08-18T09:00:00Z"
}
```

### Example request

```bash
curl -X PUT 'https://api.mbcom.cloud/api/crm/v1/campaigns/3f2b8c1e-6d4a-4f7b-9a2e-1c5d7e9f0a12' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"actualCost":1250.5,"status":"ACTIVE"}'
```
