# Downgrade plugin subscription to a lower plan

`POST /api/plugins/{pluginId}/subscriptions/{id}/downgrade`

Authentication: no security requirement declared for this operation.

Parameters:

- `id` (path, string, uuid, required) - Plugin subscription ID
  Type: string, uuid

- `pluginId` (path, string, uuid, required) - Plugin ID
  Type: string, uuid

Responses:

- 200: Plugin subscription downgraded successfully

Content type: application/json

Type: object

Schema: [PluginSubscription_1](https://sourcey-gauzy.pages.dev/api-reference/models/pluginsubscription-1/index.md)

- `deletedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `createdAt` (optional)
  Type: string, date-time
  
  The creation timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `updatedAt` (optional)
  Type: string, date-time
  
  The last update timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `id` (optional)
  Type: string

- `isActive` (optional)
  Type: boolean
  
  default: true

- `isArchived` (optional)
  Type: boolean
  
  default: false

- `archivedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `tenantId` (optional)
  Type: string

- `organizationId` (optional)
  Type: string

- `status` (required)
  Type: string
  
  Subscription status
  
  enum: ["active","cancelled","expired","trial","past_due","suspended","pending"]

- `scope` (required)
  Type: string
  
  Subscription scope
  
  enum: ["tenant","organization","user"]

- `startDate` (required)
  Type: string, date-time
  
  Start date of subscription

- `endDate` (optional)
  Type: string, date-time
  
  End date of subscription

- `trialEndDate` (optional)
  Type: string, date-time
  
  Trial end date

- `autoRenew` (required)
  Type: boolean
  
  Whether auto-renewal is enabled

- `cancelledAt` (optional)
  Type: string, date-time
  
  Cancellation date

- `cancellationReason` (optional)
  Type: string
  
  Cancellation reason

- `metadata` (optional)
  Type: object
  
  Subscription metadata for additional data

- `externalSubscriptionId` (optional)
  Type: string
  
  External subscription ID from payment provider

- `pluginId` (required)
  Type: string
  
  Plugin ID

- `pluginTenantId` (required)
  Type: string
  
  Plugin Tenant ID

- `planId` (optional)
  Type: string
  
  Subscription plan ID

- `subscriberId` (optional)
  Type: string
  
  Subscriber user ID for user-specific subscriptions

- `parentId` (optional)
  Type: string
  
  Parent subscription ID for hierarchical subscriptions

- `parent` (optional)
  Type: unknown
  
  Parent subscription (for subscriptions created through assignment)
  
  allOf:
    Reference: [PluginSubscription_1](https://sourcey-gauzy.pages.dev/api-reference/models/pluginsubscription-1/index.md); Type: PluginSubscription_1

- `children` (optional)
  Type: array
  
  Child subscriptions (user subscriptions created through assignment)
  
  Items:
    Reference: [PluginSubscription_1](https://sourcey-gauzy.pages.dev/api-reference/models/pluginsubscription-1/index.md); Type: PluginSubscription_1

- `billings` (optional)
  Type: array
  
  Plugin billings for this subscription
  
  Items:
    Type: string

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/plugins/550e8400-e29b-41d4-a716-446655440000/subscriptions/550e8400-e29b-41d4-a716-446655440000/downgrade'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:3000/api/plugins/550e8400-e29b-41d4-a716-446655440000/subscriptions/550e8400-e29b-41d4-a716-446655440000/downgrade', {
  method: 'POST',
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.post('http://localhost:3000/api/plugins/550e8400-e29b-41d4-a716-446655440000/subscriptions/550e8400-e29b-41d4-a716-446655440000/downgrade')
print(response.text)
```
