> For the complete documentation index, see [llms.txt](https://docs.commercelayer.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.commercelayer.io/core-api-reference/subscription_models.md).

# Subscription models

The subscription model object and the allowed CRUD operations on the related resource endpoint

A subscription model determines how automatic [order subscriptions](/core-api-reference/order_subscriptions.md) using [recurring order copies](/core-api-reference/recurring_order_copies.md) are generated for the associated market. The subscription model defines which are the subscription frequencies available in that market. Those [available frequencies](#subscription-frequencies) can be specified for the orders' [line items](/core-api-reference/line_items.md#choosing-line-items-that-generate-subscriptions). Based on the line items that have a frequency, the necessary order subscriptions are generated, according to the specified [subscription strategy](#subscription-strategies).

## Subscription frequencies

To set the allowed subscription frequencies, use the `frequencies` attribute and populate it with an array of strings chosen from this list:

* `hourly`
* `daily`
* `weekly`
* `monthly`
* `two-month`
* `three-month`
* `four-month`
* `six-month`
* `yearly`

{% hint style="info" %}
If you need to use a custom frequency that is not in the above list, [crontab expressions](https://crontab.guru/) are also accepted, as long as not more frequent than every hour (e.g. at minute 30 of every hour: `30 * * * *` is allowed, at every minute of the first day of the month: `* * 1 * *` is not allowed )
{% endhint %}

## Subscription strategies

To set the subscription strategy for the associated market, use the `strategy` attribute. At the moment, two strategies are available:

* `by_frequency` — as many order subscriptions as the different frequencies specified for the source order’s line items are generated, each with the related order subscription items (default strategy).
* `by_line_items` — an order subscription is generated for any source order’s line item that has a frequency, each with the related order subscription item.

## Automatic subscription activation and cancellation

By default, the generated order subscriptions are automatically activated. Set the `auto_activate` attribute to `false` if you want to override this behavior.

If you set the `auto_cancel` attribute to `true` (default is `false`) the created order subscriptions will be automatically cancelled in case the source order is cancelled.

<details>

<summary>Data model</summary>

Check the related [ER diagram](/data-model/orders/subscriptions-and-order-copies.md) and explore the flowchart that illustrates how the subscription model resource relates to the other API entities.

</details>

<details>

<summary>How-to</summary>

Check the related [guide](/how-tos/placing-orders/subscriptions/configuring-a-subscription-model.md) to learn more about how to configure a subscription model and generate automatic subscriptions from a source order.

</details>


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.commercelayer.io/core-api-reference/subscription_models.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
