# Subscription Management

Operations for managing user subscriptions and billing

## Get user subscription details

> Retrieves the current subscription information for the authenticated user

```json
{"openapi":"3.0.3","info":{"title":"DeepWriter API","version":"2.0.0"},"tags":[{"name":"Subscription Management","description":"Operations for managing user subscriptions and billing"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT token for user session authentication."}},"schemas":{"Subscription":{"type":"object","description":"Represents a user's subscription plan and usage","properties":{"id":{"type":"string","format":"uuid","description":"The unique identifier for the subscription"},"user_id":{"type":"string","format":"uuid","description":"The ID of the user who owns the subscription"},"status":{"type":"string","enum":["active","inactive","cancelled","past_due"],"description":"The current status of the subscription"},"plan_name":{"type":"string","description":"The name of the subscription plan"},"generations_limit":{"type":"number","description":"Maximum number of generations allowed"},"generations_used":{"type":"number","description":"Number of generations used in current period"},"pages_limit":{"type":"number","description":"Maximum number of pages allowed"},"pages_used":{"type":"number","description":"Number of pages used in current period"},"stripe_subscription_id":{"type":"string","description":"Stripe subscription identifier","nullable":true},"current_period_start":{"type":"string","format":"date-time","description":"Start of the current billing period","nullable":true},"current_period_end":{"type":"string","format":"date-time","description":"End of the current billing period","nullable":true},"created_at":{"type":"string","format":"date-time","description":"When the subscription was created"},"updated_at":{"type":"string","format":"date-time","description":"When the subscription was last updated"}},"required":["id","user_id","status","generations_limit","generations_used","pages_limit","pages_used","created_at","updated_at"]},"Error":{"type":"object","properties":{"error":{"type":"string","description":"A message describing the error"}},"required":["error"]}}},"paths":{"/getSubscription":{"get":{"summary":"Get user subscription details","description":"Retrieves the current subscription information for the authenticated user","tags":["Subscription Management"],"responses":{"200":{"description":"Subscription details retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No active subscription found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```
