Change reader memberships in a bounded batch

Apply changes to a list of memberships

PUT /api/v1/admin/users/subscriptions

Change up to 100 membership entries for this publication. Each entry is processed separately under handled or failed. HTTP 200 can include failures, and handled entries may make no change.

Before you call

Use an eligible service-api-key with the publication resource header, or root. Ordinary Admin roles cannot use this route. The service account must be active, non-suspended, attached to an active user and permitted for this action. Keep calls in trusted server code.

Each target needs an existing publication relationship. Choose the intended reader from your audience records; account ID takes precedence over email. This call does not create accounts.

The call picks the first membership found for a reader in this publication, without a defined order. There is no relationship-row ID selector. With multiple memberships, you cannot assume which it will choose. The example requires exactly one known current membership.

A different catalog choice can replace memberships and, with existing publication settings, remove others or affect gifts and shared seats. During creation/replacement, configured cleanup can remove this reader’s stored content-view records across publications. This differs from an in-place date/flag update. Review those effects before submitting; a retry can repeat replacement and events.

Request context

InputLocation / typeMeaning
resourceRequired header, publication public-key stringSelects the target audience/catalog context; not a numeric ID or secret.
service-api-keyRequired example header, existing eligible key stringSERVICE_API_KEY below. Ordinary ADMIN_TOKEN is not used.
itemsRequired JSON array of 1–100 entry objectsEntries processed sequentially. Empty/missing list is rejected, not a clear-all instruction.

Send JSON with Content-Type: application/json. There is no batch-wide transaction, dry run, queued-job ID or pagination.

Entry fieldType / requirementMeaning and constraints
user_idInteger account ID; supply this or user_emailTakes precedence over email. Must resolve an existing account/publication relationship. Not a membership-row ID.
user_emailEmail string when no nonempty user_idUsed to find an existing account in the selected audience. Not a request to create a user or change their email.
subscription_idOptional integer catalog subscription IDTakes precedence over subscription_external_source_id. Must belong to the selected publication through its Plan. Not a membership-row ID.
subscription_external_source_idOptional stringMatches a stored catalog external-source label within the selected publication. It does not contact a provider or validate a purchase. Duplicate mappings have no uniqueness guarantee.
subscription_end_dateOptional timestamp/date textNonempty value is parsed and formatted as a stored timestamp. Omitted/null/empty does not clear an existing expiration. No strict date-only or universal timezone guarantee.
is_auto_renewableOptional boolean recommendedRenewal choice. This is the request spelling, not is_auto_renew. For direct updates an omitted value preserves it; explicit false turns it off.
is_trialOptional boolean recommendedTrial marker for a direct update. Creating/replacing a membership also applies existing trial-eligibility rules; requested true does not guarantee an applied trial.
is_externalOptional boolean recommendedMembership external-management marker, not proof of an external payment.

Use explicit JSON booleans. Null can convert to false; omission preserves differently. Arbitrary strings are not strictly validated as booleans. Malformed entries can fail after earlier entries were processed, without a uniform validation error.

How changes are applied

For an existing membership without a different catalog choice, nonempty expiration and supplied booleans are assigned; omitted fields remain. There is no expiration-clear instruction. Inspect saved values before relying on the reported result.

A supplied catalog choice with no selected membership, or a different choice, takes the creation/replacement path. Catalog period/trial rules apply before supported explicit values. Omitted trial may change during recreation. The helper can replace a same-Plan membership, remove others under the single-subscription setting, archive history, expire gifts or clear shared-seat slots. This request does not configure those rules.

Without a catalog choice or selected membership, an entry can report success without changes. Multiple memberships and stored identifier differences also mean the same catalog choice may not always update in place.

Processing is synchronous per entry, but downstream event work can be asynchronous. An event does not confirm job completion, delivery or synchronization. Earlier entries and events can remain after a later failure. Inspect current state before repeating uncertain entries.

Response

Nominal HTTP 200 returns two top-level arrays, without items or a status wrapper:

FieldMeaning
handledEntries reported as successful by the per-item handler. Can include unchanged state or a change that was not saved.
failedEntries whose per-item processing caught an exception. Other entries can already have changed.

Both arrays use this entry shape:

