---
title: "Update a subscription"
method: PUT
path: "/subscription/{subscriptionId}"
---

# Update a subscription

`PUT /subscription/{subscriptionId}`

Update a subscription record in the current project. If pay_system_id is changed, uniqueness is validated against (payment_system, pay_system_id, real_payment, project_id).

## Path parameters

- `subscriptionId` integer, required

## Request body

- object
  - `pay_system_id` string
  - `quiz_id` string, nullable
  - `paywall_id` string, nullable
  - `plan_id` string
  - `amount` number
  - `currency` string
  - `canceled_at` string, date-time, nullable
  - `cancel_at_period_end` boolean
  - `customer` string
  - `status` string
  - `user_id` string
  - `user_email` string, email, nullable
  - `next_charge_date` string, date-time, nullable
  - `last_charge_date` string, date-time, nullable
  - `charges_count` integer
  - `total_revenue` integer
  - `price_id` integer, nullable
  - `user_visit_id` string, nullable
  - `projected_revenue_32d` integer, nullable — Projected revenue over 32 days (e.g. in cents).
  - `projected_revenue_62d` integer, nullable — Projected revenue over 62 days (e.g. in cents).
  - `projected_revenue_184d` integer, nullable — Projected revenue over 184 days (e.g. in cents).
  - `projected_revenue_367d` integer, nullable — Projected revenue over 367 days (e.g. in cents).

## Response `200`

Subscription updated successfully.

- object
  - `success` integer
  - `data` Subscription
    - `id` integer — Internal ID of the subscription.
    - `user_id` string — A unique identifier for the user.
    - `user_email` string — The user's email address.
    - `user_visit` object — Information about the user's visit when the subscription was created
      - `id` string — Unique identifier of the visit
      - `ip` string — User's IP address
      - `url` string — URL where the visit occurred
      - `user_id` string — User identifier associated with the visit
      - `created_at` string, date-time — Timestamp of the visit
      - `project_id` string — Project identifier
      - `user_agent` string — User's browser/device information
      - `visit_number` integer — Number of visits by the user
      - `user_language` string — User's preferred language
      - `user_platform` string — User's device platform
      - `user_zip_code` string, nullable — User's zip code
      - `is_first_visit` integer — Whether this is the user's first visit
      - `user_city_name` string — User's city
      - `user_state_code` string — User's state/province code
      - `first_visit_date` string, date-time — Date of user's first visit
      - `user_country_code` string — User's country code
      - `previous_visit_date` string, date-time — Date of user's previous visit
      - `utm_source` string — UTM source parameter
      - `utm_medium` string — UTM medium parameter
      - `utm_campaign` string — UTM campaign parameter
      - `utm_content` string — UTM content parameter
      - `utm_term` string — UTM term parameter
      - `utm_ad_id` string — UTM ad ID parameter
      - `utm_adset` string — UTM adset parameter
      - `utm_adname` string — UTM ad name parameter
      - `utm_adset_id` string — UTM adset ID parameter
      - `utm_id` string — UTM ID parameter
      - `fbclid` string — Facebook click ID
    - `created_at` string, date-time — The date and time the subscription was created.
    - `updated_at` string, date-time — The date and time the subscription was last updated.
    - `payment_system` integer — An integer representing the payment system used (e.g., 0).
    - `payment_system_label` string — The label for the payment system used (e.g., "Stripe").
    - `real_payment` integer — Indicates whether the payment is in Production mode. 1 for yes, 0 for no.
    - `pay_system_id` string — The unique identifier for the payment in the payment system.
    - `project_domain` string — The domain of the project associated with the subscription.
    - `quiz_id` string — The ID of the quiz associated with the subscription.
    - `quiz_name` string — The name of the quiz associated with the subscription.
    - `paywall_id` string — The ID of the paywall used.
    - `paywall_name` string — The name of the paywall used.
    - `price_id` string — The ID of the tariff price.
    - `amount` number, float — The total amount of the final subscription price, in cents.
    - `amount_real` number — The total amount of the final subscription price, in real currency.
    - `currency` string — The currency of the payment.
    - `canceled_at` string, date-time, nullable — The date and time the subscription was canceled, or null if not canceled.
    - `customer` string — The customer ID in the payment system.
    - `status` 'active' | 'incomplete' | 'incomplete_expired' | 'trialing' | 'past_due' | 'canceled' | 'unpaid' | 'paused' — The current status of the subscription in the payment system.
    - `next_charge_date` string, date-time, nullable — The date and time of the next scheduled payment. Can be null for one-time purchases or non-subscriptions.
    - `last_charge_date` string, date-time, nullable — The date and time of the most recent payment. Can be null for subscriptions without payments.
    - `charges_count` integer — The total number of charges made for the subscription. Can be 0.
    - `phases_num` integer, nullable — Current billing phase of the subscription (1-based in API response). - Integer (1, 2, 3, …): phase number (1 = trial or first phase, then subsequent phased pricing). - null: one-time price, no price, or current phase is the main one (no phased pricing / all phases passed).
    - `total_revenue` integer — The total revenue generated from the subscription, in cents. Can be 0.
    - `projected_revenue_32d` integer, nullable — Projected revenue for 32 days, in cents.
    - `projected_revenue_62d` integer, nullable — Projected revenue for 62 days, in cents.
    - `projected_revenue_184d` integer, nullable — Projected revenue for 184 days, in cents.
    - `projected_revenue_367d` integer, nullable — Projected revenue for 367 days, in cents.
    - `updated_by_api_date` string, date-time, nullable — Timestamp when the subscription was last created or updated via API.
    - `manage_link` string, nullable — URL for managing subscription. For Stripe/Paddle - configured in project settings, for PayPal - fixed URL
    - `price` object — Details about the pricing plan associated with the subscription.
      - `id` integer — Internal ID of the price.
      - `plan_id` integer — The ID of the subscription plan.
      - `external_id` string — The price ID in the external payment system.
      - `currency` string — The currency of the price.
      - `amount` string — The base price amount.
      - `period` string — Subscription period (e.g., "month").
      - `period_interval` integer, nullable — The interval for the subscription period (e.g., 1 for monthly). Can be null for one-time purchases.
      - `trial_period_price` string, nullable — Price during the trial period, if applicable.
      - `discount_duration_in_billing_periods` string — Duration of the discount in billing periods.
      - `amount_real` number — The real price after any discounts.
      - `discount_percent` number, nullable — The percentage discount applied.
      - `amount_real_with_discount` number, nullable — The amount after applying the discount.
      - `price_option_text` string — A description of the pricing options.
      - `plan` object — Information about the plan associated with the price.
        - `id` integer — Internal ID of the plan.
        - `project_id` integer — The project ID associated with the plan.
        - `payment_system` string — The payment system used for the plan.
        - `external_id` string — The plan ID in the external payment system.
        - `name` string — The name of the plan.
        - `description` string — The description of the plan.
        - `livemode` boolean — Indicates if the plan is in live mode.
        - `created_at` string, date-time — The date and time when the plan was created.
        - `updated_at` string, date-time — The date and time when the plan was last updated.

## Other responses

- `404` — Subscription not found.
- `422` — Validation error (e.g., duplicate subscription).

---

[API](https://skmtc.net/web2wave/apis/web2wave-api.md) · [All operations](https://skmtc.net/web2wave/apis/web2wave-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/web2wave/web2wave-api/versions/c88545119271/schema)
