# Update a campaign (/api-reference/campaigns/updateCampaign)

## PUT /api/v1/campaigns/{campaign_id}

Operation ID: `updateCampaign`
Update a campaign
Send only the fields to change. `settings` is merged into the current settings. Changing dialing rules on a running campaign re-plans its next dial round.

### Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `campaign_id` | path | yes | Campaign ID. |

### Request body

`application/json` (required)

```json
{
  "additionalProperties": true,
  "description": "Campaign fields to create or change. On update, send only the fields to change.",
  "properties": {
    "agentId": {
      "description": "The agent that makes the calls.",
      "format": "uuid",
      "title": "Agentid",
      "type": "string"
    },
    "crmWebhookSecret": {
      "description": "Secret used to sign those webhooks. Never returned.",
      "title": "Crmwebhooksecret",
      "type": "string"
    },
    "crmWebhookUrl": {
      "description": "Public HTTPS URL that receives this campaign's call results; empty clears it.",
      "format": "uri",
      "title": "Crmwebhookurl",
      "type": "string"
    },
    "description": {
      "description": "Free-text description.",
      "title": "Description",
      "type": "string"
    },
    "direction": {
      "default": "outbound",
      "description": "`outbound` (call leads) or `inbound` (answer calls).",
      "enum": [
        "outbound",
        "inbound"
      ],
      "title": "Direction",
      "type": "string"
    },
    "endDate": {
      "description": "Planned end date, free text.",
      "title": "Enddate",
      "type": "string"
    },
    "isActive": {
      "description": "Update only: `true` starts the campaign, `false` stops it (same checks as start and stop).",
      "title": "Isactive",
      "type": "boolean"
    },
    "isDefaultInbound": {
      "description": "Inbound only: take calls to the number that no other campaign matches.",
      "title": "Isdefaultinbound",
      "type": "boolean"
    },
    "name": {
      "description": "Campaign name. Defaults to `Untitled`.",
      "title": "Name",
      "type": "string"
    },
    "phoneNumberId": {
      "description": "Caller ID. Required for inbound campaigns. Defaults to the agent's assigned number.",
      "format": "uuid",
      "title": "Phonenumberid",
      "type": "string"
    },
    "phoneNumberIds": {
      "description": "Every number to call from, in order; the first is the primary caller ID.",
      "items": {
        "format": "uuid",
        "type": "string"
      },
      "title": "Phonenumberids",
      "type": "array"
    },
    "settings": {
      "anyOf": [
        {
          "additionalProperties": true,
          "description": "Dialing rules. On update, send only the keys to change; they merge into the current settings.",
          "properties": {
            "autoDialEnabled": {
              "default": true,
              "description": "Dial automatically while the campaign is running; false pauses dialing.",
              "title": "Autodialenabled",
              "type": "boolean"
            },
            "callInterval": {
              "default": 7200000,
              "description": "Milliseconds between attempts to the same lead (2 hours by default).",
              "minimum": 0,
              "title": "Callinterval",
              "type": "integer"
            },
            "dialDaysOfWeek": {
              "default": [
                0,
                1,
                2,
                3,
                4,
                5,
                6
              ],
              "description": "Days calls are placed: 0 = Monday ... 6 = Sunday.",
              "items": {
                "maximum": 6,
                "minimum": 0,
                "type": "integer"
              },
              "title": "Dialdaysofweek",
              "type": "array"
            },
            "dialTimezone": {
              "default": "Asia/Kolkata",
              "description": "IANA time zone of the dial window.",
              "title": "Dialtimezone",
              "type": "string"
            },
            "dialWindowEnd": {
              "default": "17:00",
              "description": "Local time `HH:MM`.",
              "title": "Dialwindowend",
              "type": "string"
            },
            "dialWindowStart": {
              "default": "10:00",
              "description": "Local time `HH:MM`. Calls are placed only inside the window.",
              "title": "Dialwindowstart",
              "type": "string"
            },
            "firstCallDelayMs": {
              "default": 0,
              "description": "Wait before a new lead's first call, in milliseconds.",
              "minimum": 0,
              "title": "Firstcalldelayms",
              "type": "integer"
            },
            "maxCallsPerDay": {
              "default": 50,
              "description": "Calls the campaign may place per day.",
              "maximum": 100000,
              "minimum": 1,
              "title": "Maxcallsperday",
              "type": "integer"
            },
            "maxConcurrentCalls": {
              "default": 1,
              "description": "Calls the campaign may have in progress at once, 1 to 500. Also limited by your plan's parallel calls and by each number's capacity. Default on create: 1, or twice the number of `phoneNumberIds` when created with leads.",
              "maximum": 500,
              "minimum": 1,
              "title": "Maxconcurrentcalls",
              "type": "integer"
            },
            "pacingSeconds": {
              "default": 5,
              "description": "Seconds to wait between dial rounds, 0 to 3600; 0 dials again as soon as the dialer polls.",
              "maximum": 3600,
              "minimum": 0,
              "title": "Pacingseconds",
              "type": "integer"
            },
            "retryAttempts": {
              "default": 3,
              "description": "Extra attempts per lead after the first call.",
              "maximum": 10,
              "minimum": 0,
              "title": "Retryattempts",
              "type": "integer"
            },
            "retryIntervalBusyMs": {
              "default": 1800000,
              "description": "Milliseconds before retrying a busy lead.",
              "minimum": 0,
              "title": "Retryintervalbusyms",
              "type": "integer"
            },
            "retryIntervalNoAnswerMs": {
              "description": "Milliseconds before retrying a lead that did not answer; null uses `callInterval`.",
              "minimum": 0,
              "title": "Retryintervalnoanswerms",
              "type": [
                "integer",
                "null"
              ]
            },
            "retryShortAnsweredCalls": {
              "default": false,
              "description": "Retry a lead whose call was answered but ended within seconds.",
              "title": "Retryshortansweredcalls",
              "type": "boolean"
            }
          },
          "title": "CampaignSettings",
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "description": "Dialing rules; merged into the current ones."
    },
    "startDate": {
      "description": "Planned start date, free text (for example `2026-12-01`).",
      "title": "Startdate",
      "type": "string"
    },
    "status": {
      "description": "Display status to set, for example `draft`.",
      "title": "Status",
      "type": "string"
    }
  },
  "title": "CampaignInput",
  "type": "object"
}
```

