Create, rename or delete promotion configuration
Create a promotion for an article, change its label while keeping a printed code in circulation, or remove the promotion. Before editing, read the current code, targeting flags and selected items.
| Task | Operation |
|---|---|
| Create an article promotion | POST /api/v1/admin/promos |
| Rename a promotion while retaining its code and intended targets | PUT /api/v1/admin/promos/{id} |
| Delete a promotion | DELETE /api/v1/admin/promos/{id} |
Context and examples
Allowed roles: support, admin, partner; root is also permitted. Send the assigned token and publication key. readonly/manager and service accounts cannot write; full_access does not enable these routes. Keep calls in trusted server code. Caller activation, session and current publication-relationship restrictions apply.
| Input | Location / type | Meaning |
|---|---|---|
| resource | Required header, publication public-key string | Selects the promotion's publication, not a numeric ID or secret. |
| token | Required header, existing eligible token string | ADMIN_TOKEN in examples. |
| id | PUT/DELETE path, digit string | Promotion record ID, not the redemption code. |
Create assigns this publication; update/delete select the promotion by ID and publication. Review its activity, dates and usage before changing or removing it. No match returns promo_not_found. Body id/resource_id cannot move ownership. Nondigit routes do not guarantee this JSON error.
Examples use fictional promotion 8201, code EXAMPLEWEEKEND2026 and article weekend-report with stored price 500. Responses are illustrative. Treat codes as sensitive redeemable configuration, not Admin authentication. Requests use cURL, Node.js 18+ fetch in an ES module (.mjs), and Python 3 urllib. Set WALLKIT_API_BASE to scheme and host only, plus RESOURCE_KEY and ADMIN_TOKEN. Scenarios are independent; example.com is stored metadata. See shared errors.
Scalar fields and complete targeting
| Body field | Type / requirement | Meaning and operation difference |
|---|---|---|
| title | Required on POST, optional nonnull assignment on PUT | Trimmed promotion label. |
| code | Optional text, length 6–40 when supplied/nonnull | Trimmed configuration code. Omitted or null generates a new 40-character code on POST and PUT. Explicitly retain the exact intended existing code on rename. Duplicate lookup is case-insensitive within the publication; no race-proof/normalized uniqueness guarantee. |
| discount_type | POST required choice percent or amount; validated when supplied on PUT | Stored setting, not computed checkout behavior. |
| discount | Optional amount-filtered value | Supply the intended amount/percentage. This stores configuration rather than calculating the final price. |
| currency | Optional configured code | Validated when nonnull; no forced uppercase assignment or universal omitted default. |
| description | Optional stored value | Nonnull assignment; omitted/null does not establish a clear instruction on PUT. |
| start_date, end_date | Optional date text | Parsed and stored as Y-m-d H:i:s; no strict ISO-only, ordering, UTC, future-date or current-validity guarantee. Null skips assignment. |
| activations_limit | Optional integer-filtered value | Stored limit; no read/write guarantee that 0 means unlimited or a remaining-quota result. |
| for_all_plans, for_all_bundles, for_all_content, for_all_ti_events | Optional boolean-filtered flags | Nonnull assignment; omitted/null PUT preserves prior flag values. A true flag suppresses inserting its explicit group. for_all_ti_events controls both event-related groups below. |
| available_for | Optional object of five arrays | On every PUT all old target groups are cleared first, even when this property is absent/null; only supplied permitted groups are then re-added. |
active, count_uses and ownership fields are not assigned. Use JSON booleans. Dates, limits, flags and discounts describe settings, not current redemption validity.
discount is filtered to float, then text. A decimal point in the filtered text triggers multiplication by 100 and rounding; otherwise rounding occurs without multiplication. This also applies to percent. There is no universal input unit or exact percentage calculation. The example’s integer-form 10 is illustrative stored configuration, not confirmed 10% checkout savings.
Send selectors, not expanded response objects
Use small selector objects in arrays. Missing fields can be skipped and invalid references do not all produce one missing-record error.
| available_for group | Request selector | Flag / checks and consequences |
|---|---|---|
| subscriptions[] | id: known catalog subscription ID | Inserted only when for_all_plans is false. Subscription must exist and its Plan must belong to the publication. Confirm its availability and intended reader eligibility separately. |
| content[] | key: known stored content key | Inserted only when for_all_content is false. Exact lookup uses the selected publication. Confirm the intended content’s publication, price and availability separately. |
| bundles[] | id: known bundle ID | Inserted only when for_all_bundles is false. Choose an existing bundle from the intended publication/customer context and confirm the reference with your records. |
| available_subscriptions[] | id: known catalog subscription ID | Inserted only when for_all_ti_events is false and the subscription's Plan matches the publication. Missing/outside records can be silently skipped, unlike the regular subscriptions helper. |
| ti_event_tickets[] | id: known event-ticket ID | Inserted only when for_all_ti_events is false. Choose the intended existing event ticket and publication; confirm stock and eligibility separately. Failure response formats can vary. |
Use intended publication records. True broad-target flags skip corresponding list insertion after clearing; empty returned lists do not imply narrow targeting or no available choices.
An error can follow commit or partial target changes. A completed response does not confirm every helper/save. Inspect code, flags and all groups before repeating. Events do not confirm downstream/provider completion.
Create a weekend article promotion
POST /api/v1/admin/promos
Create a promotion for an intended article with an explicit fictional code. Confirm its content key and currency first. This configures a promotion; it does not redeem it.
Request and example
Send the allowed context and JSON fields above. Pagination, filter and sort are ignored. Four broad flags are false; only content selects weekend-report. The other four groups are intentionally empty.
This excerpt shows relevant configuration, all five groups and complete 12-field content. Other known/open fields follow linked definitions; no active/date default is implied. count_uses:0 describes activation rows, not all related transactions.
curl "${WALLKIT_API_BASE}/api/v1/admin/promos" \
-X POST \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
--data '{"title":"Weekend article promotion","code":"EXAMPLEWEEKEND2026","discount_type":"percent","discount":10,"currency":"USD","for_all_plans":false,"for_all_bundles":false,"for_all_content":false,"for_all_ti_events":false,"available_for":{"subscriptions":[],"content":[{"key":"weekend-report"}],"bundles":[],"available_subscriptions":[],"ti_event_tickets":[]}}'
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/promos`);
const response = await fetch(url, {
method: "POST",
headers: {"resource": process.env.RESOURCE_KEY, "token": process.env.ADMIN_TOKEN, "Content-Type": "application/json"},
body: JSON.stringify({"title": "Weekend article promotion", "code": "EXAMPLEWEEKEND2026", "discount_type": "percent", "discount": 10, "currency": "USD", "for_all_plans": false, "for_all_bundles": false, "for_all_content": false, "for_all_ti_events": false, "available_for": {"subscriptions": [], "content": [{"key": "weekend-report"}], "bundles": [], "available_subscriptions": [], "ti_event_tickets": []}})
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
url = os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/promos"
body = json.dumps({'title': 'Weekend article promotion', 'code': 'EXAMPLEWEEKEND2026', 'discount_type': 'percent', 'discount': 10, 'currency': 'USD', 'for_all_plans': False, 'for_all_bundles': False, 'for_all_content': False, 'for_all_ti_events': False, 'available_for': {'subscriptions': [], 'content': [{'key': 'weekend-report'}], 'bundles': [], 'available_subscriptions': [], 'ti_event_tickets': []}}).encode("utf-8")
request = Request(
url,
data=body,
headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"], "Content-Type": "application/json"},
method="POST"
)
try:
with urlopen(request) as response:
print(response.status, json.load(response))
except HTTPError as error:
print(error.code, json.load(error))
HTTP 201 response excerpt:
{
"id": 8201,
"title": "Weekend article promotion",
"code": "EXAMPLEWEEKEND2026",
"discount_type": "percent",
"discount": 10,
"currency": "USD",
"for_all_plans": false,
"for_all_bundles": false,
"for_all_content": false,
"for_all_ti_events": false,
"available_for": {
"subscriptions": [],
"content": [
{
"key": "weekend-report",
"title": "Weekend report",
"description": "Illustrative article metadata.",
"price": 500,
"currency": "USD",
"extra": {},
"link": "https://example.com/articles/weekend-report",
"created_at": "2026-11-03 12:00:00",
"updated_at": "2026-11-03 12:00:00",
"published_at": null,
"images": [],
"is_payable_content": true
}
],
"bundles": [],
"available_subscriptions": [],
"ti_event_tickets": []
},
"count_uses": 0
}
Alternative: The intended code is already used
HTTP 409 response:
{
"error": "invalid_code",
"error_description": "This code already used",
"req_guid": "synthetic-request-reference"
}
Inspect existing configuration. This duplicate-code check precedes writes; other failures can follow them.
Recovery and next task
| HTTP status | API code / shape | Cause | Next action |
|---|---|---|---|
| 406 | incorrect_data / Body must be json format | Missing JSON or a value treated as empty by the API. | Send the intended object. |
| 409 | invalid_{field}, invalid_date_format or invalid_code | Field/date validation or publication code conflict. | Correct the reported value; do not infer usable dates/discounts from parsing alone. |
| 406 | invalid_subscription, invalid_bundle, invalid_promo, resource_access or invalid_available_list / message | Target/link processing failed; checks differ by group. | Inspect intended references, flags and persisted targets before retrying. |
| 406 / varies | created_promo_fail / Created promo is failed, or other runtime/transport failure | Save/event/response or another failure, possibly after commit. | Retain diagnostics and inspect stored configuration; no unchanged-state or safe-retry guarantee. |
Read the promotion using its numeric ID to inspect stored settings.
Rename a promotion while keeping its printed code
PUT /api/v1/admin/promos/{id}
Retaining a printed code and targets requires resending both. Omitted/null code generates a new code. Every update clears all five target lists, even when available_for is omitted.
- Read current configuration: code, groups and flags.
- Decide the full target set. Send the exact code; choose flags deliberately, since true skips the corresponding list and for_all_ti_events governs two groups.
- Use the example only for one-article targeting with four intentionally empty groups. Do not overwrite unrelated targets with these empty arrays.
Request and example
Promotion 8201 has printed code EXAMPLEWEEKEND2026, one article, four empty groups and four false broad flags. The request changes title while retaining those settings. Discount, dates and limit stay unchanged.
The response is a configuration excerpt with full linked content; omitted known/open fields follow the definitions above.
curl "${WALLKIT_API_BASE}/api/v1/admin/promos/8201" \
-X PUT \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
--data '{"title":"Weekend reading promotion","code":"EXAMPLEWEEKEND2026","for_all_plans":false,"for_all_bundles":false,"for_all_content":false,"for_all_ti_events":false,"available_for":{"subscriptions":[],"content":[{"key":"weekend-report"}],"bundles":[],"available_subscriptions":[],"ti_event_tickets":[]}}'
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/promos/8201`);
const response = await fetch(url, {
method: "PUT",
headers: {"resource": process.env.RESOURCE_KEY, "token": process.env.ADMIN_TOKEN, "Content-Type": "application/json"},
body: JSON.stringify({"title": "Weekend reading promotion", "code": "EXAMPLEWEEKEND2026", "for_all_plans": false, "for_all_bundles": false, "for_all_content": false, "for_all_ti_events": false, "available_for": {"subscriptions": [], "content": [{"key": "weekend-report"}], "bundles": [], "available_subscriptions": [], "ti_event_tickets": []}})
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
url = os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/promos/8201"
body = json.dumps({'title': 'Weekend reading promotion', 'code': 'EXAMPLEWEEKEND2026', 'for_all_plans': False, 'for_all_bundles': False, 'for_all_content': False, 'for_all_ti_events': False, 'available_for': {'subscriptions': [], 'content': [{'key': 'weekend-report'}], 'bundles': [], 'available_subscriptions': [], 'ti_event_tickets': []}}).encode("utf-8")
request = Request(
url,
data=body,
headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"], "Content-Type": "application/json"},
method="PUT"
)
try:
with urlopen(request) as response:
print(response.status, json.load(response))
except HTTPError as error:
print(error.code, json.load(error))
HTTP 200 response excerpt:
{
"id": 8201,
"title": "Weekend reading promotion",
"code": "EXAMPLEWEEKEND2026",
"discount_type": "percent",
"discount": 10,
"currency": "USD",
"for_all_plans": false,
"for_all_bundles": false,
"for_all_content": false,
"for_all_ti_events": false,
"available_for": {
"subscriptions": [],
"content": [
{
"key": "weekend-report",
"title": "Weekend report",
"description": "Illustrative article metadata.",
"price": 500,
"currency": "USD",
"extra": {},
"link": "https://example.com/articles/weekend-report",
"created_at": "2026-11-03 12:00:00",
"updated_at": "2026-11-03 12:00:00",
"published_at": null,
"images": [],
"is_payable_content": true
}
],
"bundles": [],
"available_subscriptions": [],
"ti_event_tickets": []
},
"count_uses": 0
}
Explicit code and complete targeting retain this example’s settings. Omitting them changes update behavior.
Alternative: No promotion in this publication
HTTP 404 response:
{
"error": "promo_not_found",
"error_description": "Promo not found",
"req_guid": "synthetic-request-reference"
}
No ID matched this publication. The record may exist elsewhere.
Recovery and next task
| HTTP status | API code / shape | Cause | Next action |
|---|---|---|---|
| 404 | promo_not_found / Promo not found | No matching promotion ID/publication. | Check known numeric ID and publication. |
| 406 | incorrect_data / Body must be json format | Missing JSON or a value treated as empty by the API. | Send the complete intended object, including retained code/target set for this task. |
| 409 | invalid_{field}, invalid_date_format or invalid_code | Supplied field/date/code fails validation. | Correct the reported input; keep exact retained code and intended groups explicit. |
| 406 | invalid_subscription, invalid_bundle, invalid_promo, resource_access or invalid_available_list / message | Target re-addition fails after clearing may have begun. | Inspect persisted code, flags and all five target groups before retrying. |
| 412 / varies | update_promo_fail / Update promo is failed, or unnormalized routing/runtime/transport failure | Later write/event/response failure, potentially after commit. | Retain diagnostics and read stored configuration; do not assume rollback, unchanged code/targets or safe repetition. |
Read saved configuration and compare code, flags and all five groups. This does not decide checkout applicability.
Delete promotion configuration
DELETE /api/v1/admin/promos/{id}
Delete a publication promotion. Applied cascades can remove activation/invite and target links, affecting history. Review reporting uses first. Referenced content/catalog/event records are not directly removed. Handle payment reversals and refunds separately.
Request and example
Send the allowed context and numeric ID without a body. Code selectors, pagination, filter and sort are not inputs. Review dependencies before removal. Failures can occur before deletion or afterward during event/response work; inspect stored configuration and history before repeating.
Assume the fictional promotion exists and database constraints permit deletion.
curl "${WALLKIT_API_BASE}/api/v1/admin/promos/8201" \
-X DELETE \
-H "resource: ${RESOURCE_KEY}" \
-H "token: ${ADMIN_TOKEN}"
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/promos/8201`);
const response = await fetch(url, {
method: "DELETE",
headers: {"resource": process.env.RESOURCE_KEY, "token": process.env.ADMIN_TOKEN}
});
console.log(response.status, await response.json());
import os, json
from urllib.request import Request, urlopen
from urllib.error import HTTPError
url = os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/promos/8201"
request = Request(
url,
headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"]},
method="DELETE"
)
try:
with urlopen(request) as response:
print(response.status, json.load(response))
except HTTPError as error:
print(error.code, json.load(error))
HTTP 200 response:
{
"result": true
}
| Field | Type / presence | Meaning |
|---|---|---|
| result | Boolean; added | Model delete result; false is possible. Not a fixed acknowledgment, full cleanup/history-retention audit or refund/access result. |
Alternative: Promotion not found
HTTP 404 response:
{
"error": "promo_not_found",
"error_description": "Promo not found",
"req_guid": "synthetic-request-reference"
}
A repeated delete can return not found instead of success.
Recovery and next task
| HTTP status | API code / shape | Cause | Next action |
|---|---|---|---|
| 404 | promo_not_found / Promo not found | No matching ID/publication record. | Inspect known configuration without inferring global absence. |
| 200 | result:false | Model delete returned false. | Inspect stored state and available diagnostics before another action. |
| 500 | incorrect_method / Incorrect method | Wrong method if this action is reached. | Use the registered DELETE route; unmatched routes have no guaranteed action JSON. |
| Varies / no guaranteed JSON | Snapshot/constraint/event/runtime/transport failure | Error formats can vary, and history/configuration may already have changed. | Keep diagnostics and inspect persisted state; no atomic recovery, safe retry or exhaustive cascade promise. |
Browse promotions for remaining configuration. History, redemption and payment reconciliation are separate tasks.
Read the expanded result
Create returns 201; update returns 200. Both return top-level configuration fields, without items/paginator. The 18 declared fields are not a closed schema. available_for and count_uses are added; count_uses counts activation rows, not unique readers, purchases or remaining quota.
All five arrays are present, including empty ones, using linked-record fields:
| Response group | Type / presence | Fields returned |
|---|---|---|
| available_for.subscriptions[] | Array; present | General subscription, 14-field immediate Plan and five-field children. Next/downgrade keep compact Plans and defined nesting limits; Admin fields remain conditional. |
| available_for.content[] | Array; present | 12 content fields, without numeric ID, taxonomy, VAT or content_type. |
| available_for.bundles[] | Array; present | id,title,price,currency,created_at; no items expansion. Confirm the intended bundle context separately. |
| available_for.available_subscriptions[] | Array; present | Same subscription/Plan fields as subscriptions[]. |
| available_for.ti_event_tickets[] | Array; present | 18 ticket fields plus 14 parent-event fields and photo slug/url. No passes, available quantity or Plan discount. |
The linked definitions cover full types, image/event fields and conditions. Linked records can belong to other publications. Subscriptions and Plans can be inactive or private; content shows stored metadata and its publication timestamp. Other linked objects follow their own field definitions. Invalid links can fail responses. Handle application-defined configuration and extra as confidential data. Request selectors differ from returned objects.