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

# Update Campaign

> Update campaign configuration (only before launch).

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH https://api.thinnest.ai/campaigns/{campaign_id} \
    -H "Authorization: Bearer $THINNESTAI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "name": "Updated Campaign Name",
    "message_template": "Updated message template.",
    "max_concurrent": 10
  }'
  ```

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

  url = "https://api.thinnest.ai/campaigns/{campaign_id}"
  headers = {
      "Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
      "Content-Type": "application/json",
  }

  payload = {
    "name": "Updated Campaign Name",
    "message_template": "Updated message template.",
    "max_concurrent": 10
  }

  response = requests.patch(url, headers=headers, json=payload)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.thinnest.ai/campaigns/{campaign_id}", {
    method: "PATCH",
    headers: {
      "Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
    "name": "Updated Campaign Name",
    "message_template": "Updated message template.",
    "max_concurrent": 10
  }),
  });

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

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "fmt"
      "io"
      "net/http"
  )

  func main() {
      payload := []byte(`{
    "name": "Updated Campaign Name",
    "message_template": "Updated message template.",
    "max_concurrent": 10
  }`)
      req, _ := http.NewRequest("PATCH", "https://api.thinnest.ai/campaigns/{campaign_id}", bytes.NewBuffer(payload))
      req.Header.Set("Authorization", "Bearer YOUR_THINNESTAI_API_KEY")
      req.Header.Set("Content-Type", "application/json")

      resp, err := http.DefaultClient.Do(req)
      if err != nil { panic(err) }
      defer resp.Body.Close()
      body, _ := io.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```
</RequestExample>

***

## Path Parameters

<ParamField path="campaign_id" type="string" required>
  Campaign ID
</ParamField>

***

## Request Body

All fields are optional. Only provided fields are updated.

<ParamField body="name" type="string">
  Campaign display name
</ParamField>

<ParamField body="message_template" type="string">
  Message template
</ParamField>

<ParamField body="contacts" type="array">
  Replace contact list
</ParamField>

<ParamField body="schedule" type="string">
  Reschedule launch time (ISO 8601)
</ParamField>

<ParamField body="max_concurrent" type="integer">
  Maximum concurrent calls/messages
</ParamField>

> **Note:** Updates are only allowed while the campaign status is `draft`. Launched campaigns cannot be modified — pause and create a new one instead.

***

## Response `200`

Returns the updated campaign object.

***

## Errors

| Code  | Description                               |
| ----- | ----------------------------------------- |
| `401` | Missing or invalid authentication         |
| `403` | Campaign already launched (cannot modify) |
| `404` | Campaign not found                        |
