Skip to main content

Altering a campaign

Contents

Overview

PropertyValue
Call namealter-campaign
Endpoint URLhttps://{API hostname}/internal/alter-campaign
Request methodsPOST, PUT
Request Content-Typeapplication/json, application/x-www-form-urlencoded
Response Content-Typeapplication/json
Auth requiredyes

The alter-campaign endpoint is used to update an existing campaign. It accepts the same campaign fields as add-campaign, with the addition of a mandatory campaign_id parameter to identify the campaign to update. For a detailed breakdown of campaign types and fields, see the Campaign types and fields page.

Version-specific information

There is currently no version-specific information for this endpoint.

Permissions and authentication

The performing user needs to be logged in and have write access to the entity (business or chain) to which the campaign is connected. The user must have permissions_business_chain_campaign set to true in the permissions table.

HTTP parameters

The following HTTP parameters can be passed to the API:

ParameterDescription
campaign_id(integer, mandatory) The ID of the campaign to update.
is_default(boolean, optional) For loyalty, wallet, and points_wallet campaign types, this flag marks the campaign as the default for its chain. For loyalty campaigns, only one active default loyalty campaign is allowed per chain. Attempting to set a second active loyalty campaign as default will return a parameter_invalid error.

All other campaign fields that can be passed to the add-campaign endpoint can also be passed to this endpoint to update the campaign. For a detailed breakdown of campaign types and fields see the Campaign types and fields page.

Headers

The following headers can/must be passed to the API call:

ParameterDescription
N/AN/A

Sample request

Example curl request to update a loyalty campaign and set it as the default:

curl -X PUT https://{API hostname}/internal/alter-campaign \
-H "X-Spaaza-Session-User-Id: 1548854" \
-H "X-Spaaza-Session-Key: 564e5b4faa7f639dacf1983f1dae62155d5734b789b06b5986c43bfe2542854e" \
-H "Content-Type: application/json" \
-d '{
"campaign_id": 1234,
"title": "ACME Loyalty Programme",
"is_default": true
}'

Sample response

Returns an OK code and a JSON representation of the updated campaign:

{
"result": {
"code": 1,
"status": "ok"
},
"results": {
"campaign": {
"id": 1234,
"chain_id": 1,
"title": "ACME Loyalty Programme",
"description": "ACME loyalty programme with multiple membership levels",
"active": true,
"active_time_from": null,
"active_time_until": null,
"active_weekdays": null,
"operator_type": "or",
"created_date": "2025-11-15T10:30:00+00:00",
"last_modified_date": "2026-03-22T11:00:00+00:00",
"rounding_strategy": "neutral",
"rounding_precision": 2,
"created_voucher_claimed_by_default": false,
"voucher_expiry_days": 365,
"excludes_assignment_matches": false,
"recipient_reward_method": "voucher",
"recipient_reward_amount": 5,
"recipient_reward_discount_ratio": 0,
"currency": {
"currency_id": 2,
"currency_code": "EUR",
"currency_name_en": "Euro",
"currency_symbol": "\u20ac"
},
"is_active": true,
"is_deleted": false,
"is_default": true,
"excludes_referred_users": false,
"visible_to_all_user_segments": true,
"type": "loyalty",
"minimum_basket_total_value_earn": 0,
"maximum_basket_total_value_earn": null,
"minimum_basket_total_value_spend": null,
"maximum_basket_total_value_spend": null,
"redemption_grace_period": 0,
"last_updated_date": "2026-03-22T11:00:00+00:00",
"field_localisations": null,
"assignment_count": 0,
"parameters": [],
"image_filename": null,
"image_url": null,
"image_link": null,
"image_dimension_x": null,
"image_dimension_y": null,
"supports_contribution": false,
"is_contributor": false,
"recipient_campaign_id": null,
"supports_user_segments": true,
"user_segment_id": null,
"excluded_user_segment_id": null,
"voucher_title": null,
"voucher_description": null,
"voucher_notes": null,
"voucher_text": null,
"voucher_image_url": null
},
"result_type": "alter-campaign"
}
}

Possible error responses

The following represents a list of possible error responses for the alter-campaign endpoint:

CodeName and DescriptionHTTP Status Code
6no_valid_session
The user needs to be logged in and a valid session key needs to be sent
401
68permission_denied_or_non_existent
This user has insufficient permissions for this object or the object does not exist.
403
244campaign_id_invalid
The campaign_id passed must be an integer
400
245campaign_id_not_present
The campaign_id must be passed as a parameter
400
246campaign_id_not_found
The campaign_id supplied could not be found.
404
419parameter_invalid
One of the parameters is invalid and should be in a different format.
400