Change reader memberships and inspect history

Give a reader a subscription, change membership dates or renewal settings, remove a membership, or read its history. Mutation paths use the catalog subscription ID, not the membership relationship ID.

Choose the task

TaskOperationAllowed credentials
Add a subscription, possibly replacing another membershipPOST /api/v1/admin/users/{user_id}/subscriptions/{id}support, admin or partner, or root
Change membership dates or renewal choicesPUT /api/v1/admin/users/{user_id}/subscriptions/{id}support, admin or partner, or root
Remove a membershipDELETE /api/v1/admin/users/{user_id}/subscriptions/{id}support, admin or partner, or root
Inspect archived membership recordsGET /api/v1/admin/users/{user_id}/history/subscriptions/listreadonly, manager, support, admin or partner, or root

Membership changes affect Wallkit state. They do not confirm provider charges, refunds or billing cancellation. Check content access separately before serving protected content. Adding can replace memberships; read the effects below before choosing that call.

Credentials and identifiers

Use the assigned token and publication public-key resource headers. Write roles: support, admin, partner. History read roles: readonly, manager, support, admin, partner. Root is also permitted. Service accounts cannot use these routes, including those with full_access.

InputLocation / typeMeaning
resourceRequired header, publication public-key stringSelects publication context; not a numeric resource ID or secret.
tokenRequired header, existing authorized token stringADMIN_TOKEN in examples is this existing credential. A reader’s ordinary token does not automatically grant these operations.
user_idRequired digits-only path valueReader ID from the intended audience record; not a session ID or resource UID.
idRequired digits-only path value on mutationsCatalog subscription ID, not a membership relationship ID. For example, subscription 2001, not historical relationship 4001.

Choose the reader from your intended audience records and the catalog subscription from this publication. The subscription’s Plan must belong to the publication. The history read requires an existing reader/publication relationship; missing or unlinked-reader errors can vary.

Example conventions

Examples use fictional reader 1002, catalog subscription 2001, Plan 3001 and archived relationship 4001. Requests use cURL, Node.js 18+ fetch in an ES module (.mjs), and Python 3 urllib. Keep privileged calls in trusted server code. Set WALLKIT_API_BASE to scheme and host only, plus existing RESOURCE_KEY and ADMIN_TOKEN. Check HTTP status and result separately.

Add or replace a membership

POST /api/v1/admin/users/{user_id}/subscriptions/{id}

Attach a catalog subscription to a reader. A different subscription in the same Plan can be archived and replaced. With the publication’s single-subscription setting, other memberships in that publication can also be archived and removed. Confirm this wider change before calling.

Before you call

Use the token, publication key, reader ID and catalog subscription ID. The Plan must belong to this publication, and the subscription needs a usable billing period. An exact existing membership is rejected. Select the intended catalog option with your operator, including its availability and billing settings.

The call changes membership state and emits events; its acknowledgement does not confirm configured automation.

Request

Send the headers and path IDs without a body. Use the update task for stored dates or renewal choices; this add call uses the catalog settings described below.

Dates, renewal and replacement effects

The new end date normally uses now plus the catalog period. Remaining time carries forward only when the caller is the target reader and the selected subscription has a positive price. Do not assume an Admin change stacks time. A trial period is not applied automatically.

When the caller differs from the reader, the new membership has autorenew: false. Inspect the result, then use update for a stored date or renewal change.

Replacement archives and removes old memberships and creates a new relationship ID. Sponsorships can expire, recipient slots can be cleared and dependent memberships can be removed. Depending on the configured cleanup, this reader’s content-view records can also be cleared across publications. Review those records before adding a subscription that replaces an existing membership.

Response

HTTP 201 returns result: true when membership processing completes without a reported exception. It returns no membership ID or dates, and does not confirm every optional history, event, sponsorship or notification action.

Example: Add catalog subscription 2001

