# Create a subscription discount

> Creates a new subscription discount.

Source: https://help.boltapp.com/api-reference/subscriptions/subscriptions/creatediscount

`POST /v1/subscriptions/discounts`

## OpenAPI definition

This endpoint as it appears in the OpenAPI document, with every schema it references included.

```json
{
  "openapi": "3.2.0",
  "info": {
    "title": "Subscriptions API",
    "version": "v1",
    "description": "API for managing subscriptions and products."
  },
  "servers": [
    {
      "url": "https://api.boltapp.com",
      "description": "The Production URL (Live Data)."
    },
    {
      "url": "https://api-sandbox.boltapp.com",
      "description": "The Sandbox URL (Test Data)."
    },
    {
      "url": "https://api-staging.boltapp.com",
      "description": "The Staging URL (Staged Data)."
    }
  ],
  "security": [
    {
      "X-API-Key": []
    },
    {
      "X-Publishable-Key": []
    }
  ],
  "paths": {
    "/v1/subscriptions/discounts": {
      "post": {
        "operationId": "createDiscount",
        "summary": "Create a subscription discount",
        "description": "Creates a new subscription discount.",
        "tags": [
          "Subscriptions"
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-Bolt-Connect-Seller-Id",
            "schema": {
              "type": "string"
            },
            "required": false,
            "description": "Seller ID for Connect marketplace operations. Required when creating discounts on behalf of a seller."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "description",
                  "type"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Name of the discount.",
                    "examples": [
                      "10% Off Monthly Plans"
                    ]
                  },
                  "code": {
                    "type": "string",
                    "description": "Discount code.",
                    "examples": [
                      "SAVE10"
                    ]
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of the discount.",
                    "examples": [
                      "10% off all monthly subscription plans"
                    ]
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "total",
                      "item",
                      "shipping"
                    ],
                    "description": "Type of discount.",
                    "examples": [
                      "shipping"
                    ]
                  },
                  "percentage_off": {
                    "type": "number",
                    "description": "Percentage discount value, 0.00 to 100.00",
                    "minimum": 0,
                    "maximum": 100,
                    "examples": [
                      10
                    ]
                  },
                  "amount_off": {
                    "type": "number",
                    "description": "Amount discount value in cents.",
                    "minimum": 0,
                    "examples": [
                      1099
                    ]
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "percentage_off"
                    ]
                  },
                  {
                    "required": [
                      "amount_off"
                    ]
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "X-API-Key": []
          },
          {
            "X-Publishable-Key": []
          }
        ],
        "responses": {
          "200": {
            "description": "Discount created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "discount": {
                      "$ref": "#/components/schemas/Discount"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request."
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Discount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the discount.",
            "examples": [
              "disc_12345"
            ]
          },
          "name": {
            "type": "string",
            "description": "Name of the discount.",
            "examples": [
              "10% Off Monthly Plans"
            ]
          },
          "code": {
            "type": "string",
            "description": "Discount code.",
            "examples": [
              "SAVE10"
            ]
          },
          "description": {
            "type": "string",
            "description": "Description of the discount.",
            "examples": [
              "10% off all monthly subscription plans"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "total",
              "item",
              "shipping"
            ]
          },
          "percentage_off": {
            "type": "number",
            "description": "Percentage discount value, 0.00 to 100.00.",
            "examples": [
              10
            ]
          },
          "amount_off": {
            "type": "number",
            "description": "Amount discount value in cents.",
            "examples": [
              1099
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "examples": [
              "2023-10-01T12:00:00Z"
            ]
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "examples": [
              "2023-10-01T12:00:00Z"
            ]
          }
        }
      }
    },
    "securitySchemes": {
      "X-API-Key": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      },
      "X-Publishable-Key": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Publishable-Key"
      }
    }
  }
}
```
