# The coupon code model

Source: https://developers.swell.is/backend-api/coupon-codes/the-coupon-code-model

## Fields

- `id` (objectId): Unique identifier for the coupon code.
- `code` (string, auto): Code used to apply the coupon to a cart, order or subscription. A validation error will be returned if the code is not valid.
- `date_created` (date, auto): Date and time the coupon code was created.
- `date_updated` (date, auto): Date and time the coupon code was last updated.
- `gen_id` (objectId): Unique ID corresponding to a coupon code generation.
- `orders` (Order): Expandable list of orders that have applied the coupon code.
- `parent_id` (objectId, required): ID of the parent coupon, if applicable.
- `parent` (Coupon): Expandable link to the parent coupon.
- `subscriptions` (Subscription): Expandable list of subscriptions that have applied the coupon code.
- `use_count` (int): Number of times the coupon code has been used.

## Example response

```json
{
 "gen_id": "62b5cdffd7ad010018c66249",
 "parent_id": "62b5cdff2e40ab001ac27240",
 "use_count": 0,
 "date_created": "2022-06-24T14:45:20.941Z",
 "use_total": 0,
 "code": "PNB83100017",
 "id": "62b5ce0079c5d80012fe5f65"
}
```