curl -X POST "${WALLKIT_API_BASE}/api/v1/admin/users/1002/subscriptions/2001" \
  -H "resource: ${RESOURCE_KEY}" \
  -H "token: ${ADMIN_TOKEN}"
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/users/1002/subscriptions/2001`);
const response = await fetch(url, {
  method: "POST",
  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/users/1002/subscriptions/2001"
request = Request(url,
    headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"]},
    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 result:

{"result":true}

Read current memberships for dates and flags. The path selected subscription 2001; the response does not identify the new relationship.

If the membership already exists

An exact existing membership returns HTTP 404. Synthetic error excerpt:

{"error":"user_subscription_exist","error_description":"Relations user subscription already exists"}

Inspect the membership and use update if needed; do not repeat creation.

Recovery

Use shared recovery, plus:

HTTP statusAPI code / shapeCauseNext action
404user_not_existsThe reader account was not found.Confirm the intended audience ID.
404subscriptions_not_existsCatalog subscription missing or belongs to another publication.Check the catalog ID and publication; do not substitute a membership relationship ID.
404user_subscription_existReader already has that exact catalog subscription.Inspect it; use update for dates/flags.
406incorrect_subscription_settingsMembership processing rejected configuration or eligibility, such as a missing period or an applicable once-only restriction.Ask the operator to inspect the selected subscription and existing membership/history state.
409attach_user_subscription_failAnother caught attachment failure.Reconcile state and event/provider effects before repeating.

Saved membership changes, emitted events and optional actions may not all complete together. Inspect current state before repeating an uncertain add, because replacement can affect other records.

Next task

Inspect current memberships, then update dates or renewal choices if needed. Use history below for archived relationships.

Change membership dates or renewal choices

PUT /api/v1/admin/users/{user_id}/subscriptions/{id}

Change an existing membership’s expiration or stored flags. This keeps the same catalog subscription and does not calculate a trial expiration.

Before you call

Use a permitted token and the reader/catalog IDs. The exact membership must exist and its Plan must belong to this publication. Memberships with a parent relationship, such as sponsored multi-seat recipients, cannot be updated here.

Request

Send JSON with Content-Type: application/json. All fields are optional. An empty object keeps the same subscription and does not clear fields.

FieldType / presenceMeaning and constraints
subscription_end_dateDate/time string; omitted/null preservesNew membership expiration. Parsed as a date/time then stored as Y-m-d H:i:s; timezone/offset is not retained in that formatted value. Use an explicit unambiguous timestamp; no universal stored timezone is promised. Empty text can mean the current time rather than clearing expiration.
autorenewBoolean input; omitted/null preservesStored membership renewal choice. It is not an immediate provider billing change or cancellation confirmation.
is_trialBoolean input; omission preservesTrial flag. True requires a nonempty catalog trial period; it does not compute the expiration date. Explicit null still enters conversion, so do not use null to mean preserve.
is_allowed_next_subscriptionBoolean input; omitted/null preservesStored permission to advance to a configured next subscription; no immediate switch.

Use JSON booleans and confirm renewal settings with your operator. Changing autorenew stores the membership choice; it does not confirm provider synchronization. A successful update records the acting administrator and emits change/synchronization events. It does not create a history snapshot or automatically propagate changes to child memberships.

Response

HTTP 200 contains boolean result, the save outcome. False means the change did not report a successful save. The membership itself is not returned.

Example: Set an expiration and disable stored renewal

curl -X PUT "${WALLKIT_API_BASE}/api/v1/admin/users/1002/subscriptions/2001" \
  -H "resource: ${RESOURCE_KEY}" \
  -H "token: ${ADMIN_TOKEN}" \
  -H "Content-Type: application/json" \
  --data-raw '{"subscription_end_date": "2026-12-01T00:00:00+00:00", "autorenew": false}'
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/users/1002/subscriptions/2001`);
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({"subscription_end_date": "2026-12-01T00:00:00+00:00", "autorenew": false})
});
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/users/1002/subscriptions/2001"
body = json.dumps({'subscription_end_date': '2026-12-01T00:00:00+00:00', 'autorenew': False}).encode("utf-8")
request = Request(url,
    headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"], "Content-Type": "application/json"},
    method="PUT", data=body)
try:
    with urlopen(request) as response:
        print(response.status, json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))

HTTP 200 result:

{"result":true}

The save reported success. Read the membership for its formatted expiration and renewal flag.

If the save reports false

A save can report false while HTTP remains 200:

{"result":false}

Keep your application’s previous state until you inspect the membership. Ask your operator to investigate the failed save.

Recovery

Use shared recovery, plus:

HTTP statusAPI code / shapeCauseNext action
406incorrect_dataMissing JSON or a value treated as empty by the API.Send a JSON object with the intended fields and media type.
404user_not_exists, subscriptions_not_exists, user_subscription_not_existGlobal reader, catalog subscription or exact membership missing.Check the distinct IDs and current membership.
409subscriptions_not_existsSubscription belongs to another publication.Correct publication/catalog context; this status differs from add/remove.
409sponsored_subscriptions_slotMembership has a parent relationship and cannot be updated here.Ask the operator to use the appropriate sponsorship workflow.
406incorrect_subscription_end_dateA caught date-parser failure.Use an unambiguous date/time string; null or empty text is not a clear-expiration operation.
409incorrect_subscription_trialTrial flag requested without a configured trial period.Leave trial false or ask the operator about the catalog configuration.
409update_subscription_errorAnother caught update failure.Retain request reference and inspect persisted state before repeating.
200result:falseSave did not report success.Re-read state; do not treat HTTP success as a saved change.

