Swarmtix Help Center
Tool Reference

swarmtix_discounts_update

Changes a discount code, public discount or access code - code, name, reduction, ticket type, window and usage limit

swarmtix_discounts_update

Changes one of an event's discounts and returns it as it stands afterwards. Only the fields you give are changed.

When you would reach for it

  • Extending a code that is about to expire.
  • Raising the usage limit on a popular code.
  • Correcting the percentage before anyone has used the code.
  • Renaming a public discount shown on the event page.

Scope

discounts:write

It is idempotent: sending the same arguments twice leaves the same discount, so a client may safely retry.

Parameters

NameTypeRequiredDefaultDescription
eventstringYes-The event's id (a GUID) or its URL slug.
discountstringYes-The id of the discount, from swarmtix_discounts_list.
codestringNokeeps currentA new code. Not for a public discount.
namestringNokeeps currentA new name. Only for a public discount.
amountOffnumberNokeeps currentA new amount off each ticket. Give this or percentOff.
percentOffnumberNokeeps currentA new percentage off each ticket, 1 to 100.
ticketTypestringNokeeps currentThe id of the one ticket type it applies to.
startsAtstringNokeeps current"now" or a UTC ISO 8601 instant.
endsAtstringNokeeps currentA UTC ISO 8601 instant.
usesLimitintegerNokeeps currentThe most redemptions in total. 0 removes the limit.

At least one field must be given. Only an active discount can be changed.

The rules

  • A coded discount's name follows its code. A public discount has no code. An access code takes nothing off the price, so it accepts no reduction.
  • Once the offer has been redeemed, its code, reduction and ticket type are fixed. You can still change the name, the window and usesLimit.
  • usesLimit cannot go below the number of redemptions so far. Redemptions are counted per reservation row, the same way checkout counts them.

startsAt and endsAt are read as UTC and stored in the event's local time, using the event's timezone. Set the timezone with swarmtix_events_update first. An event with no timezone is read as UTC.

Example call

{
  "name": "swarmtix_discounts_update",
  "arguments": {
    "event": "spring-summit-2027",
    "discount": "a15c9e02-3b7d-4c61-8f95-6d24e0a7b3c8",
    "endsAt": "2027-10-15T23:59:00Z",
    "usesLimit": 100
  }
}

What comes back

The discount as stored, in the same shape as swarmtix_discounts_create returns. startDate and endDate are in the event's local time.

Troubleshooting

"code is not valid: it has been redeemed 3 time(s), so its code, reduction and ticket type are fixed."

The discount has been used. You can only change its name, window and usesLimit. To change the price, create a new discount and switch this one off with swarmtix_discounts_delete.

"amountOff is not valid: an access code does not change a price."

Access codes take nothing off. Remove the reduction from the call.

"discount is not valid: there is no active discount with that id on this event."

The id is wrong, belongs to another event, or the discount was switched off. A switched-off discount cannot be changed.

"fields is not valid: no field to change was given."

Add at least one field.

Use cases

  • Extending a deadline on a partner code
  • Raising the limit on an early-bird code
  • Renaming a public discount

On this page