a84d4905fdbb

latestOpenAPI 3.1.02026-08-143874115.7 MB
Memberships

Update Membership

Updates a membership: merge metadata key-value pairs, or toggle cancel_at_period_endtrue schedules the cancellation for the end of the current billing period, false reverses a pending one.

patch/memberships/{id}

Request body

cancel_at_period_endboolean

true cancels at the end of the current billing period (the customer keeps access until then); false reverses a pending cancellation.

metadataobject

Key-value pairs to merge into the membership's metadata. Pass an empty object to clear it.

Example request

{
  "cancel_at_period_end": true,
  "metadata": {
    "seat": "42"
  }
}

Response

membership updated

cancel_at_period_endboolean required

Whether the membership is set to cancel when the current billing period ends. Only meaningful for recurring plans.

created_atstring required

When the membership was created, as an ISO 8601 timestamp.

current_period_endstring nullable required

When the current billing period renews, or when a non-renewing membership expires, as an ISO 8601 timestamp. null for one-time purchases with no expiration.

idstring required

Membership ID, prefixed mem_.

license_keystring nullable required

The software license key for this membership. Only present when the product includes a software licensing experience.

metadataobject required

Custom key-value pairs stored on the membership, commonly used for software licensing.

plan_idstring required

The plan the buyer purchased, prefixed plan_.

product_idstring required

The product this membership grants access to, prefixed prod_.

status'trialing' | 'active' | 'past_due' | 'completed' | 'canceled' | 'expired' | 'unresolved' required

Billing state of the membership. active/trialing memberships grant access; past_due is the grace period after a failed payment; completed one-time purchases keep access; canceled/expired do not.

user_idstring nullable required

The buyer, prefixed user_. null when the buyer is another business or the membership is unclaimed.

Example response

{
  "account": {
    "id": "biz_xxxxxxxxxxxxxx",
    "logo_url": "https://assets-2-rough.whop.com/uploads/image/2026-01-01/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "route": "shine-time-auto-detailing",
    "title": "Shine Time Auto Detailing"
  },
  "created_at": "2026-01-01T12:00:00.000Z",
  "current_period_end": "2026-01-01T12:00:00.000Z",
  "id": "mem_xxxxxxxxxxxxxx",
  "license_key": "license_key32_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "member": {
    "access_level": "customer",
    "last_accessed_at": "2026-01-01T12:00:00.000Z",
    "position": 1767268800000
  },
  "metadata": {},
  "plan_id": "plan_xxxxxxxxxxxxxx",
  "product_id": "prod_xxxxxxxxxxxxxx",
  "status": "active",
  "user_id": "user_xxxxxxxxxxxxxx"
}