Skip to content

Create a paid membership

POST /program/memberships
Scopeprogram:write
Customer session tokenNot accepted: call from your server with an API key
Rate limit classwrite_shopify (limits)
Idempotency keyRequired (idempotency)
MCP toolcharm_create_membership

Creates a membership off sale, for the merchant to review and put on sale in the admin. It is bought as a Shopify product: link an existing one (product) or let Charm create an unpublished draft (create_product, priced in the shop currency). Call with dry_run: true first.

FieldTypeDescription
namestringIn the shop’s primary language.
name_translationsobjectOther published languages; null removes one. (optional)
productobject(optional)
billing_typestring: term, subscriptionsubscription only when subscriptions_available. Fixed once the membership has members. (optional)
termobjectHow long one purchase lasts (term). Fixed once the membership has members. (optional)
billing_intervalobjectRenewal cadence (subscription). (optional)
grace_daysinteger(optional)
points_multipliernumber(optional)
activity_window_monthsintegerThe multiplier holds while the member buys at least once in this many months; after a longer gap their next order earns inactive_points_multiplier, and the full one returns from the order after. 0 = always (default). (optional)
inactive_points_multipliernumberWhat a member’s next order earns after a gap longer than activity_window_months. At most points_multiplier; 1 = no extra points. (optional)
highlightboolean(optional)
show_payoffbooleanShow when the plan pays for itself (“Pays for itself from … in orders a month”) on the storefront. (optional)
benefitsarray of objectReplaces the membership’s benefits; same shape as a tier’s (GET /program/rule-types?kind=benefit). Send an existing benefit’s id to edit it in place. (optional)
create_productobjectCharm creates a draft (unpublished, no shipping, no stock tracking) product at this price. (optional)
dry_runbooleanPreview only: validate, resolve references and return the diff and summary, but write nothing. Costs no idempotency key and is limited as a read. Call with this first, show the merchant, then repeat without it. (optional)
if_revisionintegerThe program revision you last read (from GET /program or a previous write). When the program changed since, the write is refused with 409 revision_conflict instead of overwriting a concurrent admin edit. (optional)

Returns MembershipWriteResult.

FieldTypeDescription
dry_runboolean
revisioninteger
operationstring: create, update, delete, none
diffarray of FieldChange
summarystring or null(nullable)
membershipMembership
product_createdbooleanA new draft (unpublished) product was created in Shopify for this membership. (optional)
would_create_productobjectDry run: the draft product a real call would create. (optional)
product_statusstringThe product’s Shopify status when it is not ACTIVE (a DRAFT product cannot be bought until published). (optional)
gating_republish_failedbooleanSaved, but the members-only content rules did not republish; save again to retry. (optional)
{
"dry_run": false,
"revision": 1,
"operation": "create",
"diff": [
{
"path": "path",
"before": null,
"after": null
}
],
"summary": "summary",
"membership": {
"id": "id",
"name": "Gold",
"name_translations": {},
"enabled": true,
"billing_type": "term",
"term": {
"unit": "DAY",
"count": 1
},
"billing_interval": {
"unit": "DAY",
"count": 1
},
"grace_days": 1,
"points_multiplier": 120,
"activity_window_months": 1,
"inactive_points_multiplier": 120,
"highlight": false,
"show_payoff": false,
"product": {
"id": "id",
"title": "title",
"variant_id": "44123456789",
"variant_title": "variant title",
"price": "price",
"currency": "EUR"
},
"benefits": [
{}
]
},
"product_created": false,
"would_create_product": {
"title": "title",
"price": 1,
"status": "active"
},
"product_status": "product status",
"gating_republish_failed": false
}
Terminal window
curl -X POST "https://charm.appfleece.app/api/v1/program/memberships" \
-H "Authorization: Bearer chrm_live_..." \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"name":"Gold"}'

unauthorized · invalid_token · insufficient_scope · access_required · validation_error · rate_limited · idempotency_conflict · shopify_unavailable

Every error body carries code, message, request_id and a doc_url pointing at the matching entry in the error catalog.