BillingOps

Edit, deactivate or reactivate a coupon (billing-ops staff)

Changed on

Send only the fields to change; the code is matched case-insensitively. {"active": false} stops the coupon redeeming at once; {"active": true} restores it with its limits and redemptions unchanged (audited as coupon.deactivate / coupon.reactivate). expiresAt, maxRedemptions, maxRedemptionsPerAccount, eligibleAccountId and campaignLabel take the create checks, with the same VALIDATION_ERROR details.field; null clears expiresAt (never expires), maxRedemptions (no total cap) and eligibleAccountId (any account). A cap cannot go below the redemptions already made: maxRedemptions below the total, maxRedemptionsPerAccount below the most any one account has redeemed. code and creditGrant cannot be changed (details.field names them). The changed fields are audited as one coupon.update row with their old and new values; a request that changes nothing writes no audit row. An empty body is VALIDATION_ERROR.

patch/internal/billing-ops/coupons/{code}

Request

  • Base URL: https://api.greentally.ai/v1
  • URL: https://api.greentally.ai/v1/internal/billing-ops/coupons/{code}
  • Auth: HTTP bearer

Path parameters

codestring required

Request body

activeboolean
campaignLabelstring
eligibleAccountIdstring nullable

The account external id or Clerk organization id; null or "" opens the coupon to every account.

expiresAtstring date-time nullable

In the future; null clears the expiry.

maxRedemptionsinteger nullable

Not below the redemptions already made; null removes the total cap.

maxRedemptionsPerAccountinteger

Not below the most redemptions one account has made, nor above maxRedemptions.

Response

The coupon after the change

Changes