Skip to main content

Update Campaign

Overview

This endpoint updates an existing campaign by its ID.

Endpoint Details

  • URL: https://api.callab.ai/compaign/v1/campaign/update/{id}
  • Method: POST
  • Authentication: Required (API KEY)

Path Parameters

ParameterTypeRequiredDescription
idUUIDYesThe unique identifier of the campaign to update.

Request Headers

HeaderValueDescription
AuthorizationBearer <api_key>Your API KEY
Content-Typeapplication/jsonRequest body format

Request Body

The request body should be a JSON object with the following structure:
{
  "name": "Updated Campaign Name",
  "notes": "Updated campaign notes",
  "company_id": "550e8400-e29b-41d4-a716-446655440000",
  "owner_user_id": "550e8400-e29b-41d4-a716-446655440001",
  "status": "active",
  "campaign_type": "outbound",
  "contacts_list_source": ["web", "manual"],
  "contacts_list_tags": [["vip"], ["new-customer"]],
  "contacts_list_categories": [["sales"], ["support"]],
  "contacts_list_source_metadata": {
    "web": {
      "source_url": "https://example.com"
    }
  },
  "agent_variables_contact_metadata_mapping": {
    "first_name": "contact.firstname"
  },
  "ai_agent_id": "550e8400-e29b-41d4-a716-446655440002",
  "call_progress": 50,
  "call_time_of_day_from": "09:00:00",
  "call_time_of_day_to": "17:00:00",
  "number_of_call_attempts": [3, 5],
  "retry_delay": [60, 120],
  "retry_delay_unit": ["seconds", "seconds"],
  "days_of_week": [1, 2, 3, 4, 5],
  "time_zone": "UTC",
  "inbound_phone_number_id": "550e8400-e29b-41d4-a716-446655440003",
  "outbound_phone_number_id": "550e8400-e29b-41d4-a716-446655440004",
  "allow_non_local_calls": true,
  "created_at": "2023-10-01T12:00:00Z",
  "updated_at": "2023-10-01T12:00:00Z",
  "deleted_at": null,
  "started_at": "2023-10-01",
  "ended_at": "2023-10-31",
  "webhook_mapping_variables": {
    "event": "call_completed"
  },
  "webhook_mapping_variables_sources": {
    "event": "system"
  },
  "webhook_id": "550e8400-e29b-41d4-a716-446655440005"
}

Request Body Fields

FieldTypeDescription
namestringThe name of the campaign.
notesstringAdditional notes or description for the campaign.
company_idUUIDThe ID of the company associated with the campaign.
owner_user_idUUIDThe ID of the user who owns the campaign.
statusstringThe status of the campaign (e.g., active, paused).
campaign_typestringThe type of campaign (e.g., outbound, inbound).
contacts_list_sourcearraySources of the contacts list (e.g., web, manual).
contacts_list_tagsarrayTags associated with the contacts list.
contacts_list_categoriesarrayCategories associated with the contacts list.
contacts_list_source_metadataobjectMetadata about the contacts list sources.
agent_variables_contact_metadata_mappingobjectMapping of agent variables to contact metadata.
ai_agent_idUUIDThe ID of the AI agent associated with the campaign.
call_progressintegerThe progress of the campaign (e.g., percentage completed).
call_time_of_day_fromstringThe start time for calls (in HH:MM:SS format).
call_time_of_day_tostringThe end time for calls (in HH:MM:SS format).
number_of_call_attemptsarrayNumber of call attempts for each contact.
retry_delayarrayDelay between retry attempts (in seconds).
retry_delay_unitarrayUnit of the retry delay (e.g., seconds).
days_of_weekarrayDays of the week when the campaign is active (e.g., 1 for Monday).
time_zonestringThe time zone for the campaign.
inbound_phone_number_idUUIDThe ID of the inbound phone number.
outbound_phone_number_idUUIDThe ID of the outbound phone number.
allow_non_local_callsbooleanWhether non-local calls are allowed.
created_atstringTimestamp when the campaign was created.
updated_atstringTimestamp when the campaign was last updated.
deleted_atstringTimestamp when the campaign was deleted (if applicable).
started_atstringThe start date of the campaign.
ended_atstringThe end date of the campaign.
webhook_mapping_variablesobjectVariables for webhook mappings.
webhook_mapping_variables_sourcesobjectSources for webhook mapping variables.
webhook_idUUIDThe ID of the webhook associated with the campaign.

Example Request

curl -X POST "https://api.example.com/campaign/update/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Campaign Name",
    "notes": "Updated campaign notes",
    "company_id": "550e8400-e29b-41d4-a716-446655440000",
    "owner_user_id": "550e8400-e29b-41d4-a716-446655440001",
    "status": "active",
    "campaign_type": "outbound",
    "contacts_list_source": ["web", "manual"],
    "contacts_list_tags": [["vip"], ["new-customer"]],
    "contacts_list_categories": [["sales"], ["support"]],
    "contacts_list_source_metadata": {
      "web": {
        "source_url": "https://example.com"
      }
    },
    "agent_variables_contact_metadata_mapping": {
      "first_name": "contact.firstname"
    },
    "ai_agent_id": "550e8400-e29b-41d4-a716-446655440002",
    "call_progress": 50,
    "call_time_of_day_from": "09:00:00",
    "call_time_of_day_to": "17:00:00",
    "number_of_call_attempts": [3, 5],
    "retry_delay": [60, 120],
    "retry_delay_unit": ["seconds", "seconds"],
    "days_of_week": [1, 2, 3, 4, 5],
    "time_zone": "UTC",
    "inbound_phone_number_id": "550e8400-e29b-41d4-a716-446655440003",
    "outbound_phone_number_id": "550e8400-e29b-41d4-a716-446655440004",
    "allow_non_local_calls": true,
    "created_at": "2023-10-01T12:00:00Z",
    "updated_at": "2023-10-01T12:00:00Z",
    "deleted_at": null,
    "started_at": "2023-10-01",
    "ended_at": "2023-10-31",
    "webhook_mapping_variables": {
      "event": "call_completed"
    },
    "webhook_mapping_variables_sources": {
      "event": "system"
    },
    "webhook_id": "550e8400-e29b-41d4-a716-446655440005"
  }'

Response

Success Response

  • Status Code: 200 OK
{
  "status": "ok",
  "message": "ok",
  "data": "Success: Campaign Updated"
}

Error Response

  • Status Code: 200 OK (with error message)
When an error occurs in your endpoint, the server responds with an HTTP status code of 200 OK. However, the response body contains an error message in a structured format to indicate that something went wrong. This approach is sometimes used to standardize API responses, even for errors.
{
  "status": "error",
  "message": "error",
  "data": ""
}