# Subscription Plan

**Summary:** Endpoints for Subscription Plan

- Role: [Developers](https://www.subrite.no/developers)
- Source: https://www.subrite.no/developers/subscription-plan
- Updated: 2026-10-13
- Markdown index: https://www.subrite.no/developers/llms.txt

<a id="get-api-v1-subscription-plans"></a>
## Get all subscription plans of the tenant

`GET /api/v1/subscription-plans`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `page` | query | `number` | Default: `1` · `minimum`: `1` |
| `take` | query | `number` | Default: `10` · `minimum`: `1`, `maximum`: `50` |
| `orderDirection` | query | `string` | Allowed values: `"asc"`, `"desc"` · Default: `"desc"` |
| `orderBy` | query | `string` | Allowed values: `"createdAt"`, `"id"`, `"updatedAt"`, `"name"` · Default: `"createdAt"` |
| `status` | query | `string` | Allowed values: `"draft"`, `"published"`, `"archived"` |
| `allowSameSubscriptionChange` | query | `boolean` |   |
| `allowDifferentSubscriptionSwitch` | query | `boolean` |   |
| `showAsOptionOnSubscriptionSwitch` | query | `boolean` |   |
| `showAsOptionOnAdminSubscriptionSwitch` | query | `boolean` |   |
| `name` | query | `string` |   |

### Responses

#### 200

Content type: `application/json` · `SubscriptionPlanResponsePaginated`

| Name | Type | Description |
| --- | --- | --- |
| `items` (Required) | `array of SubscriptionPlanResponse` |   |
| `items[].paymentProviders` (Required when parent is present) | `array of PAYMENT_PROVIDER` | Allowed values: `"stripe"`, `"vipps"`, `"external"`, `"nets"`, `"efaktura-avtalegiro-ehf"`, `"swedbankpay"` |
| `items[].name` (Required when parent is present) | `string` |   |
| `items[].uuid` (Required when parent is present) | `string` |   |
| `items[].billingPeriod` (Required when parent is present) | `string` | Allowed values: `"monthly"`, `"thirty_days"`, `"quarterly"`, `"half_yearly"`, `"yearly"`, `"custom"` |
| `items[].billingPeriodUnit` (Required when parent is present) | `string` | Allowed values: `"day"`, `"week"`, `"month"`, `"year"` |
| `items[].billingPeriodFrequency` (Required when parent is present) | `number` |   |
| `items[].autoRenew` (Required when parent is present) | `boolean` |   |
| `items[].status` (Required when parent is present) | `string` | Allowed values: `"draft"`, `"published"`, `"archived"` |
| `items[].tenantId` (Required when parent is present) | `number` |   |
| `items[].allowSameSubscriptionChange` (Required when parent is present) | `boolean` |   |
| `items[].allowDifferentSubscriptionSwitch` (Required when parent is present) | `boolean` |   |
| `items[].allowAdminSameSubscriptionChange` (Required when parent is present) | `boolean` |   |
| `items[].allowAdminDifferentSubscriptionSwitch` (Required when parent is present) | `boolean` |   |
| `items[].enableGiftSubscription` (Required when parent is present) | `boolean` |   |
| `items[].allowFutureStartDate` (Required when parent is present) | `boolean` |   |
| `items[].showAsOptionOnSubscriptionSwitch` (Required when parent is present) | `boolean` |   |
| `items[].showAsOptionOnAdminSubscriptionSwitch` (Required when parent is present) | `boolean` |   |
| `items[].offerSwitchOnCheckout` (Required when parent is present) | `boolean` |   |
| `items[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `items[].entityTags` (Required when parent is present) | `array of EntityTag` |   |
| `items[].entityTags[].productId` (Required when parent is present) | `number` |   |
| `items[].entityTags[].tagId` (Required when parent is present) | `number` |   |
| `items[].entityTags[].subscriptionPlanId` (Required when parent is present) | `number` |   |
| `items[].entityTags[].tag` (Required when parent is present) | `Tag` | Nested fields omitted: depth limit. |
| `items[].entityTags[].product` (Required when parent is present) | `Product` | Nested fields omitted: depth limit. |
| `items[].entityTags[].subscriptionPlan` (Required when parent is present) | `SubscriptionPlan` | Nested fields omitted: depth limit. |
| `items[].entityTags[].visualWorkflowId` (Required when parent is present) | `number` |   |
| `items[].entityTags[].visualWorkflow` (Required when parent is present) | `VisualWorkflow` | Nested fields omitted: depth limit. |
| `items[].entityTags[].id` (Required when parent is present) | `number` |   |
| `items[].entityTags[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].entityTags[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].entityTags[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].entityTags[].metaData` (Required when parent is present) | `object` |   |
| `items[].subscriptionPlanProducts` (Required when parent is present) | `array of SubscriptionPlanProduct` |   |
| `items[].subscriptionPlanProducts[].subscriptionPlanId` (Required when parent is present) | `number` |   |
| `items[].subscriptionPlanProducts[].productId` (Required when parent is present) | `number` |   |
| `items[].subscriptionPlanProducts[].price` (Required when parent is present) | `number` |   |
| `items[].subscriptionPlanProducts[].properties` (Required when parent is present) | `OptionalProductProperties` | Nested fields omitted: depth limit. |
| `items[].subscriptionPlanProducts[].subscriptionPlan` (Required when parent is present) | `SubscriptionPlan` | Nested fields omitted: depth limit. |
| `items[].subscriptionPlanProducts[].product` (Required when parent is present) | `Product` | Nested fields omitted: depth limit. |
| `items[].subscriptionPlanProducts[].tenantId` (Required when parent is present) | `number` |   |
| `items[].subscriptionPlanProducts[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: depth limit. |
| `items[].subscriptionPlanProducts[].id` (Required when parent is present) | `number` |   |
| `items[].subscriptionPlanProducts[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].subscriptionPlanProducts[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].subscriptionPlanProducts[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].subscriptionPlanProducts[].metaData` (Required when parent is present) | `object` |   |
| `items[].packages` (Required when parent is present) | `array of Package` | Nested fields omitted: field limit. |
| `items[].memberPackages` (Required when parent is present) | `array of MemberPackage` | Nested fields omitted: field limit. |
| `items[].id` (Required when parent is present) | `number` |   |
| `items[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].metaData` (Required when parent is present) | `object` |   |
| `items[].subscriptionCount` (Required when parent is present) | `number` |   |
| `items[].products` (Required when parent is present) | `array of SubscriptionProduct` |   |
| `items[].products[].circulationType` | `CIRCULATION_TYPE` | Allowed values: `"subscription"`, `"single_copy"` · Can be null |
| `items[].products[].productId` (Required when parent is present) | `number` |   |
| `items[].products[].name` (Required when parent is present) | `string` |   |
| `items[].products[].price` (Required when parent is present) | `number` |   |
| `items[].products[].currency` (Required when parent is present) | `string` |   |
| `items[].products[].isOptional` (Required when parent is present) | `boolean` |   |
| `items[].products[].basePrice` (Required when parent is present) | `number` |   |
| `items[].products[].properties` (Required when parent is present) | `OptionalProductProperties` | Nested fields omitted: depth limit. |
| `items[].products[].shippingCharges` (Required when parent is present) | `array of ShippingCharge` | Nested fields omitted: depth limit. |
| `items[].products[].productCategory` (Required when parent is present) | `string` | Allowed values: `"digital_subscription"`, `"physical_subscription"`, `"physical"`, `"event_ticket"`, `"PHYSICAL_PRODUCT"` |
| `items[].products[].tax` (Required when parent is present) | `number` |   |
| `items[].products[].description` (Required when parent is present) | `string` |   |
| `items[].products[].maxQuantityPerOrder` (Required when parent is present) | `number` |   |
| `items[].tags` | `array of string` |   |
| `items[].price` (Required when parent is present) | `number` |   |
| `items[].hasOptionalProducts` (Required when parent is present) | `boolean` |   |
| `meta` (Required) | `PageMeta` |   |
| `meta.page` (Required) | `number` |   |
| `meta.take` (Required) | `number` |   |
| `meta.count` (Required) | `number` |   |
| `meta.pageCount` (Required) | `number` |   |
| `meta.hasPreviousPage` (Required) | `boolean` |   |
| `meta.hasNextPage` (Required) | `boolean` |   |

#### 400

Content type: `application/json` · `ErrorResponse`

Query validation failed; field codes in errors\[\]

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"internalServerError"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` |   |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

### Example request

```bash
curl https://api.subrite.no/api/v1/subscription-plans \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "items": [
    {
      "paymentProviders": [],
      "entityTags": [],
      "subscriptionPlanProducts": [],
      "packages": [],
      "memberPackages": [],
      "metaData": {},
      "products": [],
      "tags": []
    }
  ],
  "meta": {
    "page": 0,
    "take": 0,
    "count": 0,
    "pageCount": 0,
    "hasPreviousPage": true,
    "hasNextPage": true
  }
}
```

<a id="post-api-v1-subscription-plans"></a>
## Create a new subscription plan

`POST /api/v1/subscription-plans`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `CreateSubscriptionPlanDto`

| Name | Type | Description |
| --- | --- | --- |
| `products` (Required) | `array of SubscriptionPlanProductDto` | `uniqueItems`: `true` |
| `products[].productId` (Required when parent is present) | `number` | `minimum`: `1` |
| `products[].price` (Required when parent is present) | `number` | `minimum`: `0` |
| `products[].properties` (Required when parent is present) | `OptionalProductProperties` |   |
| `products[].properties.isRequired` (Required when parent is present) | `boolean` |   |
| `products[].properties.quantityRange` (Required when parent is present) | `number` |   |
| `paymentProviders` (Required) | `array of PAYMENT_PROVIDER` | Allowed values: `"stripe"`, `"vipps"`, `"external"`, `"nets"`, `"efaktura-avtalegiro-ehf"`, `"swedbankpay"` · `minItems`: `1` |
| `allowSameSubscriptionChange` | `boolean` |   |
| `allowDifferentSubscriptionSwitch` | `boolean` |   |
| `allowAdminSameSubscriptionChange` | `boolean` |   |
| `allowAdminDifferentSubscriptionSwitch` | `boolean` |   |
| `enableGiftSubscription` | `boolean` |   |
| `allowFutureStartDate` | `boolean` |   |
| `showAsOptionOnSubscriptionSwitch` | `boolean` |   |
| `showAsOptionOnAdminSubscriptionSwitch` | `boolean` |   |
| `offerSwitchOnCheckout` | `boolean` |   |
| `name` (Required) | `string` |   |
| `billingPeriod` (Required) | `string` | Allowed values: `"monthly"`, `"thirty_days"`, `"quarterly"`, `"half_yearly"`, `"yearly"`, `"custom"` |
| `billingPeriodUnit` (Required) | `string` |   |
| `billingPeriodFrequency` (Required) | `number` | `minimum`: `1` |
| `status` (Required) | `string` | Allowed values: `"draft"`, `"published"`, `"archived"` |
| `autoRenew` (Required) | `boolean` |   |
| `tags` (Required) | `array of string` |   |

### Responses

#### 201

Content type: `application/json` · `SubscriptionPlanResponse`

| Name | Type | Description |
| --- | --- | --- |
| `paymentProviders` (Required) | `array of PAYMENT_PROVIDER` | Allowed values: `"stripe"`, `"vipps"`, `"external"`, `"nets"`, `"efaktura-avtalegiro-ehf"`, `"swedbankpay"` |
| `name` (Required) | `string` |   |
| `uuid` (Required) | `string` |   |
| `billingPeriod` (Required) | `string` | Allowed values: `"monthly"`, `"thirty_days"`, `"quarterly"`, `"half_yearly"`, `"yearly"`, `"custom"` |
| `billingPeriodUnit` (Required) | `string` | Allowed values: `"day"`, `"week"`, `"month"`, `"year"` |
| `billingPeriodFrequency` (Required) | `number` |   |
| `autoRenew` (Required) | `boolean` |   |
| `status` (Required) | `string` | Allowed values: `"draft"`, `"published"`, `"archived"` |
| `tenantId` (Required) | `number` |   |
| `allowSameSubscriptionChange` (Required) | `boolean` |   |
| `allowDifferentSubscriptionSwitch` (Required) | `boolean` |   |
| `allowAdminSameSubscriptionChange` (Required) | `boolean` |   |
| `allowAdminDifferentSubscriptionSwitch` (Required) | `boolean` |   |
| `enableGiftSubscription` (Required) | `boolean` |   |
| `allowFutureStartDate` (Required) | `boolean` |   |
| `showAsOptionOnSubscriptionSwitch` (Required) | `boolean` |   |
| `showAsOptionOnAdminSubscriptionSwitch` (Required) | `boolean` |   |
| `offerSwitchOnCheckout` (Required) | `boolean` |   |
| `tenant` (Required) | `Tenant` | Nested fields omitted: field limit. |
| `entityTags` (Required) | `array of EntityTag` |   |
| `entityTags[].productId` (Required when parent is present) | `number` |   |
| `entityTags[].tagId` (Required when parent is present) | `number` |   |
| `entityTags[].subscriptionPlanId` (Required when parent is present) | `number` |   |
| `entityTags[].tag` (Required when parent is present) | `Tag` | Nested fields omitted: field limit. |
| `entityTags[].product` (Required when parent is present) | `Product` | Nested fields omitted: field limit. |
| `entityTags[].subscriptionPlan` (Required when parent is present) | `SubscriptionPlan` | Nested fields omitted: field limit. |
| `entityTags[].visualWorkflowId` (Required when parent is present) | `number` |   |
| `entityTags[].visualWorkflow` (Required when parent is present) | `VisualWorkflow` | Nested fields omitted: field limit. |
| `entityTags[].id` (Required when parent is present) | `number` |   |
| `entityTags[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `entityTags[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `entityTags[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `entityTags[].metaData` (Required when parent is present) | `object` |   |
| `subscriptionPlanProducts` (Required) | `array of SubscriptionPlanProduct` |   |
| `subscriptionPlanProducts[].subscriptionPlanId` (Required when parent is present) | `number` |   |
| `subscriptionPlanProducts[].productId` (Required when parent is present) | `number` |   |
| `subscriptionPlanProducts[].price` (Required when parent is present) | `number` |   |
| `subscriptionPlanProducts[].properties` (Required when parent is present) | `OptionalProductProperties` |   |
| `subscriptionPlanProducts[].properties.isRequired` (Required when parent is present) | `boolean` |   |
| `subscriptionPlanProducts[].properties.quantityRange` (Required when parent is present) | `number` |   |
| `subscriptionPlanProducts[].subscriptionPlan` (Required when parent is present) | `SubscriptionPlan` | Nested fields omitted: field limit. |
| `subscriptionPlanProducts[].product` (Required when parent is present) | `Product` | Nested fields omitted: field limit. |
| `subscriptionPlanProducts[].tenantId` (Required when parent is present) | `number` |   |
| `subscriptionPlanProducts[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `subscriptionPlanProducts[].id` (Required when parent is present) | `number` |   |
| `subscriptionPlanProducts[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `subscriptionPlanProducts[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `subscriptionPlanProducts[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `subscriptionPlanProducts[].metaData` (Required when parent is present) | `object` |   |
| `packages` (Required) | `array of Package` | Nested fields omitted: field limit. |
| `memberPackages` (Required) | `array of MemberPackage` | Nested fields omitted: field limit. |
| `id` (Required) | `number` |   |
| `createdAt` (Required) | `string (date-time)` |   |
| `updatedAt` (Required) | `string (date-time)` |   |
| `deletedAt` (Required) | `string (date-time)` |   |
| `metaData` (Required) | `object` |   |
| `subscriptionCount` (Required) | `number` |   |
| `products` (Required) | `array of SubscriptionProduct` |   |
| `products[].circulationType` | `CIRCULATION_TYPE` | Allowed values: `"subscription"`, `"single_copy"` · Can be null |
| `products[].productId` (Required when parent is present) | `number` |   |
| `products[].name` (Required when parent is present) | `string` |   |
| `products[].price` (Required when parent is present) | `number` |   |
| `products[].currency` (Required when parent is present) | `string` |   |
| `products[].isOptional` (Required when parent is present) | `boolean` |   |
| `products[].basePrice` (Required when parent is present) | `number` |   |
| `products[].properties` (Required when parent is present) | `OptionalProductProperties` |   |
| `products[].properties.isRequired` (Required when parent is present) | `boolean` |   |
| `products[].properties.quantityRange` (Required when parent is present) | `number` |   |
| `products[].shippingCharges` (Required when parent is present) | `array of ShippingCharge` |   |
| `products[].shippingCharges[].country` (Required when parent is present) | `string` |   |
| `products[].shippingCharges[].charge` (Required when parent is present) | `number` |   |
| `products[].productCategory` (Required when parent is present) | `string` | Allowed values: `"digital_subscription"`, `"physical_subscription"`, `"physical"`, `"event_ticket"`, `"PHYSICAL_PRODUCT"` |
| `products[].tax` (Required when parent is present) | `number` |   |
| `products[].description` (Required when parent is present) | `string` |   |
| `products[].maxQuantityPerOrder` (Required when parent is present) | `number` |   |
| `tags` | `array of string` |   |
| `price` (Required) | `number` |   |
| `hasOptionalProducts` (Required) | `boolean` |   |

#### 400

Content type: `application/json` · `ErrorResponse`

Body validation failed, or a product id does not exist in this tenant; field codes in errors\[\]

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"internalServerError"`, `"invalidProducts"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

### Example request

```bash
curl https://api.subrite.no/api/v1/subscription-plans \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "products": [
    {}
  ],
  "paymentProviders": [
    "stripe"
  ],
  "allowSameSubscriptionChange": true,
  "allowDifferentSubscriptionSwitch": true,
  "allowAdminSameSubscriptionChange": true,
  "allowAdminDifferentSubscriptionSwitch": true,
  "enableGiftSubscription": true,
  "allowFutureStartDate": true,
  "showAsOptionOnSubscriptionSwitch": true,
  "showAsOptionOnAdminSubscriptionSwitch": true,
  "offerSwitchOnCheckout": true,
  "name": "string",
  "billingPeriod": "monthly",
  "billingPeriodUnit": "string",
  "billingPeriodFrequency": 1,
  "status": "draft",
  "autoRenew": true,
  "tags": [
    "string"
  ]
}'
```

### Example response

201 · `application/json`

```json
{
  "paymentProviders": [
    "stripe"
  ],
  "name": "string",
  "uuid": "string",
  "billingPeriod": "monthly",
  "billingPeriodUnit": "day",
  "billingPeriodFrequency": 0,
  "autoRenew": true,
  "status": "draft",
  "tenantId": 0,
  "allowSameSubscriptionChange": true,
  "allowDifferentSubscriptionSwitch": true,
  "allowAdminSameSubscriptionChange": true,
  "allowAdminDifferentSubscriptionSwitch": true,
  "enableGiftSubscription": true,
  "allowFutureStartDate": true,
  "showAsOptionOnSubscriptionSwitch": true,
  "showAsOptionOnAdminSubscriptionSwitch": true,
  "offerSwitchOnCheckout": true,
  "tenant": {
    "market": "NO",
    "productName": "enterprise",
    "additionalFeatures": [],
    "disabledFeatures": [],
    "name": "string",
    "isActive": true,
    "defaultLanguage": "en",
    "hostName": "string",
    "logo": "string",
    "favicon": "string",
    "authLogo": "string",
    "authLogoHeight": 0,
    "siteUrl": "string",
    "termsUrl": "string",
    "privacyUrl": "string",
    "gtm": "string",
    "taxRates": [],
    "smsOtp": true,
    "emailProvider": "brevo",
    "tenantContact": "string",
    "registeredBusinessNo": "string",
    "bankAccountNo": "string",
    "swiftCode": "string",
    "iban": "<iban>",
    "defaultLogoutURL": "string",
    "postalAddress": "<postalAddress>",
    "otpTemplateId": {},
    "smsSenderId": 0,
    "emailSenderId": 0,
    "smsSender": {
      "metaData": {}
    },
    "emailSender": {
      "metaData": {}
    },
    "products": [],
    "users": [],
    "members": [],
    "roles": [],
    "subscriptionPlans": [],
    "packages": [],
    "invoices": [],
    "orders": [],
    "paymentProviders": [],
    "newslettersProviderConfig": [],
    "paymentProviderConfigs": [],
    "oidcClients": [],
    "oauthProviders": [],
    "activityLogs": [],
    "m2m_api_clients": [],
    "customProperties": [],
    "consents": [],
    "preference": {
      "inputFieldConfig": [],
      "customFieldsOnMemberCard": [],
      "customFieldsOnInvoice": [],
      "visibleAdditionalFieldsOnMypage": [],
      "metaData": {}
    },
    "settings": {
      "aiResidency": {},
      "metaData": {}
    },
    "communicationTemplates": [],
    "additionalHostnames": [],
    "exportHistory": [],
    "arReportHistory": [],
    "mypageCardsSettings": [],
    "webhooks": [],
    "customOrders": [],
    "customOrderSources": [],
    "brandKits": [],
    "communicationReceivers": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "entityTags": [
    {
      "metaData": {}
    }
  ],
  "subscriptionPlanProducts": [
    {
      "metaData": {}
    }
  ],
  "packages": [
    {
      "paymentProviders": [],
      "description": {},
      "packageProducts": [],
      "payments": [],
      "memberPackages": [],
      "metaData": {}
    }
  ],
  "memberPackages": [
    {
      "memberPackageProducts": [],
      "orders": [],
      "changes": [],
      "histories": [],
      "metaData": {}
    }
  ],
  "id": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "deletedAt": "2019-08-24T14:15:22Z",
  "metaData": {},
  "subscriptionCount": 0,
  "products": [
    {
      "shippingCharges": []
    }
  ],
  "tags": [
    "string"
  ],
  "price": 0,
  "hasOptionalProducts": true
}
```

<a id="get-api-v1-subscription-plans-statistic"></a>
## Get statistic of subscription plans

`GET /api/v1/subscription-plans/statistic`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

Content type: `application/json` · `SubscriptionStatistic`

| Name | Type | Description |
| --- | --- | --- |
| `activeMembers` (Required) | `number` |   |
| `soldToday` (Required) | `number` |   |
| `soldYesterday` (Required) | `number` |   |
| `soldLast7Days` (Required) | `number` |   |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

### Example request

```bash
curl https://api.subrite.no/api/v1/subscription-plans/statistic \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "activeMembers": 0,
  "soldToday": 0,
  "soldYesterday": 0,
  "soldLast7Days": 0
}
```

<a id="get-api-v1-subscription-plans-all"></a>
## Get subscription plans by filters

`GET /api/v1/subscription-plans/all`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `status` | query | `string` | Allowed values: `"draft"`, `"published"`, `"archived"` |
| `allowSameSubscriptionChange` | query | `boolean` |   |
| `allowDifferentSubscriptionSwitch` | query | `boolean` |   |
| `showAsOptionOnSubscriptionSwitch` | query | `boolean` |   |
| `showAsOptionOnAdminSubscriptionSwitch` | query | `boolean` |   |
| `name` | query | `string` |   |

### Responses

#### 200

Content type: `application/json` · `array of SubscriptionPlanResponse`

| Name | Type | Description |
| --- | --- | --- |
| `[].paymentProviders` (Required when parent is present) | `array of PAYMENT_PROVIDER` | Allowed values: `"stripe"`, `"vipps"`, `"external"`, `"nets"`, `"efaktura-avtalegiro-ehf"`, `"swedbankpay"` |
| `[].name` (Required when parent is present) | `string` |   |
| `[].uuid` (Required when parent is present) | `string` |   |
| `[].billingPeriod` (Required when parent is present) | `string` | Allowed values: `"monthly"`, `"thirty_days"`, `"quarterly"`, `"half_yearly"`, `"yearly"`, `"custom"` |
| `[].billingPeriodUnit` (Required when parent is present) | `string` | Allowed values: `"day"`, `"week"`, `"month"`, `"year"` |
| `[].billingPeriodFrequency` (Required when parent is present) | `number` |   |
| `[].autoRenew` (Required when parent is present) | `boolean` |   |
| `[].status` (Required when parent is present) | `string` | Allowed values: `"draft"`, `"published"`, `"archived"` |
| `[].tenantId` (Required when parent is present) | `number` |   |
| `[].allowSameSubscriptionChange` (Required when parent is present) | `boolean` |   |
| `[].allowDifferentSubscriptionSwitch` (Required when parent is present) | `boolean` |   |
| `[].allowAdminSameSubscriptionChange` (Required when parent is present) | `boolean` |   |
| `[].allowAdminDifferentSubscriptionSwitch` (Required when parent is present) | `boolean` |   |
| `[].enableGiftSubscription` (Required when parent is present) | `boolean` |   |
| `[].allowFutureStartDate` (Required when parent is present) | `boolean` |   |
| `[].showAsOptionOnSubscriptionSwitch` (Required when parent is present) | `boolean` |   |
| `[].showAsOptionOnAdminSubscriptionSwitch` (Required when parent is present) | `boolean` |   |
| `[].offerSwitchOnCheckout` (Required when parent is present) | `boolean` |   |
| `[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `[].entityTags` (Required when parent is present) | `array of EntityTag` |   |
| `[].entityTags[].productId` (Required when parent is present) | `number` |   |
| `[].entityTags[].tagId` (Required when parent is present) | `number` |   |
| `[].entityTags[].subscriptionPlanId` (Required when parent is present) | `number` |   |
| `[].entityTags[].tag` (Required when parent is present) | `Tag` | Nested fields omitted: field limit. |
| `[].entityTags[].product` (Required when parent is present) | `Product` | Nested fields omitted: field limit. |
| `[].entityTags[].subscriptionPlan` (Required when parent is present) | `SubscriptionPlan` | Nested fields omitted: field limit. |
| `[].entityTags[].visualWorkflowId` (Required when parent is present) | `number` |   |
| `[].entityTags[].visualWorkflow` (Required when parent is present) | `VisualWorkflow` | Nested fields omitted: field limit. |
| `[].entityTags[].id` (Required when parent is present) | `number` |   |
| `[].entityTags[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `[].entityTags[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].entityTags[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].entityTags[].metaData` (Required when parent is present) | `object` |   |
| `[].subscriptionPlanProducts` (Required when parent is present) | `array of SubscriptionPlanProduct` |   |
| `[].subscriptionPlanProducts[].subscriptionPlanId` (Required when parent is present) | `number` |   |
| `[].subscriptionPlanProducts[].productId` (Required when parent is present) | `number` |   |
| `[].subscriptionPlanProducts[].price` (Required when parent is present) | `number` |   |
| `[].subscriptionPlanProducts[].properties` (Required when parent is present) | `OptionalProductProperties` |   |
| `[].subscriptionPlanProducts[].properties.isRequired` (Required when parent is present) | `boolean` |   |
| `[].subscriptionPlanProducts[].properties.quantityRange` (Required when parent is present) | `number` |   |
| `[].subscriptionPlanProducts[].subscriptionPlan` (Required when parent is present) | `SubscriptionPlan` | Nested fields omitted: field limit. |
| `[].subscriptionPlanProducts[].product` (Required when parent is present) | `Product` | Nested fields omitted: field limit. |
| `[].subscriptionPlanProducts[].tenantId` (Required when parent is present) | `number` |   |
| `[].subscriptionPlanProducts[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `[].subscriptionPlanProducts[].id` (Required when parent is present) | `number` |   |
| `[].subscriptionPlanProducts[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `[].subscriptionPlanProducts[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].subscriptionPlanProducts[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].subscriptionPlanProducts[].metaData` (Required when parent is present) | `object` |   |
| `[].packages` (Required when parent is present) | `array of Package` | Nested fields omitted: field limit. |
| `[].memberPackages` (Required when parent is present) | `array of MemberPackage` | Nested fields omitted: field limit. |
| `[].id` (Required when parent is present) | `number` |   |
| `[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].metaData` (Required when parent is present) | `object` |   |
| `[].subscriptionCount` (Required when parent is present) | `number` |   |
| `[].products` (Required when parent is present) | `array of SubscriptionProduct` |   |
| `[].products[].circulationType` | `CIRCULATION_TYPE` | Allowed values: `"subscription"`, `"single_copy"` · Can be null |
| `[].products[].productId` (Required when parent is present) | `number` |   |
| `[].products[].name` (Required when parent is present) | `string` |   |
| `[].products[].price` (Required when parent is present) | `number` |   |
| `[].products[].currency` (Required when parent is present) | `string` |   |
| `[].products[].isOptional` (Required when parent is present) | `boolean` |   |
| `[].products[].basePrice` (Required when parent is present) | `number` |   |
| `[].products[].properties` (Required when parent is present) | `OptionalProductProperties` |   |
| `[].products[].properties.isRequired` (Required when parent is present) | `boolean` |   |
| `[].products[].properties.quantityRange` (Required when parent is present) | `number` |   |
| `[].products[].shippingCharges` (Required when parent is present) | `array of ShippingCharge` |   |
| `[].products[].shippingCharges[].country` (Required when parent is present) | `string` |   |
| `[].products[].shippingCharges[].charge` (Required when parent is present) | `number` |   |
| `[].products[].productCategory` (Required when parent is present) | `string` | Allowed values: `"digital_subscription"`, `"physical_subscription"`, `"physical"`, `"event_ticket"`, `"PHYSICAL_PRODUCT"` |
| `[].products[].tax` (Required when parent is present) | `number` |   |
| `[].products[].description` (Required when parent is present) | `string` |   |
| `[].products[].maxQuantityPerOrder` (Required when parent is present) | `number` |   |
| `[].tags` | `array of string` |   |
| `[].price` (Required when parent is present) | `number` |   |
| `[].hasOptionalProducts` (Required when parent is present) | `boolean` |   |

#### 400

Content type: `application/json` · `ErrorResponse`

Query validation failed; field codes in errors\[\]

Same fields as [Get all subscription plans of the tenant (400)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

### Example request

```bash
curl https://api.subrite.no/api/v1/subscription-plans/all \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
[
  {
    "paymentProviders": [],
    "name": "string",
    "uuid": "string",
    "billingPeriod": "monthly",
    "billingPeriodUnit": "day",
    "billingPeriodFrequency": 0,
    "autoRenew": true,
    "status": "draft",
    "tenantId": 0,
    "allowSameSubscriptionChange": true,
    "allowDifferentSubscriptionSwitch": true,
    "allowAdminSameSubscriptionChange": true,
    "allowAdminDifferentSubscriptionSwitch": true,
    "enableGiftSubscription": true,
    "allowFutureStartDate": true,
    "showAsOptionOnSubscriptionSwitch": true,
    "showAsOptionOnAdminSubscriptionSwitch": true,
    "offerSwitchOnCheckout": true,
    "tenant": {
      "additionalFeatures": [],
      "disabledFeatures": [],
      "taxRates": [],
      "products": [],
      "users": [],
      "members": [],
      "roles": [],
      "subscriptionPlans": [],
      "packages": [],
      "invoices": [],
      "orders": [],
      "paymentProviders": [],
      "newslettersProviderConfig": [],
      "paymentProviderConfigs": [],
      "oidcClients": [],
      "oauthProviders": [],
      "activityLogs": [],
      "m2m_api_clients": [],
      "customProperties": [],
      "consents": [],
      "communicationTemplates": [],
      "additionalHostnames": [],
      "exportHistory": [],
      "arReportHistory": [],
      "mypageCardsSettings": [],
      "webhooks": [],
      "customOrders": [],
      "customOrderSources": [],
      "brandKits": [],
      "communicationReceivers": [],
      "metaData": {}
    },
    "entityTags": [],
    "subscriptionPlanProducts": [],
    "packages": [],
    "memberPackages": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {},
    "subscriptionCount": 0,
    "products": [],
    "tags": [],
    "price": 0,
    "hasOptionalProducts": true
  }
]
```

<a id="get-api-v1-subscription-plans-enqueue-cleanup-invited-members-not-accepted-expired"></a>
## Enqueue cleanup invited members not accepted expired

`GET /api/v1/subscription-plans/enqueue-cleanup-invited-members-not-accepted-expired`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

### Example request

```bash
curl https://api.subrite.no/api/v1/subscription-plans/enqueue-cleanup-invited-members-not-accepted-expired \
  --header 'Authorization: Bearer <token>'
```

<a id="get-api-v1-subscription-plans-id"></a>
## Get a subscription plan by id

`GET /api/v1/subscription-plans/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Responses

#### 200

Content type: `application/json` · `SubscriptionPlanResponse`

Same fields as [Create a new subscription plan (201)](https://www.subrite.no/developers/subscription-plan?md=true#post-api-v1-subscription-plans).

#### 400

Content type: `application/json` · `ErrorResponse`

The id is not an integer

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

subscriptionPlanNotFound

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"subscriptionPlanNotFound"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "subscriptionPlanNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/subscription-plans/{id}' \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "paymentProviders": [
    "stripe"
  ],
  "name": "string",
  "uuid": "string",
  "billingPeriod": "monthly",
  "billingPeriodUnit": "day",
  "billingPeriodFrequency": 0,
  "autoRenew": true,
  "status": "draft",
  "tenantId": 0,
  "allowSameSubscriptionChange": true,
  "allowDifferentSubscriptionSwitch": true,
  "allowAdminSameSubscriptionChange": true,
  "allowAdminDifferentSubscriptionSwitch": true,
  "enableGiftSubscription": true,
  "allowFutureStartDate": true,
  "showAsOptionOnSubscriptionSwitch": true,
  "showAsOptionOnAdminSubscriptionSwitch": true,
  "offerSwitchOnCheckout": true,
  "tenant": {
    "market": "NO",
    "productName": "enterprise",
    "additionalFeatures": [],
    "disabledFeatures": [],
    "name": "string",
    "isActive": true,
    "defaultLanguage": "en",
    "hostName": "string",
    "logo": "string",
    "favicon": "string",
    "authLogo": "string",
    "authLogoHeight": 0,
    "siteUrl": "string",
    "termsUrl": "string",
    "privacyUrl": "string",
    "gtm": "string",
    "taxRates": [],
    "smsOtp": true,
    "emailProvider": "brevo",
    "tenantContact": "string",
    "registeredBusinessNo": "string",
    "bankAccountNo": "string",
    "swiftCode": "string",
    "iban": "<iban>",
    "defaultLogoutURL": "string",
    "postalAddress": "<postalAddress>",
    "otpTemplateId": {},
    "smsSenderId": 0,
    "emailSenderId": 0,
    "smsSender": {
      "metaData": {}
    },
    "emailSender": {
      "metaData": {}
    },
    "products": [],
    "users": [],
    "members": [],
    "roles": [],
    "subscriptionPlans": [],
    "packages": [],
    "invoices": [],
    "orders": [],
    "paymentProviders": [],
    "newslettersProviderConfig": [],
    "paymentProviderConfigs": [],
    "oidcClients": [],
    "oauthProviders": [],
    "activityLogs": [],
    "m2m_api_clients": [],
    "customProperties": [],
    "consents": [],
    "preference": {
      "inputFieldConfig": [],
      "customFieldsOnMemberCard": [],
      "customFieldsOnInvoice": [],
      "visibleAdditionalFieldsOnMypage": [],
      "metaData": {}
    },
    "settings": {
      "aiResidency": {},
      "metaData": {}
    },
    "communicationTemplates": [],
    "additionalHostnames": [],
    "exportHistory": [],
    "arReportHistory": [],
    "mypageCardsSettings": [],
    "webhooks": [],
    "customOrders": [],
    "customOrderSources": [],
    "brandKits": [],
    "communicationReceivers": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "entityTags": [
    {
      "metaData": {}
    }
  ],
  "subscriptionPlanProducts": [
    {
      "metaData": {}
    }
  ],
  "packages": [
    {
      "paymentProviders": [],
      "description": {},
      "packageProducts": [],
      "payments": [],
      "memberPackages": [],
      "metaData": {}
    }
  ],
  "memberPackages": [
    {
      "memberPackageProducts": [],
      "orders": [],
      "changes": [],
      "histories": [],
      "metaData": {}
    }
  ],
  "id": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "deletedAt": "2019-08-24T14:15:22Z",
  "metaData": {},
  "subscriptionCount": 0,
  "products": [
    {
      "shippingCharges": []
    }
  ],
  "tags": [
    "string"
  ],
  "price": 0,
  "hasOptionalProducts": true
}
```

<a id="delete-api-v1-subscription-plans-id"></a>
## Delete a subscription plan

`DELETE /api/v1/subscription-plans/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Responses

#### 200

#### 400

Content type: `application/json` · `ErrorResponse`

The id is not an integer, or a package still uses the plan

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"subscriptionPlanUsedInPackages"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

subscriptionPlanNotFound

Same fields as [Get a subscription plan by id (404)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans-id).

**Example response**

`application/json`

```json
{
  "messageCode": "subscriptionPlanNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/subscription-plans/{id}' \
  --request DELETE \
  --header 'Authorization: Bearer <token>'
```

<a id="patch-api-v1-subscription-plans-id"></a>
## Update a subscription plan

`PATCH /api/v1/subscription-plans/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Request body

Content type: `application/json` · Required · `UpdateSubscriptionPlanDto`

| Name | Type | Description |
| --- | --- | --- |
| `products` | `array of SubscriptionPlanProductDto` | `uniqueItems`: `true` |
| `products[].productId` (Required when parent is present) | `number` | `minimum`: `1` |
| `products[].price` (Required when parent is present) | `number` | `minimum`: `0` |
| `products[].properties` (Required when parent is present) | `OptionalProductProperties` |   |
| `products[].properties.isRequired` (Required when parent is present) | `boolean` |   |
| `products[].properties.quantityRange` (Required when parent is present) | `number` |   |
| `paymentProviders` | `array of PAYMENT_PROVIDER` | Allowed values: `"stripe"`, `"vipps"`, `"external"`, `"nets"`, `"efaktura-avtalegiro-ehf"`, `"swedbankpay"` · `minItems`: `1` |
| `allowSameSubscriptionChange` | `boolean` |   |
| `allowDifferentSubscriptionSwitch` | `boolean` |   |
| `allowAdminSameSubscriptionChange` | `boolean` |   |
| `allowAdminDifferentSubscriptionSwitch` | `boolean` |   |
| `enableGiftSubscription` | `boolean` |   |
| `allowFutureStartDate` | `boolean` |   |
| `showAsOptionOnSubscriptionSwitch` | `boolean` |   |
| `showAsOptionOnAdminSubscriptionSwitch` | `boolean` |   |
| `offerSwitchOnCheckout` | `boolean` |   |
| `name` | `string` |   |
| `billingPeriod` | `string` | Allowed values: `"monthly"`, `"thirty_days"`, `"quarterly"`, `"half_yearly"`, `"yearly"`, `"custom"` |
| `billingPeriodUnit` | `string` |   |
| `billingPeriodFrequency` | `number` | `minimum`: `1` |
| `status` | `string` | Allowed values: `"draft"`, `"published"`, `"archived"` |
| `autoRenew` | `boolean` |   |
| `tags` | `array of string` |   |

**Example request body**

`application/json`

```json
{
  "paymentProviders": [
    "stripe"
  ],
  "allowSameSubscriptionChange": true,
  "allowDifferentSubscriptionSwitch": true,
  "allowAdminSameSubscriptionChange": true,
  "allowAdminDifferentSubscriptionSwitch": true,
  "enableGiftSubscription": true,
  "allowFutureStartDate": true,
  "showAsOptionOnSubscriptionSwitch": true,
  "showAsOptionOnAdminSubscriptionSwitch": true,
  "offerSwitchOnCheckout": true,
  "name": "string",
  "billingPeriod": "monthly",
  "billingPeriodUnit": "string",
  "billingPeriodFrequency": 1,
  "status": "draft",
  "autoRenew": true,
  "tags": [
    "string"
  ]
}
```

### Responses

#### 200

Content type: `application/json` · `SubscriptionPlanResponse`

Same fields as [Create a new subscription plan (201)](https://www.subrite.no/developers/subscription-plan?md=true#post-api-v1-subscription-plans).

#### 400

Content type: `application/json` · `ErrorResponse`

Body validation failed, the id is not an integer, a product id is unknown, or the product change is not allowed while members are subscribed to the plan

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"internalServerError"`, `"invalidProducts"`, `"planProductRemovalBlockedByActiveSubscriptions"`, `"planRequiredProductAdditionBlockedByActiveSubscriptions"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

subscriptionPlanNotFound

Same fields as [Get a subscription plan by id (404)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans-id).

**Example response**

`application/json`

```json
{
  "messageCode": "subscriptionPlanNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all subscription plans of the tenant (403)](https://www.subrite.no/developers/subscription-plan?md=true#get-api-v1-subscription-plans).

#### 503

Content type: `application/json` · `ErrorResponse`

The price change could not be queued for the affected subscriptions; nothing was saved

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"subscriptionPlanPropagationFailed"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "subscriptionPlanPropagationFailed",
  "message": "string",
  "errors": [
    {}
  ]
}
```

### Example request

```bash
curl 'https://api.subrite.no/api/v1/subscription-plans/{id}' \
  --request PATCH \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "products": [
    {}
  ],
  "paymentProviders": [
    "stripe"
  ],
  "allowSameSubscriptionChange": true,
  "allowDifferentSubscriptionSwitch": true,
  "allowAdminSameSubscriptionChange": true,
  "allowAdminDifferentSubscriptionSwitch": true,
  "enableGiftSubscription": true,
  "allowFutureStartDate": true,
  "showAsOptionOnSubscriptionSwitch": true,
  "showAsOptionOnAdminSubscriptionSwitch": true,
  "offerSwitchOnCheckout": true,
  "name": "string",
  "billingPeriod": "monthly",
  "billingPeriodUnit": "string",
  "billingPeriodFrequency": 1,
  "status": "draft",
  "autoRenew": true,
  "tags": [
    "string"
  ]
}'
```

### Example response

200 · `application/json`

```json
{
  "paymentProviders": [
    "stripe"
  ],
  "name": "string",
  "uuid": "string",
  "billingPeriod": "monthly",
  "billingPeriodUnit": "day",
  "billingPeriodFrequency": 0,
  "autoRenew": true,
  "status": "draft",
  "tenantId": 0,
  "allowSameSubscriptionChange": true,
  "allowDifferentSubscriptionSwitch": true,
  "allowAdminSameSubscriptionChange": true,
  "allowAdminDifferentSubscriptionSwitch": true,
  "enableGiftSubscription": true,
  "allowFutureStartDate": true,
  "showAsOptionOnSubscriptionSwitch": true,
  "showAsOptionOnAdminSubscriptionSwitch": true,
  "offerSwitchOnCheckout": true,
  "tenant": {
    "market": "NO",
    "productName": "enterprise",
    "additionalFeatures": [],
    "disabledFeatures": [],
    "name": "string",
    "isActive": true,
    "defaultLanguage": "en",
    "hostName": "string",
    "logo": "string",
    "favicon": "string",
    "authLogo": "string",
    "authLogoHeight": 0,
    "siteUrl": "string",
    "termsUrl": "string",
    "privacyUrl": "string",
    "gtm": "string",
    "taxRates": [],
    "smsOtp": true,
    "emailProvider": "brevo",
    "tenantContact": "string",
    "registeredBusinessNo": "string",
    "bankAccountNo": "string",
    "swiftCode": "string",
    "iban": "<iban>",
    "defaultLogoutURL": "string",
    "postalAddress": "<postalAddress>",
    "otpTemplateId": {},
    "smsSenderId": 0,
    "emailSenderId": 0,
    "smsSender": {
      "metaData": {}
    },
    "emailSender": {
      "metaData": {}
    },
    "products": [],
    "users": [],
    "members": [],
    "roles": [],
    "subscriptionPlans": [],
    "packages": [],
    "invoices": [],
    "orders": [],
    "paymentProviders": [],
    "newslettersProviderConfig": [],
    "paymentProviderConfigs": [],
    "oidcClients": [],
    "oauthProviders": [],
    "activityLogs": [],
    "m2m_api_clients": [],
    "customProperties": [],
    "consents": [],
    "preference": {
      "inputFieldConfig": [],
      "customFieldsOnMemberCard": [],
      "customFieldsOnInvoice": [],
      "visibleAdditionalFieldsOnMypage": [],
      "metaData": {}
    },
    "settings": {
      "aiResidency": {},
      "metaData": {}
    },
    "communicationTemplates": [],
    "additionalHostnames": [],
    "exportHistory": [],
    "arReportHistory": [],
    "mypageCardsSettings": [],
    "webhooks": [],
    "customOrders": [],
    "customOrderSources": [],
    "brandKits": [],
    "communicationReceivers": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "entityTags": [
    {
      "metaData": {}
    }
  ],
  "subscriptionPlanProducts": [
    {
      "metaData": {}
    }
  ],
  "packages": [
    {
      "paymentProviders": [],
      "description": {},
      "packageProducts": [],
      "payments": [],
      "memberPackages": [],
      "metaData": {}
    }
  ],
  "memberPackages": [
    {
      "memberPackageProducts": [],
      "orders": [],
      "changes": [],
      "histories": [],
      "metaData": {}
    }
  ],
  "id": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "deletedAt": "2019-08-24T14:15:22Z",
  "metaData": {},
  "subscriptionCount": 0,
  "products": [
    {
      "shippingCharges": []
    }
  ],
  "tags": [
    "string"
  ],
  "price": 0,
  "hasOptionalProducts": true
}
```
