# Update a subscription Updates an existing subscription by its unique identifier. Can modify items, pricing, billing information, and other subscription details. Endpoint: PATCH /subscriptions/{id} Version: 1.0 ## Path parameters: - `id` (string, required) Unique identifier of the subscription to update Example: "sub_2FdhgypnsJQn9mZlY5qGaElL" ## Header parameters: - `cc-api-key` (string, required) Chaching API Key ## Request fields (application/json): - `customer` (string, required) The ID of the customer for whom the invoice is to be created. Example: "cus_e29d2542e2615c78af0d313d" - `items` (array, required) Array of products to be included in the subscription. - `items.price` (string, required) The price ID in friendly ID format. Example: "price_4N2gcTPKLGscC1OtN5ICQiIj" - `items.tax` (array) Array of tax IDs in friendly ID format. Example: ["txr_dUhN2gnTAuEyTjHHVBr1eAZ8"] - `items.quantity` (number, required) The quantity of the product. Example: 3 - `trial_days` (number, required) The number of trial days for the subscription. Example: 14 - `end_date` (number) The day when subscription ends. The end_date must be a valid Unix timestamp (positive number) in seconds Example: 1672531199 ## Response 200 fields (application/json): - `id` (string, required) Unique identifier for the subscription. Example: "sub_2FdhgypnsJQn9mZlY5qGaElL" - `object` (string, required) String representing the object's type. Enum: "subscription" - `billing_cycle_anchor` (number, required) Determines the date of the first full invoice, and, for plans with month or year intervals, the day of the month for subsequent invoices. Example: 1679609767 - `cancel_at` (number,null, required) A date in the future at which the subscription will automatically get canceled. - `cancel_at_period_end` (boolean, required) Whether this subscription will (if status=active) or did (if status=canceled) cancel at the end of the current billing period. - `canceled_at` (number,null, required) If the subscription has been canceled, the date of that cancellation. - `collection_method` (string, required) Either charge_automatically, or send_invoice. Enum: "charge_automatically", "send_invoice" - `created` (number, required) Time at which the object was created. Measured in seconds since the Unix epoch. Example: 1679609767 - `currency` (string, required) Three-letter ISO currency code, in uppercase. Example: "USD" - `customer` (string, required) ID of the customer who owns the subscription. Example: "cus_739c07713fd4b68565a969cd" - `ended_at` (number,null, required) If the subscription has ended, the date the subscription ended. - `items` (object, required) List of subscription items, each with an attached plan. - `items.data` (array, required) Array of subscription items. - `items.total_count` (number, required) The total number of subscription items. Example: 1 - `latest_invoice` (string, required) The most recent invoice this subscription has generated. Example: "58d0f1c9-ca00-4998-8e89-d74a290b4df6" - `start_date` (number, required) Date when the subscription was first created. Example: 1679609767 - `status` (string, required) The status of the subscription. Enum: "active", "scheduled", "canceled", "expired", "trialing" - `trial_end` (number,null, required) If the subscription has a trial, the end of that trial. - `trial_start` (number,null, required) If the subscription has a trial, the beginning of that trial. ## Response 400 fields ## Response 404 fields