Skip to main content
PUT
/
discount-codes
/
{id}
Update discount code
curl --request PUT \
  --url https://api.sprucecollective.co.uk/discount-codes/{id} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "active": true,
  "allow_multiple_claims": true,
  "alphanumeric": true,
  "category": "<string>",
  "code": "<string>",
  "code_length": 123,
  "code_pattern": "<string>",
  "code_required": true,
  "description": "<string>",
  "discount_brand_id": "<string>",
  "discount_percentage": 123,
  "featured": true,
  "is_bulk_code": true,
  "max_uses": 123,
  "partner_logo": "<string>",
  "partner_url": "<string>",
  "points_required": 123,
  "site_id": "<string>",
  "tag_ids": [
    "<string>"
  ],
  "terms": "<string>",
  "third_party_id": "<string>",
  "thumbnail": "<string>",
  "title": "<string>",
  "valid_from": "<string>",
  "valid_until": "<string>"
}
'
{
  "active": true,
  "allow_multiple_claims": true,
  "alphanumeric": true,
  "category": "<string>",
  "claimed_codes": [
    "<string>"
  ],
  "code": "<string>",
  "code_display": "<string>",
  "code_length": 123,
  "code_pattern": "<string>",
  "code_required": true,
  "created_at": "<string>",
  "current_uses": 123,
  "description": "<string>",
  "discount_brand": {
    "archived": true,
    "collection_id": "<string>",
    "created_at": "<string>",
    "description": "<string>",
    "discount_codes": "<array>",
    "draft": true,
    "id": "<string>",
    "item_id": "<string>",
    "locale_id": "<string>",
    "logo": "<string>",
    "logo_black_and_white": "<string>",
    "max_discount": "<string>",
    "name": "<string>",
    "published_on": "<string>",
    "site_id": "<string>",
    "slug": "<string>",
    "thumbnail": "<string>",
    "updated_at": "<string>"
  },
  "discount_brand_id": "<string>",
  "discount_percentage": 123,
  "featured": true,
  "has_claimed_code": true,
  "id": "<string>",
  "is_bulk_code": true,
  "is_valid": true,
  "max_uses": 123,
  "partner_logo": "<string>",
  "partner_url": "<string>",
  "points_required": 123,
  "site_id": "<string>",
  "tags": [
    {
      "active": true,
      "color": "<string>",
      "created_at": "<string>",
      "description": "<string>",
      "id": "<string>",
      "name": "<string>",
      "site_id": "<string>",
      "slug": "<string>",
      "updated_at": "<string>"
    }
  ],
  "terms": "<string>",
  "third_party_id": "<string>",
  "thumbnail": "<string>",
  "title": "<string>",
  "updated_at": "<string>",
  "valid_from": "<string>",
  "valid_until": "<string>"
}

Authorizations

Authorization
string
header
required

Type "Bearer" followed by a space and JWT token.

Path Parameters

id
string
required

Discount Code ID

Body

application/json

Discount code update data (code_required: if false, no code is needed)

active
boolean
allow_multiple_claims
boolean
alphanumeric
boolean
category
string
code
string

Allow updating the code

code_length
integer
code_pattern
string
code_required
boolean
Example:

true

description
string
discount_brand_id
string
discount_percentage
number

Pointer is OK for partial updates

is_bulk_code
boolean
max_uses
integer
partner_url
string
points_required
integer
site_id
string
tag_ids
string[]

Array of tag IDs to associate (nil means no change)

terms
string
third_party_id
string

Link to external system

thumbnail
string
title
string
valid_from
string
valid_until
string

Response

OK

active
boolean
allow_multiple_claims
boolean
alphanumeric
boolean
category
string
claimed_codes
string[]

List of codes claimed by current user (for bulk codes)

code
string

Hidden until redeemed

code_display
string

New fields for code visibility

code_length
integer
code_pattern
string
code_required
boolean
Example:

true

created_at
string
current_uses
integer
description
string
discount_brand
object
discount_brand_id
string
discount_percentage
number
has_claimed_code
boolean

Whether current user has claimed this code

id
string
is_bulk_code
boolean
is_valid
boolean
max_uses
integer
partner_url
string
points_required
integer
site_id
string
tags
object[]

Associated tags

terms
string
third_party_id
string
thumbnail
string
title
string
updated_at
string
valid_from
string
valid_until
string