An event can fail after the save. Inspect current state before repeating an uncertain update; an error does not guarantee rollback.

Next task

Inspect current memberships for saved values. Use a content-access check before serving protected content.

Remove a membership

DELETE /api/v1/admin/users/{user_id}/subscriptions/{id}

Remove one reader/catalog membership. The call attempts to archive it and update sponsorships as part of removal. A failed deletion can leave archive records, events or sponsorship changes in place.

Before you call

Use the permitted token and reader/catalog IDs. The exact membership must exist and its Plan must belong to this publication. Review sponsorships and dependent memberships before removal.

Wider effects: depending on the configured cleanup, this reader’s content-view records can be cleared across publications. Removal can also affect dependent memberships. Gifted sponsorships can be marked expired; multi-seat recipient slots can be cleared and their activation code renewed.

Request

Send the DELETE request with the reader and catalog subscription IDs, without a body. There is no provider-cancellation, refund or metering-history option.

Response

HTTP 200 returns boolean result, the delete outcome. It does not confirm every earlier optional action. Other memberships and grants can still allow access.

Example: Remove subscription 2001 from reader 1002

curl -X DELETE "${WALLKIT_API_BASE}/api/v1/admin/users/1002/subscriptions/2001" \
  -H "resource: ${RESOURCE_KEY}" \
  -H "token: ${ADMIN_TOKEN}"
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/users/1002/subscriptions/2001`);
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/users/1002/subscriptions/2001"
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 result:

{"result":true}

The delete reported success. Review remaining memberships and access.

If deletion reports false

HTTP 200 can also report:

{"result":false}

Deletion did not report success, but archives, events or sponsorship cleanup may already have changed. Inspect those records before repeating the request.

Recovery

Use shared recovery, plus:

HTTP statusAPI code / shapeCauseNext action
404user_not_existsThe reader account was not found.Confirm reader identity.
404subscriptions_not_existsCatalog subscription missing or belongs to another publication.Check catalog ID and publication context.
404user_subscription_not_existExact reader/subscription membership missing.Inspect current memberships; a prior removal may already have taken effect.
409store_user_subscription_historyArchiving raised an exception before removal.Ask the operator to inspect archive/current state before repeating.
200result:falseDelete did not report success; earlier work may have occurred.Check current membership, archive and applicable sponsorship state.
Not uniformly specifiedLater sponsorship/event/delete failureThese later failures do not all have a normalized error response here.Retain request context and reconcile state; do not infer complete rollback from the error.

The response does not confirm that every archive or related change completed together. Check history and current state after an uncertain result before repeating removal.

Next task

Read archived memberships and current memberships to reconcile the change.

Inspect archived memberships

GET /api/v1/admin/users/{user_id}/history/subscriptions/list

Read archived memberships for a reader in this publication. Archives can explain removal or replacement; they do not record every date/flag update or payment/refund.

Before you call

Use a readonly-or-inherited Admin token, or root, with the publication key. Service accounts cannot use this route. Start with a known reader related to this publication. If the read fails, confirm those records before retrying; missing or unlinked-reader errors vary.

Request

No body is needed.

NameLocationType / requirementMeaning and constraints
user_idPathRequired digits-only reader IDReader whose publication history is selected.
limitQueryOptional integer; default 10Accepted values are 1 through 99. Other values, including 100, fall back to 10.
pageQueryOptional integer; default 1Positive page; zero/negative values fall back to 1. Pages beyond the last are not clamped.

Supported query inputs are page and limit. Results are sorted by archived relationship ID descending, which can differ from archive-time order.

Response

HTTP 200 returns items and paginator. Empty or out-of-range pages have items: []; an empty history can have total_pages: 0.

FieldType / presenceMeaning
paginator.current_page, paginator.pageIntegersNormalized requested page.
paginator.limitIntegerNormalized page size.
paginator.total_items, paginator.total_pagesNumeric count / page countMatching archive records and calculated page count.
itemsArrayArchive records; empty when this page has no rows.
items[].relationship_idStored numeric IDArchived membership relationship ID, not the catalog ID used in mutation paths.
items[].plan_id, items[].plan_titleNumeric reference/null; text/nullPlan ID/title, falling back to saved archive values when needed.
items[].subscription_id, items[].subscription_titleNumeric reference/null; text/nullCatalog ID/title, distinct from relationship_id. Missing values can fall back to the archive.
items[].subscription_start_date, items[].subscription_end_dateStored timestamps, potentially nullMembership dates; timezone unspecified.
items[].is_trial_subscriptionStored flagArchived trial state; not explicitly converted to a JSON boolean.
items[].new_subscription_idNullable stored numeric referenceReplacement catalog subscription, when recorded.
items[].new_relationship_idNullable stored numeric referenceReplacement relationship, when recorded; it may no longer exist.
items[].is_attached_by_adminBooleanDerived from the stored actor ID’s format. False does not reliably prove self-service.
items[].admin_idNullable stored numeric referenceStored acting-account reference. It may identify the original membership actor rather than the later remover.
items[].sponsored_subscription_slotObject/nullSlot with sponsorship and sponsor fields defined in identity membership. Recipient details are not added.

Titles use current joined catalog records when available, then saved archive values. They may have changed since archival, as may sponsorship-slot details. Archive items add no standalone amount, currency, charge status or autorenew field, no top-level reader profile and no extra archive-created-at field. Nested sponsorship fields follow the linked definition.

Example: Read the removed membership’s archive

curl -X GET "${WALLKIT_API_BASE}/api/v1/admin/users/1002/history/subscriptions/list" \
  --get \
  -H "resource: ${RESOURCE_KEY}" \
  -H "token: ${ADMIN_TOKEN}" \
  --data-urlencode page=1 \
  --data-urlencode limit=10
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/users/1002/history/subscriptions/list`);
url.search = new URLSearchParams({"page": "1", "limit": "10"}).toString();
const response = await fetch(url, {
  method: "GET",
  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
from urllib.parse import urlencode

url = os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/users/1002/history/subscriptions/list"
url += "?" + urlencode({'page': '1', 'limit': '10'})
request = Request(url,
    headers={"resource": os.environ["RESOURCE_KEY"], "token": os.environ["ADMIN_TOKEN"]},
    method="GET")
try:
    with urlopen(request) as response:
        print(response.status, json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))

HTTP 200 result:

{
  "items": [
    {
      "relationship_id": 4001,
      "plan_id": 3001,
      "plan_title": "Subscriber",
      "subscription_id": 2001,
      "subscription_title": "Monthly",
      "subscription_start_date": "2026-10-30 12:00:00",
      "subscription_end_date": "2026-12-01 00:00:00",
      "is_trial_subscription": false,
      "new_subscription_id": null,
      "new_relationship_id": null,
      "is_attached_by_admin": true,
      "admin_id": 9001,
      "sponsored_subscription_slot": null
    }
  ],
  "paginator": {
    "current_page": 1,
    "page": 1,
    "total_pages": 1,
    "total_items": 1,
    "limit": 10
  }
}

Relationship 4001 records subscription 2001. Empty replacement references fit removal without replacement. Actor 9001 is a stored account reference, not proof of who performed every later action.

If the page has no archive records

A valid known reader with no rows on the requested page returns HTTP 200. Synthetic excerpt:

{"items":[]}

Check the requested page and paginator. This response means no archived rows on that page; current memberships are separate.

Recovery

Use shared recovery, plus:

HTTP statusAPI code / shapeCauseNext action
409get_user_history_failA caught history-query/mapping failure.Retain request reference and ask the operator to inspect the known reader/publication context.
Not reliably uniformMissing/unlinked reader failureThe reader/publication lookup does not guarantee one normalized missing-target response.Confirm the intended reader and publication relationship through your audience records before retrying.
200items:[] with paginatorNo rows on the requested page.Inspect page/total counts; check current memberships separately.

Next task

Inspect current memberships for present state.

Shared recovery

Errors normally include error, error_description and req_guid. Keep the request reference for your operator, especially after an uncertain write. These failures can occur before operation-specific work.

HTTP statusAPI code / shapeCauseNext action
401 / 403accessRole/action not permitted.Use the eligible existing Admin context; these four actions have no service-account grant.
401auth_failedRequired caller did not resolve.Confirm the credential and custom token header.
401auth_access_failCaller inactive or current caller/publication relationship locked/suspended.Ask the operator to check those restrictions.
401token_expired / token_compromisedApplicable session check rejects the token.Use an existing current authorized credential.
404resource_not_existsPublication key does not resolve.Confirm the public resource key; changing a membership ID does not fix it.
409initialize_failedShared context initialization failed.Supply request reference and selected publication to the operator.

Full diagram

Use the arrow keys to scroll. Escape closes this view.

Search documentation

Enter at least 2 characters.

    ↑ ↓ move through results · Enter opens · Escape closes