Example:

```json
{
  "settings": {
    "dialWindowEnd": "19:00",
    "pacingSeconds": 10
  }
}
```

### Responses

#### 200 OK

Example (example):

```json
{
  "campaign": {
    "agentId": "9a8b7c6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d",
    "autoDialEnabled": false,
    "createdAt": "2026-11-15T10:00:00Z",
    "direction": "outbound",
    "id": "3f6c1b2a-7d4e-4a1b-9c2d-5e6f7a8b9c0d",
    "isActive": false,
    "name": "December renewals",
    "phoneNumberId": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
    "settings": {
      "dialWindowEnd": "18:00",
      "dialWindowStart": "10:00",
      "maxCallsPerDay": 200,
      "maxConcurrentCalls": 2,
      "pacingSeconds": 5
    },
    "stats": {
      "calledLeads": 0,
      "connectRate": 0,
      "totalLeads": 0
    },
    "status": "draft"
  },
  "success": true
}
```

#### 400 Bad request: `bad_request`.

Example (The request could not be processed.):

```json
{
  "detail": "The request could not be processed.",
  "error": {
    "code": "bad_request",
    "docUrl": "https://docs.callmitra.ai/errors/bad_request",
    "message": "The request could not be processed.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "invalid_request_error"
  }
}
```

#### 401 Unauthorized: `api_key_expired`, `invalid_api_key`, `unauthenticated`.

Example (The API key has expired.):

```json
{
  "detail": "The API key has expired.",
  "error": {
    "code": "api_key_expired",
    "docUrl": "https://docs.callmitra.ai/errors/api_key_expired",
    "message": "The API key has expired.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "authentication_error"
  }
}
```

Example (The API key is invalid or has been revoked.):

```json
{
  "detail": "The API key is invalid or has been revoked.",
  "error": {
    "code": "invalid_api_key",
    "docUrl": "https://docs.callmitra.ai/errors/invalid_api_key",
    "message": "The API key is invalid or has been revoked.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "authentication_error"
  }
}
```

Example (Authentication required.):

```json
{
  "detail": "Authentication required.",
  "error": {
    "code": "unauthenticated",
    "docUrl": "https://docs.callmitra.ai/errors/unauthenticated",
    "message": "Authentication required.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "authentication_error"
  }
}
```

#### 402 Payment required: `payment_required`.

Example (Your account does not have enough balance or an active plan for this request.):

```json
{
  "detail": "Your account does not have enough balance or an active plan for this request.",
  "error": {
    "code": "payment_required",
    "docUrl": "https://docs.callmitra.ai/errors/payment_required",
    "message": "Your account does not have enough balance or an active plan for this request.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "billing_error"
  }
}
```

#### 403 Forbidden: `api_key_scope_denied`, `permission_denied`.

Example (The API key does not have the scope required for this request.):

