# Detach a promotion from a plan

> Detaches the promotion from the plan. New carts on the plan stop receiving the discount; subscriptions that already captured it keep their terms.

Source: https://help.boltapp.com/api-reference/subscriptions/plans-v1/detachplanpromotion

`DELETE /v1/subscriptions/plans/{planId}/promotions/{promotionId}`

## 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/plans/{planId}/promotions/{promotionId}": {
      "delete": {
        "operationId": "detachPlanPromotion",
        "summary": "Detach a promotion from a plan",
        "description": "Detaches the promotion from the plan. New carts on the plan stop receiving the discount; subscriptions that already captured it keep their terms.",
        "tags": [
          "Plans v1"
        ],
        "security": [
          {
            "X-API-Key": []
          },
          {
            "X-Publishable-Key": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "planId",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "ID of the plan.",
            "examples": {
              "default": {
                "value": "spl_ba_PpkW16oIW"
              }
            }
          },
          {
            "in": "path",
            "name": "promotionId",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "ID of the promotion to detach.",
            "examples": {
              "default": {
                "value": "bcp_V9y3q4Jw8kQe"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The promotion, without the plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Promotion"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Plan or promotion not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Promotion": {
        "type": "object",
        "description": "A promotion of a subscription product. Its discount applies to new carts on the plans it is attached to.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the promotion.",
            "examples": [
              "bcp_V9y3q4Jw8kQe"
            ]
          },
          "name": {
            "type": "string",
            "description": "Name of the promotion.",
            "examples": [
              "Launch discount"
            ]
          },
          "status": {
            "type": "string",
            "description": "The promotion's lifecycle status.",
            "examples": [
              "active"
            ]
          },
          "target": {
            "type": "string",
            "enum": [
              "item",
              "cart"
            ],
            "description": "What the discount applies to."
          },
          "automatic": {
            "type": "boolean",
            "description": "Whether the promotion applies without a code."
          },
          "combinable": {
            "type": "boolean",
            "description": "Whether the promotion can combine with other promotions."
          },
          "priority": {
            "type": "integer",
            "format": "int64",
            "description": "Order in which promotions are considered; lower runs first."
          },
          "duration": {
            "type": "string",
            "enum": [
              "once",
              "repeating",
              "forever"
            ],
            "description": "How long the discount keeps applying across a subscription's renewals."
          },
          "percent_off": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Percentage discount in basis points, 1 to 10000 (250 = 2.5%). Exactly one of `percent_off` and `amount_off` is set."
          },
          "amount_off": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Fixed discount in cents. Exactly one of `percent_off` and `amount_off` is set."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO4217 currency code for `amount_off`.",
            "examples": [
              "USD"
            ]
          },
          "minimum_amount": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Minimum cart amount in cents for the promotion to apply."
          },
          "allowed_cycle_counts": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "With `duration` `repeating`, how many billing cycles the discount applies for."
          },
          "max_redemptions": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Cap on total redemptions, or `null` for unlimited."
          },
          "times_redeemed": {
            "type": "integer",
            "format": "int64",
            "description": "How many times the promotion has been redeemed."
          },
          "allowed_customers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Customer IDs the promotion is restricted to. Empty for everyone."
          },
          "plan_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "IDs of the plans the promotion is attached to."
          },
          "codes": {
            "type": "array",
            "description": "The promotion's codes. Empty for an automatic promotion.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "code": {
                  "type": "string",
                  "examples": [
                    "LAUNCH20"
                  ]
                },
                "active": {
                  "type": "boolean"
                },
                "max_redemptions": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64"
                },
                "times_redeemed": {
                  "type": "integer",
                  "format": "int64"
                },
                "expires_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "first_time_transaction": {
                  "type": "boolean",
                  "description": "Whether the code is limited to a shopper's first transaction."
                }
              }
            }
          },
          "redeem_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Last moment the promotion can be redeemed."
          },
          "activated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "deactivated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "ApiErrorResponse": {
        "type": "object",
        "description": "Standard error envelope returned by every non-2xx response.",
        "required": [
          "result",
          "errors"
        ],
        "properties": {
          "result": {
            "type": "object",
            "properties": {
              "success": {
                "type": "boolean",
                "description": "Always `false` on an error.",
                "examples": [
                  false
                ]
              }
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        },
        "examples": [
          {
            "result": {
              "success": false
            },
            "errors": [
              {
                "code": 15,
                "message": "A valid value must be provided.",
                "field": "frequency"
              }
            ]
          }
        ]
      },
      "ApiError": {
        "type": "object",
        "description": "One error of a failed request.",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "description": "Bolt error code.",
            "examples": [
              15
            ]
          },
          "message": {
            "type": "string",
            "description": "What went wrong.",
            "examples": [
              "A valid value must be provided."
            ]
          },
          "field": {
            "type": "string",
            "description": "Path of the request field the error is about, such as `product.taxable` or `plans[1].sku`. Absent when the error is not about one field.",
            "examples": [
              "frequency"
            ]
          }
        }
      }
    },
    "securitySchemes": {
      "X-API-Key": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Admins and Developers can obtain their Bolt API key from the Bolt Merchant Dashboard. Send it together with `X-Publishable-Key`."
      },
      "X-Publishable-Key": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Publishable-Key",
        "description": "The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard. Required. Send it together with `X-API-Key`."
      }
    }
  }
}
```
