> For the complete documentation index, see [llms.txt](https://developer.firmhouse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.firmhouse.com/~/changes/v7t3tfYrVBDkXZZGoQGP/graphql-api/api-reference/mutations/create-discount-code.md).

# createDiscountCode

Creates a discount code

### Arguments

| Argument                                                                                                                            | Description                       |
| ----------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
| input ([CreateDiscountCodeInput](/~/changes/v7t3tfYrVBDkXZZGoQGP/graphql-api/api-reference/objects/create-discount-code-input.md)!) | Parameters for CreateDiscountCode |

### CreateDiscountCodeInput Arguments

| Argument                                                                                         | Description                                                                         |
| ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
| metadata ([JSON](/~/changes/v7t3tfYrVBDkXZZGoQGP/graphql-api/api-reference/objects/json.md))     | Metadata that can be used by developers to store additional information on objects. |
| promotionId ([ID](/~/changes/v7t3tfYrVBDkXZZGoQGP/graphql-api/api-reference/objects/id.md)!)     | The promotion to attach to this discount code                                       |
| code ([String](/~/changes/v7t3tfYrVBDkXZZGoQGP/graphql-api/api-reference/objects/string.md)!)    | The code that can be applied when creating a subscription                           |
| maxTimesUsed ([Int](/~/changes/v7t3tfYrVBDkXZZGoQGP/graphql-api/api-reference/objects/int.md)!)  | The max times this discount code can be used                                        |
| autoSelectPlanId ([ID](/~/changes/v7t3tfYrVBDkXZZGoQGP/graphql-api/api-reference/objects/id.md)) | The discount code can only be applied to this plan                                  |

### Return fields

#### discountCode ([DiscountCode](/~/changes/v7t3tfYrVBDkXZZGoQGP/graphql-api/api-reference/objects/discount-code.md))

#### errors (\[[ModelValidationError](/~/changes/v7t3tfYrVBDkXZZGoQGP/graphql-api/api-reference/objects/model-validation-error.md)!]!)
