# createDiscountCode

### Arguments

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

### CreateDiscountCodeInput Arguments

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

### Return fields

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

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


---

# 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://developer.firmhouse.com/graphql-api/api-reference/mutations/create-discount-code.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.
