> ## Documentation Index
> Fetch the complete documentation index at: https://docs.burki.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Campaign

> Update an existing campaign.

Update an existing campaign's configuration. Only campaigns in `draft` or `paused` status can be updated.

<Callout type="warning">
  Running or completed campaigns cannot be updated. Pause the campaign first if you need to make changes.
</Callout>

### Path Parameters

* `campaign_id` (integer, required): The unique identifier of the campaign

### Request Body

All fields are optional. Only include fields you want to update.

| Field                       | Type    | Description                           |
| --------------------------- | ------- | ------------------------------------- |
| `name`                      | string  | Campaign name (1-200 characters)      |
| `description`               | string  | Campaign description                  |
| `welcome_message_template`  | string  | Template for welcome message          |
| `agenda_template`           | string  | Template for call agenda              |
| `end_call_message_template` | string  | Template for end call message         |
| `sms_message_template`      | string  | Template for SMS content              |
| `fallback_values`           | object  | Fallback values for missing variables |
| `max_attempts`              | integer | Max retry attempts                    |
| `retry_delay_minutes`       | integer | Delay between retries                 |

### Example Request

```json Request Body theme={null}
{
  "name": "Updated Campaign Name",
  "agenda_template": "I'm calling about your upcoming appointment on {{appointment_date}} at {{appointment_time}}.",
  "max_attempts": 5
}
```

### Response

Returns a success message when the update is complete.

```json Response theme={null}
{
  "message": "Campaign updated successfully"
}
```

### Example Code

```bash cURL theme={null}
curl -X PUT "https://api.burki.dev/api/v1/campaigns/42" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Campaign Name",
    "max_attempts": 5
  }'
```

```python Python theme={null}
import requests

response = requests.put(
    "https://api.burki.dev/api/v1/campaigns/42",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "name": "Updated Campaign Name",
        "max_attempts": 5
    }
)

result = response.json()
print(result["message"])
```

```javascript JavaScript theme={null}
const response = await fetch("https://api.burki.dev/api/v1/campaigns/42", {
  method: "PUT",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    name: "Updated Campaign Name",
    max_attempts: 5
  })
});

const result = await response.json();
console.log(result.message);
```

### Error Responses

| Status Code | Description                                  |
| ----------- | -------------------------------------------- |
| 400         | Cannot update running or completed campaigns |
| 404         | Campaign not found                           |
| 401         | Unauthorized - invalid or missing API key    |


## OpenAPI

````yaml PUT /api/v1/campaigns/{campaign_id}
openapi: 3.1.0
info:
  title: Burki
  description: A system that uses AI to answer customer Calls.
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/campaigns/{campaign_id}:
    put:
      tags:
        - campaigns
      summary: Update Campaign
      description: Update an existing campaign.
      operationId: update_campaign_api_v1_campaigns__campaign_id__put
      parameters:
        - name: campaign_id
          in: path
          required: true
          schema:
            type: integer
            title: Campaign Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CampaignUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    CampaignUpdateRequest:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        welcome_message_template:
          anyOf:
            - type: string
            - type: 'null'
          title: Welcome Message Template
        agenda_template:
          anyOf:
            - type: string
            - type: 'null'
          title: Agenda Template
        end_call_message_template:
          anyOf:
            - type: string
            - type: 'null'
          title: End Call Message Template
        sms_message_template:
          anyOf:
            - type: string
            - type: 'null'
          title: Sms Message Template
        max_attempts:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Attempts
        retry_delay_minutes:
          anyOf:
            - type: integer
            - type: 'null'
          title: Retry Delay Minutes
        fallback_values:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Fallback Values
        variable_mappings:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Variable Mappings
        available_variables:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Available Variables
        pending_import:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Pending Import
      type: object
      title: CampaignUpdateRequest
      description: Request model for updating a campaign.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````