# The order subscription object

An order subscription object is returned as part of the response body of each successful list, retrieve, create or update API call to the `/api/order_subscriptions` endpoint.

## Fields

| Field                                        | Type      | Description                                                                                                                                                                                                                                                                                             |
| -------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **type**                                     | `string`  | `order_subscriptions`                                                                                                                                                                                                                                                                                   |
| **id**                                       | `string`  | The order subscription unique identifier                                                                                                                                                                                                                                                                |
| links.**self**                               | `string`  | The order subscription endpoint URL                                                                                                                                                                                                                                                                     |
| attributes.**number**                        | `string`  | Unique identifier for the subscription (numeric).                                                                                                                                                                                                                                                       |
| attributes.**status**                        | `string`  | The subscription status. One of 'draft' (default), 'inactive', 'active', 'running', or 'cancelled'.                                                                                                                                                                                                     |
| attributes.**frequency**                     | `string`  | The frequency of the subscription. Use one of the supported within 'hourly', 'daily', 'weekly', 'monthly', 'two-month', 'three-month', 'four-month', 'six-month', 'yearly', or provide your custom crontab expression (min unit is hour). Must be supported by existing associated subscription\_model. |
| attributes.**activate\_by\_source\_order**   | `boolean` | Indicates if the subscription will be activated considering the placed source order as its first run.                                                                                                                                                                                                   |
| attributes.**place\_target\_order**          | `boolean` | Indicates if the subscription created orders are automatically placed at the end of the copy.                                                                                                                                                                                                           |
| attributes.**renewal\_alert\_period**        | `integer` | Indicates the number of hours the renewal alert will be triggered before the subscription next run. Must be included between 1 and 720 hours.                                                                                                                                                           |
| attributes.**customer\_email**               | `string`  | The email address of the customer, if any, associated to the source order.                                                                                                                                                                                                                              |
| attributes.**starts\_at**                    | `string`  | The activation date/time of this subscription.                                                                                                                                                                                                                                                          |
| attributes.**expires\_at**                   | `string`  | The expiration date/time of this subscription (must be after starts\_at).                                                                                                                                                                                                                               |
| attributes.**last\_run\_at**                 | `string`  | The date/time of the subscription last run.                                                                                                                                                                                                                                                             |
| attributes.**next\_run\_at**                 | `string`  | The date/time of the subscription next run. Can be updated but only in the future, to copy with frequency changes.                                                                                                                                                                                      |
| attributes.**occurrencies**                  | `integer` | The number of times this subscription has run.                                                                                                                                                                                                                                                          |
| attributes.**errors\_count**                 | `integer` | Indicates the number of subscription errors, if any.                                                                                                                                                                                                                                                    |
| attributes.**succeeded\_on\_last\_run**      | `boolean` | Indicates if the subscription has succeeded on its last run.                                                                                                                                                                                                                                            |
| attributes.**\_activate**                    | `boolean` | Send this attribute if you want to mark this subscription as active.                                                                                                                                                                                                                                    |
| attributes.**\_deactivate**                  | `boolean` | Send this attribute if you want to mark this subscription as inactive.                                                                                                                                                                                                                                  |
| attributes.**\_cancel**                      | `boolean` | Send this attribute if you want to mark this subscription as cancelled.                                                                                                                                                                                                                                 |
| attributes.**\_convert**                     | `boolean` | Send this attribute if you want to convert a manual subscription to an automatic one. A subscription model is required before conversion.                                                                                                                                                               |
| attributes.**\_add\_tags**                   | `string`  | Comma separated list of tags to be added. Duplicates, invalid and non existing ones are discarded. Cannot be passed by sales channels.                                                                                                                                                                  |
| attributes.**\_remove\_tags**                | `string`  | Comma separated list of tags to be removed. Duplicates, invalid and non existing ones are discarded. Cannot be passed by sales channels.                                                                                                                                                                |
| attributes.**created\_at**                   | `string`  | Time at which the resource was created.                                                                                                                                                                                                                                                                 |
| attributes.**updated\_at**                   | `string`  | Time at which the resource was last updated.                                                                                                                                                                                                                                                            |
| attributes.**reference**                     | `string`  | A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.                                                                                                     |
| attributes.**reference\_origin**             | `string`  | Any identifier of the third party system that defines the reference code.                                                                                                                                                                                                                               |
| attributes.**metadata**                      | `object`  | Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.                                                                                                                                            |
| relationships.**market**                     | `object`  | The associated market, inherited from the source order if not specified.                                                                                                                                                                                                                                |
| relationships.**subscription\_model**        | `object`  | The subscription model associated to the market.                                                                                                                                                                                                                                                        |
| relationships.**source\_order**              | `object`  | The source order which generated the subscription.                                                                                                                                                                                                                                                      |
| relationships.**customer**                   | `object`  | The subscription customer.                                                                                                                                                                                                                                                                              |
| relationships.**customer\_payment\_source**  | `object`  | The associated customer\_payment\_source.                                                                                                                                                                                                                                                               |
| relationships.**order\_subscription\_items** | `array`   | The associated order subscription items.                                                                                                                                                                                                                                                                |
| relationships.**order\_factories**           | `array`   | The associated order factories.                                                                                                                                                                                                                                                                         |
| relationships.**recurring\_order\_copies**   | `array`   | The associated recurring\_order copies.                                                                                                                                                                                                                                                                 |
| relationships.**orders**                     | `array`   | The associated copied orders.                                                                                                                                                                                                                                                                           |
| relationships.**events**                     | `array`   | The associated events.                                                                                                                                                                                                                                                                                  |
| relationships.**tags**                       | `array`   | The associated tags. Cannot be passed by sales channels.                                                                                                                                                                                                                                                |
| relationships.**event\_stores**              | `array`   | The associated event stores.                                                                                                                                                                                                                                                                            |
| meta.**mode**                                | `string`  | The resource environment (can be one of `test` or `live`)                                                                                                                                                                                                                                               |


---

# Agent Instructions: 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:

```
GET https://docs.commercelayer.io/core-api-reference/order_subscriptions/object.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