Result fieldType / meaning
statusString success or error; per-item result, separate from HTTP status.
userFormatted identity string such as email:reader@example.com id#1002. Uses resolved account data when available, otherwise submitted identity; not a user object or membership ID.
error_messageString or null. Caught exception explanation, not a stable per-item API error-code enum.

Entries contain no credential, new membership ID or per-field persistence proof. An outer failure can omit accumulated results even after earlier changes.

Example: Update one known membership

Examples use fictional reader 1002 and reader@example.com. 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 existing RESOURCE_KEY and SERVICE_API_KEY.

Assume reader 1002 belongs to this publication and has exactly one current membership. The request sets expiration and flags without changing its catalog choice.

curl "${WALLKIT_API_BASE}/api/v1/admin/users/subscriptions" \
  -X PUT \
  -H "resource: ${RESOURCE_KEY}" \
  -H "service-api-key: ${SERVICE_API_KEY}" \
  -H "Content-Type: application/json" \
  --data '{"items":[{"user_id":1002,"subscription_end_date":"2026-12-01 12:00:00","is_auto_renewable":false,"is_trial":false,"is_external":true}]}'
const url = new URL(`${process.env.WALLKIT_API_BASE}/api/v1/admin/users/subscriptions`);
const response = await fetch(url, {
  method: "PUT",
  headers: {"resource": process.env.RESOURCE_KEY, "service-api-key": process.env.SERVICE_API_KEY, "Content-Type": "application/json"},
  body: JSON.stringify({"items": [{"user_id": 1002, "subscription_end_date": "2026-12-01 12:00:00", "is_auto_renewable": false, "is_trial": false, "is_external": true}]})
});
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/subscriptions"
body = json.dumps({'items': [{'user_id': 1002, 'subscription_end_date': '2026-12-01 12:00:00', 'is_auto_renewable': False, 'is_trial': False, 'is_external': True}]}).encode("utf-8")
request = Request(
    url,
    data=body,
    headers={"resource": os.environ["RESOURCE_KEY"], "service-api-key": os.environ["SERVICE_API_KEY"], "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))

Nominal HTTP 200 response:

{
  "handled": [
    {
      "status": "success",
      "user": "email:reader@example.com id#1002",
      "error_message": null
    }
  ],
  "failed": []
}

This reports per-entry completion, not the updated object or a durable-write receipt. Inspect memberships before any retry.

A batch can partially fail with HTTP 200

A second entry for reader 1003, with no publication relationship, can fail alongside a handled entry. With no submitted email, the unresolved entry’s identity string has an empty email portion:

{
  "handled": [
    {
      "status": "success",
      "user": "email:reader@example.com id#1002",
      "error_message": null
    }
  ],
  "failed": [
    {
      "status": "error",
      "user": "email: id#1003",
      "error_message": "User not found"
    }
  ]
}

Handle failures individually. Replaying the batch can repeat successful changes and events. Even no failed entries does not confirm every field or downstream action.

Recovery

HTTP statusAPI code / response shapeCauseNext action
406incorrect_dataMissing JSON or a value treated as empty by the API.Send an object with a nonempty items array and Content-Type: application/json.
409field_items_requiredParsed body has no items property.Supply items with explicit entry objects.
409field_items_emptyitems is not a nonempty array.Submit 1–100 intended entries; an empty array does not clear memberships.
409limit_reachedMore than 100 entries.Split the intended work into bounded requests, preserving per-entry outcomes rather than blindly replaying successes.
409incorrect_method / incorrect_user / incorrect_resourceMethod or required initialized context fails validation.Check PUT, publication public key and existing eligible service credential/context.
200Nonempty failed arrayPer-entry target, choice, date or processing exception.Read error_message, check existing audience/catalog context and inspect any partial effects before resubmission.
200handled success but state unchangedThe entry can complete without a saved change.Compare the intended current membership state; do not infer mutation from the status string alone.
409error_bulk_update_user_subscriptionsAn outer caught exception aborts the request.Use req_guid with the integration operator and inspect earlier entries before any retry.
Varies / no guaranteed JSONOther PHP/transport failureNot every malformed entry/failure is caught; prior entries can already be changed.Retain any request reference and inspect current state through the integration operator.

See shared errors. Read current memberships with that route’s eligible credential. Its catalog IDs do not supply a relationship-row selector for this batch.

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