# UpdateDiscountCode

> Update a discount code and push the change to its placements. Write access, discounts toolset, MCP tool update_discount_code.

**Access:** [Write](https://developer.missin.co.uk/get-started/authentication.md#access-levels)

## Variables

| Variable | Type | Required | Accepts | Description |
|---|---|---|---|---|
| `input` | `UpdateDiscountCodeInput!` | yes | Input object, below |  |

## Input types

### UpdateDiscountCodeInput

| Field | Type | Required | Accepts | Description |
|---|---|---|---|---|
| `body` | `JSON!` | yes | Object, fields below |  |
| `connectionId` | `UUID` | no |  | Optional. Omit to edit a workspace-level (unplaced) discount; when present, the store the edit was initiated from (audit stamp + placement push). |
| `id` | `UUID!` | yes |  |  |
| `partnerId` | `UUID` | no | at least 1 characters | Partner attribution patch, independent of the discount body. Omit BOTH partnerId and tier to preserve the current link; send partnerId: null to clear it; send a partnerId (with an optional tier slug) to attribute. A tier requires a partner. |
| `tier` | `String` | no |  |  |

#### `UpdateDiscountCodeInput.body`

| Field | Type | Required | Accepts | Description |
|---|---|---|---|---|
| `code` | string | no | 1 to 255 characters, matches `^\S+$` |  |
| `aliased_codes` | list of object | no | Object, fields below. at most 1000 items |  |
| `title` | string | no | 1 to 255 characters |  |
| `display_name` | string or null | no | at most 255 characters |  |
| `value_kind` | string | no | One of `percent`, `amount` |  |
| `value_percent` | number or null | no | 0 to 100 |  |
| `value_amount` | number or null | no | 0 to 5000 |  |
| `usage_limit` | integer or null | no | 1 to 999999 |  |
| `start_at` | string,null | no |  |  |
| `ends_at` | string,null | no |  |  |
| `one_time_purchase` | boolean | no |  |  |
| `status` | string | no | One of `EXPIRED`, `DRAFT`, `SCHEDULED`, `ACTIVE` |  |
| `is_public` | boolean | no |  |  |
| `public_tier` | string | no | One of `BASIC`, `QUICK`, `ENHANCED` |  |
| `origin` | string | no | 1 to 255 characters |  |
| `tags` | object | no |  |  |
| `placements` | list of object | no | Object, fields below |  |

#### `UpdateDiscountCodeInput.body.aliased_codes`

| Field | Type | Required | Accepts | Description |
|---|---|---|---|---|
| `id` | string | no | 1 to 255 characters |  |
| `code` | string | yes | 1 to 255 characters, matches `^\S+$` |  |

#### `UpdateDiscountCodeInput.body.placements`

| Field | Type | Required | Accepts | Description |
|---|---|---|---|---|
| `connectionId` | string | yes | 1 to 255 characters |  |
| `child` | object | no |  |  |

## Call it

```bash curl
curl https://api.missin.co.uk/graphql/v1 \
  -H "Authorization: Bearer $MISSIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"operationName":"UpdateDiscountCode","variables":{"input":{"body":{"code":"…"},"id":"00000000-0000-0000-0000-000000000000"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"625598f2e218a1fd910be98982bbff0855c55670f970738f4f1d6e5fd1f410bc"}}}'
```

## Document

```graphql
mutation UpdateDiscountCode($input: UpdateDiscountCodeInput!) { __typename updateDiscountCode(input: $input) { __typename id pendingSync userErrors { __typename code field message } } }
```

Source: https://developer.missin.co.uk/reference/discounts/update-discount-code
