---
title: "Cancel Subscription"
method: POST
path: "/api/billing/cancel"
tags: ["Billing", "billing"]
---

# Cancel Subscription

`POST /api/billing/cancel`

Cancel the user's subscription.

Steps:
  1. Generate a final Stripe invoice for any unbilled completed optimizations
  2. Mark users.is_active = FALSE, users.cancelled_at = NOW()
  3. Mark youtube_channels.is_active = FALSE for the user's channels
  4. Mark videos.optimization_paused = TRUE for the user's videos
  5. Mark in-flight (status='measuring') video_optimizations as billable=FALSE
  6. Send cancellation notification

Already-enqueued Cloud Tasks are NOT walked or deleted; the gate added
to optimization_queue.process_single_optimization will no-op them.

## Response `200`

Successful Response

- CancellationResult
  - `cancelled` boolean, required
  - `cancelled_at` string, required
  - `final_invoice_id` integer, nullable
  - `final_invoice_amount` number
  - `hosted_invoice_url` string, nullable
  - `note` string, nullable

---

[API](https://skmtc.dev/primetime/apis/primetime-media-api.md) · [All operations](https://skmtc.dev/primetime/apis/primetime-media-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/primetime/primetime-media-api/revisions/9da9a9f64e11/schema)
