> For the complete documentation index, see [llms.txt](https://developers.usetoggle.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.usetoggle.com/basics/create-a-card/custom-validity-rules.md).

# Custom validity rules

When creating an order, validity and expiry rules that are associated with the product being purchased will be inherited by the cards created as part of that order.

However, if you want to override these validity or expiry rules, you can pass in `validity_rules` and `expiry_config` variables as part of the OrderItemInput object.

| Validity Rule Type           | ID | Format                           | Description                                                                  |
| ---------------------------- | -- | -------------------------------- | ---------------------------------------------------------------------------- |
| Valid From                   | 1  | UTC date in `Y-m-d H:i:s` format | The date the purchase is valid from                                          |
| Valid Until                  | 2  | UTC date in `Y-m-d H:i:s` format | The date the purchase is valid until                                         |
| Valid Seconds After Purchase | 3  | Integer                          | The number of seconds after the purchase has been made that it is valid from |

To use the `validity_rules`  follow the example below:

```
 "validity_rules": [
     {
          "validity_rule_type_id": 1,
          "rule": "2021-08-14 00:08:00"
     }      
]
```

| Field                           | Format                                  | Description                                                                                    |
| ------------------------------- | --------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `seconds_valid_for`             | Integer / NULL                          | The number of seconds after purchase that it will expire. NULL sets to never.                  |
| `send_expiry_alert_days_before` | UTC date in `Y-m-d H:i:s` format / NULL | The number of days before expiry a notification will be sent to the owner. NULL sets to never. |
| `hard_expire_at`                | UTC date in `Y-m-d H:i:s` format / NULL | The specific time the purchase should expire. NULL sets to never.                              |

To use the `expiry_config` follow the example below:

```
"expiry_config": {
    "hard_expire_at": "2021-08-14 22:59:59"
 }
```

### Update a card

If you want to update a card with a new validity ruleset or a new expiry config you can use the `updateCard` mutation.


---

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

```
GET https://developers.usetoggle.com/basics/create-a-card/custom-validity-rules.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.
