---
title: "Update a coupon"
method: POST
path: "/v1/coupons/{id}"
tags: ["Coupons"]
---

# Update a coupon

`POST /v1/coupons/{id}`

## Request

- Base URL: `https://api.affiliaterail.com`
- URL: `https://api.affiliaterail.com/v1/coupons/{id}`
- Auth: HTTP bearer

**Scope:** `partners:write` (or `write`)

## Path parameters

- `id` string, required: Prefixed id (`cpn_…`)

## Request body

- CouponUpdate
  - `external_id` string, nullable
  - `partner_id` string, nullable: Prefixed id (`part_…`)

## Response `200`

The updated coupon

- Coupon
  - `id` string, required: Prefixed id (`cpn_…`)
  - `object` 'coupon', required
  - `program_id` string, required: Prefixed id (`prg_…`)
  - `partner_id` string, nullable, required: Prefixed id (`part_…`)
  - `group_id` string, nullable, required: Prefixed id (`grp_…`)
  - `code` string, required
  - `external_id` string, nullable, required: The processor's own promotion id, and the only thing a sale is matched on
  - `stats` object
    - `customers` integer, required
  - `created_at` string, date-time, required: ISO-8601, UTC
  - `updated_at` string, date-time, required: ISO-8601, UTC

## Other responses

- `400`: Invalid request
- `401`: Missing or unknown API key
- `403`: Key lacks the required scope
- `404`: No such object in your organization
- `422`: The request was understood and refused
- `429`: Rate limited: see Retry-After

---

[API](https://skmtc.dev/affiliaterail/apis/affiliaterail-api.md) · [All operations](https://skmtc.dev/affiliaterail/apis/affiliaterail-api/llms.txt) · [OpenAPI document](https://skmtc.dev/affiliaterail/apis/affiliaterail-api/revisions/ea41f345c092?raw)