```json
{
  "detail": "The API key does not have the scope required for this request.",
  "error": {
    "code": "api_key_scope_denied",
    "docUrl": "https://docs.callmitra.ai/errors/api_key_scope_denied",
    "message": "The API key does not have the scope required for this request.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "permission_error"
  }
}
```

Example (You do not have permission to perform this action.):

```json
{
  "detail": "You do not have permission to perform this action.",
  "error": {
    "code": "permission_denied",
    "docUrl": "https://docs.callmitra.ai/errors/permission_denied",
    "message": "You do not have permission to perform this action.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "permission_error"
  }
}
```

#### 404 Not found: `campaign_not_found`, `resource_not_found`.

Example (Campaign not found.):

```json
{
  "detail": "Campaign not found.",
  "error": {
    "code": "campaign_not_found",
    "docUrl": "https://docs.callmitra.ai/errors/campaign_not_found",
    "message": "Campaign not found.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "not_found_error"
  }
}
```

Example (The requested resource was not found.):

```json
{
  "detail": "The requested resource was not found.",
  "error": {
    "code": "resource_not_found",
    "docUrl": "https://docs.callmitra.ai/errors/resource_not_found",
    "message": "The requested resource was not found.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "not_found_error"
  }
}
```

#### 409 Conflict: `campaign_default_inbound_exists`, `campaign_not_running`.

Example (Another default inbound campaign already exists for this phone number.):

```json
{
  "detail": "Another default inbound campaign already exists for this phone number.",
  "error": {
    "code": "campaign_default_inbound_exists",
    "docUrl": "https://docs.callmitra.ai/errors/campaign_default_inbound_exists",
    "message": "Another default inbound campaign already exists for this phone number.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "conflict_error"
  }
}
```

Example (Campaign is not active.):

```json
{
  "detail": "Campaign is not active.",
  "error": {
    "code": "campaign_not_running",
    "docUrl": "https://docs.callmitra.ai/errors/campaign_not_running",
    "message": "Campaign is not active.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "conflict_error"
  }
}
```

#### 422 Invalid parameters: `campaign_not_ready`, `parameter_invalid`.

Example (The campaign is not ready to start.):

```json
{
  "detail": [
    {
      "loc": [
        "body",
        "phone"
      ],
      "msg": "Field required",
      "type": "missing"
    }
  ],
  "error": {
    "code": "campaign_not_ready",
    "docUrl": "https://docs.callmitra.ai/errors/campaign_not_ready",
    "message": "The campaign is not ready to start.",
    "param": "phone",
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "invalid_request_error"
  }
}
```

Example (One or more parameters are invalid.):

```json
{
  "detail": [
    {
      "loc": [
        "body",
        "phone"
      ],
      "msg": "Field required",
      "type": "missing"
    }
  ],
  "error": {
    "code": "parameter_invalid",
    "docUrl": "https://docs.callmitra.ai/errors/parameter_invalid",
    "message": "One or more parameters are invalid.",
    "param": "phone",
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "invalid_request_error"
  }
}
```

#### 429 Too many requests: `rate_limit_exceeded`.

Example (Too many requests. Slow down and retry later.):

```json
{
  "detail": "Too many requests. Slow down and retry later.",
  "error": {
    "code": "rate_limit_exceeded",
    "docUrl": "https://docs.callmitra.ai/errors/rate_limit_exceeded",
    "message": "Too many requests. Slow down and retry later.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "rate_limit_error"
  }
}
```

#### 500 Server error: `internal_error`.

Example (Something went wrong on our side.):

```json
{
  "detail": "Something went wrong on our side.",
  "error": {
    "code": "internal_error",
    "docUrl": "https://docs.callmitra.ai/errors/internal_error",
    "message": "Something went wrong on our side.",
    "param": null,
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69",
    "type": "api_error"
  }
}
```

### Error codes

- [`bad_request`](/errors/bad_request)
- [`api_key_expired`](/errors/api_key_expired)
- [`invalid_api_key`](/errors/invalid_api_key)
- [`unauthenticated`](/errors/unauthenticated)
- [`payment_required`](/errors/payment_required)
- [`api_key_scope_denied`](/errors/api_key_scope_denied)
- [`permission_denied`](/errors/permission_denied)
- [`campaign_not_found`](/errors/campaign_not_found)
- [`resource_not_found`](/errors/resource_not_found)
- [`campaign_default_inbound_exists`](/errors/campaign_default_inbound_exists)
- [`campaign_not_running`](/errors/campaign_not_running)
- [`campaign_not_ready`](/errors/campaign_not_ready)
- [`parameter_invalid`](/errors/parameter_invalid)
- [`rate_limit_exceeded`](/errors/rate_limit_exceeded)
- [`internal_error`](/errors/internal_error)
