# Change a campaign (/api/updateCampaign)

Legal while the campaign is `draft`, `scheduled` or `paused`. A running
or finished campaign is refused with `request_refused` — its dispatch
rows already exist, and changing the message underneath them would
send something nobody approved.

Endpoint: PATCH /api/v1/campaigns/{id}
Full URL: https://app.sendkuy.com/api/v1/campaigns/{id}
- path parameter id (required): string — The prefixed id of the object.
- header parameter Idempotency-Key (optional): string — Any unique string, one per logical request. Retrying with the same key returns the first answer instead of doing the work twice, and answers with `Idempotent…
Request body (JSON, required); required fields: none
Example "New name": {"name":"Promo Ramadan v2"}
Success status: 200

cURL:

```bash
curl -X PATCH https://app.sendkuy.com/api/v1/campaigns/cmp_9cBe3A1H-SLhW5fONWZ32wb-IIio5Ts3 \
  -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Promo Ramadan v2"
}'
```

Node.js:

```ts
import { SendKuy } from 'sendkuy';

const sendkuy = new SendKuy('sk_live_YOUR_API_KEY');

const result = await sendkuy.campaigns.update('cmp_9cBe3A1H-SLhW5fONWZ32wb-IIio5Ts3', {
  name: 'Promo Ramadan v2',
});
```

PHP:

```php
<?php

use SendKuy\SendKuy;

$sendkuy = new SendKuy('sk_live_YOUR_API_KEY');

$result = $sendkuy->campaigns()->update('cmp_9cBe3A1H-SLhW5fONWZ32wb-IIio5Ts3', [
    'name' => 'Promo Ramadan v2',
]);
```

Python:

```python
import requests

response = requests.request(
    "PATCH",
    "https://app.sendkuy.com/api/v1/campaigns/cmp_9cBe3A1H-SLhW5fONWZ32wb-IIio5Ts3",
    headers={"Authorization": "Bearer sk_live_YOUR_API_KEY"},
    json={
        "name": "Promo Ramadan v2"
    },
)

data = response.json()["data"]
```