> For the complete documentation index, see [llms.txt](https://docs.deepwriter.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.deepwriter.com/api-access/subscription-management.md).

# 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"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.deepwriter.com/api-access/subscription-management.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
