Update campaign
https://app.iteras.dk/api/campaigns/updatecampaign/
The API key must allow "Change campaigns".
Changes a campaign, identified by its Iteras id, not by the self-chosen campaign_id. Only the parameters given are changed, and a list or object given replaces the whole value, e.g. all the lines or all of switching, so include what to keep. The change affects the active subscriptions on the campaign, so a new length or new products are often better made as a new campaign the subscriptions continue on.
Editing a line's amount in place changes the price for the periods invoiced after the change,
for every active subscription on the campaign. To change the price from a chosen date instead,
use valid_from and valid_to as described under lines.
To clear a field you added yourself, set it to null.
Parameters
-
id string required
The Iteras ID of the campaign, its
idin the list of campaigns, also returned when creating it. -
campaign_id string
Self-chosen ID for the campaign, e.g.
3months. Must be unique in the account and must not collide with a product's external ID. -
name string
Internal campaign name shown inside Iteras, e.g.
3 months. -
customer_facing_name string
Campaign name shown to customers, e.g.
3 months. -
business_entity string
External ID of the business entity the campaign belongs to, e.g.
DKbranch. Can be left out if the account has only one business entity. -
products array
The products in the campaign, each an object identifying the product by its
external_idor, if it has none, itsname, e.g.[{"external_id": "example_product"}]. When the duration of the campaign is based on counting assignments, one of the objects needsused_for_period_durationset to true, e.g.[{"external_id": "example_product", "used_for_period_duration": true}]. At least one of the account's subscription products is required unlesspro_forma_subscriptionis true.Log in, or send your API key as a bearer token, to see the subscription products set up for your account.
-
duration_based_on string
How the period length is determined:
timefor calendar time, given intime, orassignmentsfor counting assignments of products, given inperiod_assignments. -
time string
Length of each period in calendar time, required when
duration_based_onistime: a number followed byd,w,moryfor days, weeks, calendar months or calendar years, e.g.6m, orfixedto end on the date infixed_date.Durations are written as:
- Nd, e.g.
3dfor 3 days - Nw, e.g.
2wfor 2 weeks - Nm, e.g.
6mfor 6 calendar months, calculated precisely, so not the same as 6×30 days - Ny, e.g.
1yfor 1 calendar year, which handles leap years
- Nd, e.g.
-
period_assignments integer
Number of assigned products in each period, e.g. set it to 3, and the period ends when 3 products have been assigned to the period. Required when
duration_based_onisassignments. -
fixed_date date
Date the period ends, as
YYYY-MM-DD, e.g.2027-03-01. Required whentimeisfixed. -
next_campaign_id string
campaign_idof the campaign the subscription continues on, e.g.3months. For introduction campaigns, this will usually be the permanent campaign. For permanent recurring campaigns, this will usually be the campaign's owncampaign_id. -
repeat_number_of_times integer
How many times in a row the subscription gets a period on the campaign before continuing, e.g. 3.
-
policies array
External IDs of business policies to optionally override the business entity's settings with, e.g.
["no_pause"], as listed with the business policies. The first policy in the list that sets a setting decides it. -
active bool
Whether the campaign is active. An inactive campaign isn't offered in ordering forms or for new subscriptions in Iteras, and existing subscriptions continue on it. Once a campaign has been used, you cannot delete it, but you can make it inactive.
-
lines array
What to invoice for each period, e.g.
[{"text": "3 issues", "amount": 24950, "tax_rate": 0.25, "extra_info": ["period"]}], in the invoice line format. No lines means the campaign is free. A price change is planned with dates: the current line gets avalid_to, and a copy with the new amount gets the same date asvalid_from. -
controlled_group_campaigns array
Any recipient campaigns that can be used for recipient subscriptions for a subscription on this campaign, e.g.
[{"campaign_id": "employee", "max_controlled_subscriptions": 5}].Each object has the following parameters:
-
campaign_id string requiredID of the recipient campaign, e.g.
employee. -
sync_with_controlling_period bool Defaults to
trueSynchronize the recipient subscriptions' periods with the controlling subscription's period, so they can be invoiced together. -
max_controlled_subscriptions integerLimit how many subscriptions the controlling subscription may have on the campaign, e.g.
5. No limit if left out.
-
-
controlled_addon_campaigns array
Any add-on campaigns that can be used for add-on subscriptions for a subscription on this campaign, e.g.
[{"campaign_id": "digital-extra", "max_controlled_subscriptions": 5}].Each object has the following parameters:
-
campaign_id string requiredID of the add-on campaign, e.g.
digital-extra. -
sync_with_controlling_period bool Defaults to
trueSynchronize the add-on subscriptions' periods with the base subscription's period, so they can be invoiced together. -
max_controlled_subscriptions integerLimit how many subscriptions the controlling subscription may have on the campaign, e.g.
5. No limit if left out.
-
-
switching object
Campaigns the customer can switch to, grouped by situation, each a list of objects with
campaign_id, e.g.{"allowed_from_selfservice": [{"campaign_id": "3months"}]}.allowed_from_selfservice, campaigns the customer can switch to from the self-serviceoffered_instead_of_cancel, campaigns offered instead of cancelling in the self-serviceoffered_from_invoice, campaigns offered through a link in the invoice
-
Whether the subscription is only pro forma for accounting purposes and receives nothing.
-
Name of an image from the image library in Iteras to show as the campaign's product image, e.g.
cover.jpg. -
Whether an active subscription gets access to content protected by a paywall.
-
The access to previous products when integrating with digital edition platforms, one of:
"", no productsreceived, assigned productsall, all products while active plus assigned products
-
In case of customer complaints that warrant crediting, you can specify the unit price in cents including tax, e.g.
150for €1.50. -
For subscriptions where products are periodically assigned, e.g. magazines, whether upcoming products are assigned to the subscription automatically. If false, products are not assigned.
You can set any custom campaign field, using its field id (the field name with a colon prepended, or its external identifier).
Log in, or send your API key as a bearer token, to see the custom campaign fields set up for your account.
A yes/no field (type bool) is true or false, and has no value when it isn't set. Set it with true or false, and clear it with null.
Examples
Change the customer facing name and the price:
POST /api/campaigns/updatecampaign/ HTTP/1.1
Content-Type: application/json{
"id": "308",
"customer_facing_name": "3 months",
"lines": [
{ "text": "3 issues", "amount": 29900, "tax_rate": 0.25 }
]
}Change the campaign_id of the campaign:
POST /api/campaigns/updatecampaign/ HTTP/1.1
Content-Type: application/json{
"id": "308",
"campaign_id": "three-issues"
}Return value
On success the endpoint returns the Iteras ID and the campaign ID of the updated campaign:
{ "updated": true, "id": "308", "campaign_id": "3months" }
Errors
Invalid JSON returns 400, and an unknown id returns 404.
A well-formed request with invalid values is not executed and returns 422 with the errors keyed by field.