---
title: "Update a coupon"
method: PATCH
path: "/v1/projects/{project}/coupons/{coupon}"
tags: ["Coupons"]
---

# Update a coupon

`PATCH /v1/projects/{project}/coupons/{coupon}`

## Request

- Base URL: `https://api.subscriby.net`
- URL: `https://api.subscriby.net/v1/projects/{project}/coupons/{coupon}`
- Auth: HTTP bearer

Accepts the same fields as create, all optional. Changing terms is **not retroactive**: subscribers who already redeemed keep exactly what they paid, and the change applies to redemptions from that point on.

Raising `max_redemptions` on an exhausted coupon makes it redeemable again. Lowering it below the current count does not claw anything back; the coupon simply reports `remaining: 0`. Answers `200` with the coupon.

## Path parameters

- `project` string, uuid, required
- `coupon` string, uuid, required

## Headers

- `Idempotency-Key` string, uuid, required

## Request body

- UpdateCouponRequest: The changes to a coupon: any subset of the create shape. A change is never retroactive; subscribers who already redeemed keep exactly what they paid.
  - `code` string: A new code, 3 to 64 letters, numbers and dashes, uppercased before the uniqueness check against the project's other live coupons.
  - `name` string: A new creator-facing label, 3 to 255 characters.
  - `discount_type` 'percentage' | 'fixed'
  - `discount_value` number: Greater than 0; at most 100 when the coupon is, or becomes, a percentage.
  - `currency_id` string, nullable: Required when the coupon is, or becomes, `fixed` and it has no currency yet; refused as meaningless on a percentage coupon.
  - `duration` 'once': Accepted for forward compatibility but only `once` is honoured.
  - `max_redemptions` integer, nullable: The new total cap, 1 to 1,000,000, or null for unlimited. Raising it on an exhausted coupon makes it redeemable again; lowering it below the current count claws nothing back, the coupon simply reports `remaining: 0`.
  - `max_redemptions_per_user` integer: How many times one member may redeem the code, 1 to 1,000.
  - `minimum_amount` number, nullable: The order floor, in the plan's own currency; greater than 0, or null for none.
  - `starts_at` string, date-time, nullable: When redemption opens, ISO 8601, or null for immediately.
  - `expires_at` string, date-time, nullable: When redemption closes, ISO 8601, or null for never.
  - `active` boolean: The on/off switch; prefer the activate and deactivate endpoints, which fire their own events.
  - `plan_ids` string[]: The plans to restrict the code to, at most 200; `[]` opens it to every plan.

## Response `200`

The coupon after the change.

- object
  - `data` CouponResource, required: A coupon: one code many subscribers can redeem for money off at checkout, with its discount, limits, redemption tally and sales window.
    - `id` string, required: The coupon's id.
    - `project_id` string, required: The project the coupon belongs to; codes are unique within a project, not across projects.
    - `code` string, required: The code subscribers type at checkout, stored and matched in upper case.
    - `name` string, required: A creator-facing label, never shown to subscribers.
    - `discount` object, required: What comes off the price.
      - `type` string, required: `percentage` or `fixed`.
      - `value` string, required: A decimal string with four places: `"25.0000"` for 25% off, `"10.0000"` for ten of the coupon's currency. Parse it as a decimal, never a float.
      - `currency_id` string, nullable, required: The currency a `fixed` discount is denominated in; null on a `percentage` coupon, which applies to a plan in any currency.
      - `currency` string, nullable: That currency's ISO 4217 code, present only when the relation is loaded: on a single read, a create and an update, not on every list row.
    - `duration` string, required: Always `once`: only first-payment discounts exist today.
    - `limits` object, required: How often and on what the code may be used.
      - `max_redemptions` integer, nullable, required: The total cap across everyone; null for unlimited.
      - `max_redemptions_per_user` integer, required: How many times one member may redeem the code.
      - `minimum_amount` string, nullable, required: The order floor, in the plan's own currency; null for none.
    - `redemptions` object, required: How far the cap has been used.
      - `count` integer, required: Settled redemptions so far.
      - `remaining` integer, nullable, required: Derived, not stored: the cap minus settled redemptions and reservations whose hold has not expired, so an in-flight checkout is already counted and an abandoned one gives its slot back. Prefer it over your own subtraction, which will disagree. Null when uncapped.
      - `exhausted` boolean, required: Whether nothing remains under the cap.
    - `window` object, required: When the code can be redeemed.
      - `starts_at` string, nullable, required: When redemption opens, ISO 8601; null for immediately.
      - `expires_at` string, nullable, required: When redemption closes, ISO 8601; null for never.
    - `plan_ids` object, required: The plans the code is restricted to. An empty array means **every** plan in the project, including plans added later, not no plans.
    - `active` boolean, required: The creator's on/off switch. Not the same as redeemable.
    - `redeemable` boolean, required: The combined answer: switched on, inside its window, not exhausted. Read this rather than `active` to know whether the code applies right now.
    - `created_at` string, nullable, required: When the coupon was created, ISO 8601.
    - `updated_at` string, nullable, required: When it last changed, ISO 8601.

## Other responses

- `400`: `IDEMPOTENCY_KEY_MISSING`: every write needs an `Idempotency-Key` header. Send a fresh UUID per distinct operation.
- `401`: `AUTHENTICATION_REQUIRED`: the request carries no bearer token, or one that is revoked, malformed, or minted for another environment (an `sbt_test_` token on production).
- `403`: `TOKEN_MISSING_ABILITY`: the token is valid but does not carry the ability this endpoint requires; `error.context.required_ability` names the one to grant. An endpoint that also checks who owns a row or which tier the account is on answers `FORBIDDEN`, `TEAM_TIER_REQUIRED` or `CONNECTOR_TIER_REQUIRED` with the same status, and says so in its own description. On this endpoint: `TEAM_TIER_REQUIRED`: when the creator has neither the Coupons Addon nor a Growth plan.
- `404`: `RESOURCE_NOT_FOUND`: an id in the path names nothing the token can see. `TENANT_MISMATCH`: the project sits outside the token's `scope:project:` allow-list, or the token carries no team scope. Both answer 404 rather than 403 so that existence outside the token's scope cannot be inferred.
- `409`: `IDEMPOTENCY_KEY_REUSED`: the key was already used in the last 24 hours with a different request body.
- `422`: `VALIDATION_FAILED`: the payload broke a rule, and `error.fields` maps each offending key to its messages. A refusal from the domain, such as a plan that cannot go on sale or a member who cannot be removed, uses the same code with `error.message` saying why and no `fields`. On this endpoint: `VALIDATION_FAILED`: when a field is invalid or the new code is taken by another live coupon of the project.
- `425`: `IDEMPOTENCY_REPLAY_IN_PROGRESS`: the first request with this key is still running; retry in a few seconds and the original response is replayed.
- `429`: `RATE_LIMITED`: the token has spent its 300 requests a minute or 10,000 an hour; `Retry-After` says when the next one is accepted.

---

[API](https://skmtc.dev/memberpass/apis/subscriby-rest-api.md) · [All operations](https://skmtc.dev/memberpass/apis/subscriby-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/memberpass/apis/subscriby-rest-api/revisions/59c4df91d764?raw)
