Skip to main content
POST
/
update-campaign
Update campaign
curl --request POST \
  --url https://www.tryunleashx.com/api/v1/global/update-campaign \
  --header 'Content-Type: application/json' \
  --header 'token: <token>' \
  --data '
{
  "id": 123,
  "agent_id": 123,
  "campaign_name": "<string>",
  "description": "<string>",
  "start_date": "2023-12-25",
  "end_date": "2023-12-25",
  "max_retry": 49,
  "max_delay": "<string>",
  "campaign_status": "draft",
  "conditions": [
    {
      "rules": [
        {
          "field": "<string>",
          "operator": "==",
          "value": "<string>"
        }
      ],
      "join": "OR"
    }
  ]
}
'
Use this endpoint to update an existing campaign.

Endpoint

POST /update-campaign Content-Type: application/json Authentication: Required (workspace auth)

Request Body

To update a campaign, send its id and any fields you want to change.
{
  "id": 42,
  "agent_id": 123,
  "campaign_name": "Winter Sale Campaign - Updated",
  "description": "Updated description for winter offer campaign",
  "start_date": "2025-12-05",
  "end_date": "2026-01-05",
  "max_retry": 5,
  "max_delay": "{\"d\":1,\"h\":2,\"m\":30}",
  "campaign_status": "inprogress",
  "conditions": [
    {
      "rules": [
        { "field": "status", "operator": "==", "value": "active" },
        { "field": "region", "operator": "==", "value": "US" }
      ]
    },
    {
      "join": "OR",
      "rules": [
        { "field": "priority", "operator": "==", "value": "high" }
      ]
    }
  ]
}

Notes

  • id is required — it identifies the campaign to update.
  • Only the fields you send are updated.
  • campaign_status accepts a string value: draft, inprogress, hold, or pause.
  • max_delay must be passed as a JSON string with keys d (days), h (hours), and m (minutes) as numbers.
  • start_date and end_date must be in YYYY-MM-DD format (e.g., "2025-12-05").
  • max_retry cannot be greater than 50.

Conditions Format

The conditions field accepts an array of groups. Each group contains rules that are evaluated together. Structure:
FieldTypeRequiredDescription
joinstringNo"OR" or "AND" — how this group connects with the previous group. Omit for the first group.
rulesarrayYesArray of condition rules within this group. Rules within a group are always joined with AND.
Each rule:
FieldTypeRequiredDescription
fieldstringYesThe field name to evaluate (from agent’s metadata input fields)
operatorstringYesOne of the allowed operators (see table below)
valuestringYesThe value to match against
Allowed operators:
OperatorDescription
==Equals (case-insensitive)
!=Not equals
>Greater than (numeric)
>=Greater than or equal (numeric)
<Less than (numeric)
<=Less than or equal (numeric)
containsValue contains the substring
startsWithValue starts with the string
endsWithValue ends with the string
Logic:
  • Rules within the same group are joined with AND.
  • Groups are joined with each other using the join field ("OR" or "AND").
Example — single condition:
"conditions": [
  {
    "rules": [
      { "field": "status", "operator": "==", "value": "active" }
    ]
  }
]
This means: status == “active” Example — multiple conditions with AND (same group):
"conditions": [
  {
    "rules": [
      { "field": "status", "operator": "==", "value": "active" },
      { "field": "region", "operator": "==", "value": "US" }
    ]
  }
]
This means: status == “active” AND region == “US” Example — two groups with OR:
"conditions": [
  {
    "rules": [
      { "field": "status", "operator": "==", "value": "active" },
      { "field": "region", "operator": "==", "value": "US" }
    ]
  },
  {
    "join": "OR",
    "rules": [
      { "field": "priority", "operator": "==", "value": "high" }
    ]
  }
]
This means: (status == “active” AND region == “US”) OR (priority == “high”) To clear conditions, send "conditions": null.

Example cURL

curl -X POST https://www.tryunleashx.com/api/v1/global/update-campaign \
  -H "Content-Type: application/json" \
  -H "token: <api_key>" \
  -d '{
    "id": 42,
    "campaign_name": "Winter Sale Campaign - Updated",
    "start_date": "2025-12-05",
    "end_date": "2026-01-05",
    "max_retry": 5,
    "max_delay": "{\"d\":1,\"h\":2,\"m\":30}",
    "campaign_status": "inprogress",
    "conditions": [
      {
        "rules": [
          { "field": "status", "operator": "==", "value": "active" }
        ]
      }
    ]
  }'

Headers

token
string
required

API token for authentication

Body

application/json
id
integer
required

Campaign ID to update

agent_id
integer

Updated voice agent to use for this campaign

campaign_name
string

Updated campaign name (must remain unique within workspace)

description
string

Updated description

start_date
string<date>

Updated start date in YYYY-MM-DD format (e.g. 2025-12-05)

end_date
string<date>

Updated end date in YYYY-MM-DD format (e.g. 2026-01-05)

max_retry
integer

Updated maximum retry attempts (cannot be greater than 50)

Required range: x <= 50
max_delay
string

Delay between retries as a JSON string. Keys: d (days), h (hours), m (minutes) with numeric values. Example: {"d":1,"h":2,"m":30}

campaign_status
enum<string>

Updated campaign status.

Available options:
draft,
inprogress,
hold,
pause
conditions
object[]

Condition groups with AND/OR logic. Each group contains rules joined by AND. Groups are joined by the 'join' field (OR or AND).

Response

Campaign updated successfully