# Promo codes tools

[All tool areas](/docs/tools.md). Each tool acts within your access.

## Promo codes

### create_promo_code

Create a promo code guests type at checkout: an amount or percentage off the tickets, extras, or both; a set price per seat; or the service charge waived. For a comp, media, or partner code, give the reason, and it shows in get_comps_report. A comp defaults to one use when usageLimit is omitted; set a number for another limit, or null for no limit. A code for 100% off always needs a reason (invalid_input without one). Limit it to products, locations, when it can be used, the dates of the sessions it can be used on, and a total number of uses. One code per order. A manager's code is limited: its own locations, reason service_recovery or comp, one use, and expiring within 30 days. Returns a preview to confirm.

Changes · Members of an organization · Needs promos:write

#### Input

- `code` — string; optional. Letters, digits, and hyphens, 6 to 32; stored uppercase, and guests' typing matches any case. Left out, a random one of 10 characters is made. A comp, or a code that can reach 100% off (percent_off of 100%, or set_price 0), must be left out: it can't be typed pattern: "^\[A-Za-z0-9-\]\{6,32\}$"
- `kind` — string; required. amount_off: `amount` off the order; percent_off: `percentPpm` off; set_price: each individual seat comes down to `amount` (a line at or below it stays; group and private lines aren't eligible); waive_service_charge: every fee on the order is 0 Allowed: "amount\_off", "percent\_off", "set\_price", "waive\_service\_charge"
- `amount` — integer; optional. Minor units: amount_off's total off, or set_price's per seat
- `currency` — string; optional. With `amount`. The code applies only where the entity's currency is this pattern: "^\[A-Z\]\{3\}$"
- `percentPpm` — integer; optional. percent_off, in parts per million (15% is 150000) minimum: 1; maximum: 1000000
- `appliesTo` — string; optional. What amount_off and percent_off discount: tickets, extras, or both (the default). set_price is always tickets and waive_service_charge always fees: any other value is refused Allowed: "tickets", "extras", "both", "fees"
- `productIds` — array; optional. The products it can be used on; empty means all maxItems: 100
  - `productIds[]` — string; optional. The product's id, from list_products
- `locationIds` — array; optional. The locations it can be used at; empty means all maxItems: 100
  - `locationIds[]` — string; optional. The location's id, from get_setup
- `validFrom` — string or null; optional. When it can first be used format: "date-time"
- `validUntil` — string or null; optional. When it stops being usable format: "date-time"
- `sessionFrom` — string or null; optional. The first local date of a session it can be used on, at the session's location format: "date"
- `sessionUntil` — string or null; optional. The last local date of a session it can be used on format: "date"
- `usageLimit` — integer or null; optional. Total number of uses. Omit for one use when reason is comp, otherwise no limit; null explicitly means no limit minimum: 1; maximum: 1000000
- `reason` — string or null; optional. Why: comp, partner, media, or service_recovery, shown in the comps report. Null: a plain promotion Allowed: "comp", "partner", "media", "service\_recovery"

#### Output

- `id` — string; required. 
- `code` — string; required. The code, shown only to someone holding promos:write everywhere it applies. Otherwise masked: •••• and its last 4 characters
- `kind` — string; required.  Allowed: "amount\_off", "percent\_off", "set\_price", "waive\_service\_charge"
- `amount` — integer or null; required. amount_off's and set_price's, in `currency`
- `currency` — string or null; required. 
- `percentPpm` — integer or null; required. percent_off's, in parts per million (15% is 150000) minimum: -9007199254740991; maximum: 9007199254740991
- `appliesTo` — string; required.  Allowed: "tickets", "extras", "both", "fees"
- `productIds` — array; required. 
  - `productIds[]` — string; optional. 
- `locationIds` — array; required. 
  - `locationIds[]` — string; optional. 
- `validFrom` — string or null; required.  format: "date-time"
- `validUntil` — string or null; required.  format: "date-time"
- `sessionFrom` — string or null; required. 
- `sessionUntil` — string or null; required. 
- `usageLimit` — integer or null; required.  minimum: -9007199254740991; maximum: 9007199254740991
- `uses` — integer; required. Uses so far: live holds, orders waiting for payment, and orders that were confirmed minimum: -9007199254740991; maximum: 9007199254740991
- `reason` — string or null; required.  Allowed: "comp", "partner", "media", "service\_recovery"
- `status` — string; required.  Allowed: "active", "archived"
- `createdBy` — object; required. 
  - `createdBy.memberId` — string; required. 
  - `createdBy.name` — string; required. The member's name, else their email
- `createdAt` — string; required.  format: "date-time"

### get_comps_report

Get what promo codes and free stored value (promotional gift certificates, and goodwill and service recovery credits) took off bookings, by reason and by code or certificate, over a date range. Dates are local dates at the order's location: by default the date it was confirmed (`basis: booked`), so a comp shows in the period it was given, or with `basis: session` the date its session runs. Confirmed orders only: one canceled since gave nothing away. Different currencies are never added together: each total has its own. Amounts need orders:amounts (null without). A promo code's own text shows only with promos:write everywhere it applies, and is otherwise masked (•••• and its last 4 characters). Stored value codes are always masked. Only orders at places your grants cover.

Reads · Members of an organization · Needs promos:read

#### Input

- `from` — string; required. First local date (of confirmation, or of the session) format: "date"
- `to` — string; required. Last local date, up to 366 days after `from` format: "date"
- `basis` — string; optional. `booked`: the local date the order was confirmed (the default); `session`: the local date its session runs Allowed: "booked", "session"; default: "booked"
- `locationId` — string; optional. The location's id, from get_setup
- `reason` — string; optional.  Allowed: "comp", "partner", "media", "service\_recovery", "goodwill"

#### Output

- `from` — string; required. 
- `to` — string; required. 
- `basis` — string; required.  Allowed: "booked", "session"
- `canExport` — boolean; required. Whether the organization's plan includes CSV export (Growth and up): the screen offers the download only then. The rows are the same either way
- `columns` — array; required. How to read `orders` as a CSV, with reportCsv()
  - `columns[]` — object; optional. 
    - `columns[].key` — string; required. 
    - `columns[].label` — string; required. 
    - `columns[].kind` — string; required.  Allowed: "money", "count", "date", "text"
- `byReason` — array; required. 
  - `byReason[]` — object; optional. 
    - `byReason[].reason` — string or null; required.  Allowed: "comp", "partner", "media", "service\_recovery", "goodwill"
    - `byReason[].currency` — string; required. 
    - `byReason[].orders` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
    - `byReason[].seats` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
    - `byReason[].discount` — integer or null; required. The total discount in this currency, before tax. Null unless you may see orders:amounts on every order in it
- `byCode` — array; required. 
  - `byCode[]` — object; optional. 
    - `byCode[].source` — string; optional.  Allowed: "promo\_code", "gift\_certificate", "credit"
    - `byCode[].instrumentId` — string; optional. 
    - `byCode[].promoCodeId` — string or null; required. 
    - `byCode[].code` — string; required. The code, shown only to someone holding promos:write everywhere it applies. Otherwise masked: •••• and its last 4 characters
    - `byCode[].kind` — string or null; optional.  Allowed: "amount\_off", "percent\_off", "set\_price", "waive\_service\_charge"
    - `byCode[].reason` — string or null; required.  Allowed: "comp", "partner", "media", "service\_recovery", "goodwill"
    - `byCode[].currency` — string; required. 
    - `byCode[].orders` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
    - `byCode[].seats` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
    - `byCode[].discount` — integer or null; required. The total discount in this currency, before tax. Null unless you may see orders:amounts on every order in it
- `orders` — array; required. 
  - `orders[]` — object; optional. 
    - `orders[].source` — string; optional.  Allowed: "promo\_code", "gift\_certificate", "credit"
    - `orders[].instrumentId` — string; optional. 
    - `orders[].orderId` — string; required. 
    - `orders[].bookingCode` — string; required. 
    - `orders[].confirmedOn` — string; required. The local date it was confirmed, at its location
    - `orders[].sessionOn` — string; required. The local date its session runs, at its location
    - `orders[].product` — object; required. 
      - `orders[].product.id` — string; required. 
      - `orders[].product.name` — string; required. 
    - `orders[].location` — object; required. 
      - `orders[].location.id` — string; required. 
      - `orders[].location.name` — string; required. 
    - `orders[].code` — string; required. The code, shown only to someone holding promos:write everywhere it applies. Otherwise masked: •••• and its last 4 characters
    - `orders[].kind` — string or null; optional.  Allowed: "amount\_off", "percent\_off", "set\_price", "waive\_service\_charge"
    - `orders[].reason` — string or null; required.  Allowed: "comp", "partner", "media", "service\_recovery", "goodwill"
    - `orders[].seats` — integer; required.  minimum: -9007199254740991; maximum: 9007199254740991
    - `orders[].currency` — string; required. 
    - `orders[].discount` — integer or null; required. Before tax. Null without orders:amounts
    - `orders[].createdBy` — string; required. Who created the code: the member's name, else their email
    - `orders[].customerFirstName` — string; required. 

### list_promo_codes

List promo codes, newest first: each one's code, terms, limits, uses so far, status, and who made it. Filter by status and reason. With a grant at some locations, only codes limited to those locations show; a code for every location needs a grant across the organization. The code's own text shows only with promos:write everywhere it applies, and is otherwise masked (•••• and its last 4 characters). Page back with `before`.

Reads · Members of an organization · Needs promos:read

#### Input

- `status` — string; optional.  Allowed: "active", "archived"
- `reason` — string; optional.  Allowed: "comp", "partner", "media", "service\_recovery"
- `limit` — integer; optional. The most results to return (default 50) minimum: 1; maximum: 100; default: 50
- `before` — string; optional. A promo code id; returns codes older than it

#### Output

- `promoCodes` — array; required. 
  - `promoCodes[]` — object; optional. 
    - `promoCodes[].id` — string; required. 
    - `promoCodes[].code` — string; required. The code, shown only to someone holding promos:write everywhere it applies. Otherwise masked: •••• and its last 4 characters
    - `promoCodes[].kind` — string; required.  Allowed: "amount\_off", "percent\_off", "set\_price", "waive\_service\_charge"
    - `promoCodes[].amount` — integer or null; required. amount_off's and set_price's, in `currency`
    - `promoCodes[].currency` — string or null; required. 
    - `promoCodes[].percentPpm` — integer or null; required. percent_off's, in parts per million (15% is 150000) minimum: -9007199254740991; maximum: 9007199254740991
    - `promoCodes[].appliesTo` — string; required.  Allowed: "tickets", "extras", "both", "fees"
    - `promoCodes[].productIds` — array; required. 
      - `promoCodes[].productIds[]` — string; optional. 
    - `promoCodes[].locationIds` — array; required. 
      - `promoCodes[].locationIds[]` — string; optional. 
    - `promoCodes[].validFrom` — string or null; required.  format: "date-time"
    - `promoCodes[].validUntil` — string or null; required.  format: "date-time"
    - `promoCodes[].sessionFrom` — string or null; required. 
    - `promoCodes[].sessionUntil` — string or null; required. 
    - `promoCodes[].usageLimit` — integer or null; required.  minimum: -9007199254740991; maximum: 9007199254740991
    - `promoCodes[].uses` — integer; required. Uses so far: live holds, orders waiting for payment, and orders that were confirmed minimum: -9007199254740991; maximum: 9007199254740991
    - `promoCodes[].reason` — string or null; required.  Allowed: "comp", "partner", "media", "service\_recovery"
    - `promoCodes[].status` — string; required.  Allowed: "active", "archived"
    - `promoCodes[].createdBy` — object; required. 
      - `promoCodes[].createdBy.memberId` — string; required. 
      - `promoCodes[].createdBy.name` — string; required. The member's name, else their email
    - `promoCodes[].createdAt` — string; required.  format: "date-time"
- `nextBefore` — string or null; required. 

### update_promo_code

Change a promo code: its limits, reason, or status (archive to stop guests using it; a used code is archived, never deleted). Holds and orders already made keep the terms they locked. A used code's kind and amount can't change (conflict): archive it and make another. A typed code can't become a comp or reach 100% off, and no code's text ever changes. A change that leaves a code at 100% off needs it to have a reason. A manager can only archive a code within a manager's limits (status: archived, nothing else), and makes a new one for any other change. Returns a preview to confirm.

Changes · Members of an organization · Needs promos:write

#### Input

- `promoCodeId` — string; required. The promo code's id, from list_promo_codes
- `kind` — string; optional. amount_off: `amount` off the order; percent_off: `percentPpm` off; set_price: each individual seat comes down to `amount` (a line at or below it stays; group and private lines aren't eligible); waive_service_charge: every fee on the order is 0 Allowed: "amount\_off", "percent\_off", "set\_price", "waive\_service\_charge"
- `amount` — integer or null; optional. Minor units (cents) in the location's currency
- `currency` — string or null; optional.  pattern: "^\[A-Z\]\{3\}$"
- `percentPpm` — integer or null; optional.  minimum: 1; maximum: 1000000
- `appliesTo` — string; optional. What amount_off and percent_off discount: tickets, extras, or both (the default). set_price is always tickets and waive_service_charge always fees: any other value is refused Allowed: "tickets", "extras", "both", "fees"
- `productIds` — array; optional. The products it can be used on; empty means all maxItems: 100
  - `productIds[]` — string; optional. The product's id, from list_products
- `locationIds` — array; optional. The locations it can be used at; empty means all maxItems: 100
  - `locationIds[]` — string; optional. The location's id, from get_setup
- `validFrom` — string or null; optional. When it can first be used format: "date-time"
- `validUntil` — string or null; optional. When it stops being usable format: "date-time"
- `sessionFrom` — string or null; optional. The first local date of a session it can be used on, at the session's location format: "date"
- `sessionUntil` — string or null; optional. The last local date of a session it can be used on format: "date"
- `usageLimit` — integer or null; optional. How many times it can be used in all: a live hold counts, and gives the use back if released or run out; a confirmed order counts even if it's canceled later. Null: no limit minimum: 1; maximum: 1000000
- `reason` — string or null; optional. Why: comp, partner, media, or service_recovery, shown in the comps report. Null: a plain promotion Allowed: "comp", "partner", "media", "service\_recovery"
- `status` — string; optional. archived: guests can't use it any more. Holds and orders keep it Allowed: "active", "archived"

#### Output

- `id` — string; required. 
- `code` — string; required. The code, shown only to someone holding promos:write everywhere it applies. Otherwise masked: •••• and its last 4 characters
- `kind` — string; required.  Allowed: "amount\_off", "percent\_off", "set\_price", "waive\_service\_charge"
- `amount` — integer or null; required. amount_off's and set_price's, in `currency`
- `currency` — string or null; required. 
- `percentPpm` — integer or null; required. percent_off's, in parts per million (15% is 150000) minimum: -9007199254740991; maximum: 9007199254740991
- `appliesTo` — string; required.  Allowed: "tickets", "extras", "both", "fees"
- `productIds` — array; required. 
  - `productIds[]` — string; optional. 
- `locationIds` — array; required. 
  - `locationIds[]` — string; optional. 
- `validFrom` — string or null; required.  format: "date-time"
- `validUntil` — string or null; required.  format: "date-time"
- `sessionFrom` — string or null; required. 
- `sessionUntil` — string or null; required. 
- `usageLimit` — integer or null; required.  minimum: -9007199254740991; maximum: 9007199254740991
- `uses` — integer; required. Uses so far: live holds, orders waiting for payment, and orders that were confirmed minimum: -9007199254740991; maximum: 9007199254740991
- `reason` — string or null; required.  Allowed: "comp", "partner", "media", "service\_recovery"
- `status` — string; required.  Allowed: "active", "archived"
- `createdBy` — object; required. 
  - `createdBy.memberId` — string; required. 
  - `createdBy.name` — string; required. The member's name, else their email
- `createdAt` — string; required.  format: "date-time"
