BackstageClient.codes
BackstageClient.codes in @ticketlayer/backstage.
@ticketlayer/backstage / BackstageClient / codes
codes: {
archive: (codeId: string, requestOptions?: RequestOptions) => Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>;
create: (request: {
accountId: string;
active?: boolean;
channelIds?: string[] | null;
code: string;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: "event_group";
} & {
[key: string]: unknown;
}
| {
type: "event_tag";
} & {
[key: string]: unknown;
}
| {
type: "event_metadata";
} & {
[key: string]: unknown;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "waive_fees";
})[];
label: string;
maxOrders?: number | null;
validFrom?: string | null;
validUntil?: string | null;
}, requestOptions?: RequestOptions) => Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>;
get: (codeId: string, requestOptions?: RequestOptions) => Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>;
list: (options?: {
includeArchived?: "true" | "false";
search?: string;
}, requestOptions?: RequestOptions) => Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (... | ... | ... | ... | ... | ... | ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (... | ... | ... | ... | ... | ... | ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}[]>;
update: (codeId: string, request: {
active?: boolean;
channelIds?: string[] | null;
code?: string;
effects?: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
label?: string;
maxOrders?: number | null;
validFrom?: string | null;
validUntil?: string | null;
}, requestOptions?: RequestOptions) => Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>;
};Defined in: client.ts:8796
Codes methods
archive()#
archive: (codeId: string, requestOptions?: RequestOptions) => Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>;Archive a code Archive a code: it stops working at once, on open carts too (checkout refuses it by name), its text stays reserved, and orders keep their record of it. Nothing is deleted. Idempotent. Needs codes.write on its account.
Parameters#
| Parameter | Type |
|---|---|
codeId | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>
Operation Id#
archiveCode
create()#
create: (request: {
accountId: string;
active?: boolean;
channelIds?: string[] | null;
code: string;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: "event_group";
} & {
[key: string]: unknown;
}
| {
type: "event_tag";
} & {
[key: string]: unknown;
}
| {
type: "event_metadata";
} & {
[key: string]: unknown;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "waive_fees";
})[];
label: string;
maxOrders?: number | null;
validFrom?: string | null;
validUntil?: string | null;
}, requestOptions?: RequestOptions) => Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>;Create a code
Create a code with one or more effects: unlock targets (a locked or hidden price inside becomes buyable for the cart), a discount (a percentage, an amount per ticket or an amount per order, optionally targeted and capped; it may discount a locked price once unlocked), act_as_tag (the cart counts as holding a customer tag whose definition lists code in grantableBy, which opens its prices and tag-audience sale windows) and waive_fees (the targeted lines' per-ticket fees, and the per-order fee when it targets the whole order). Nothing is ever granted to a customer. Needs codes.write on the owning account and on every account selling on the channels it may be used on (every account with a channel when channelIds is null); a waive_fees effect needs codes.waive_fees on them besides (403 CODE_WAIVE_FEES_NOT_ALLOWED). The text is unique in the organisation, case-insensitively (409 CODE_EXISTS). A target of a reserved kind (event_group, event_tag, event_metadata) is 400 CODE_TARGET_NOT_SUPPORTED; one naming nothing is 400 CODE_TARGET_NOT_FOUND; an undefined tag is 400 TAG_NOT_DEFINED and one a code may not act as 403 TAG_NOT_GRANTABLE.
Parameters#
| Parameter | Type | Description |
|---|---|---|
request | { accountId: string; active?: boolean; channelIds?: string[] | null; code: string; effects: ( | { targets: ( | { eventId: string; type: "event"; } | { occurrenceId: string; type: "occurrence"; } | { ticketTypeId: string; type: "ticket_type"; } | { categoryId: string; ticketTypeId: string; type: "price_cell"; } | { type: "event_group"; } & { [key: string]: unknown; } | { type: "event_tag"; } & { [key: string]: unknown; } | { type: "event_metadata"; } & { [key: string]: unknown; })[]; type: "unlock"; } | { amountPerOrder?: number; amountPerTicket?: number; cap?: number | null; label?: string; percent?: number; targets?: ( | { eventId: string; type: "event"; } | { occurrenceId: string; type: "occurrence"; } | { ticketTypeId: string; type: "ticket_type"; } | { categoryId: string; ticketTypeId: string; type: "price_cell"; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; })[]; type: "discount"; } | { tag: string; type: "act_as_tag"; } | { targets?: ( | { eventId: string; type: "event"; } | { occurrenceId: string; type: "occurrence"; } | { ticketTypeId: string; type: "ticket_type"; } | { categoryId: string; ticketTypeId: string; type: "price_cell"; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; })[]; type: "waive_fees"; })[]; label: string; maxOrders?: number | null; validFrom?: string | null; validUntil?: string | null; } | - |
request.accountId | string | Description The owning account: who may manage the code Example acc_abc123 |
request.active? | boolean | Example true |
request.channelIds? | string[] | null | Description The sales channels it may be used on; null or absent for every channel of the organisation |
request.code? | string | Description What a buyer types. Stored upper-cased and matched case-insensitively; unique in the organisation Example BEST2FORYOU |
request.effects? | ( | { targets: ( | { eventId: string; type: "event"; } | { occurrenceId: string; type: "occurrence"; } | { ticketTypeId: string; type: "ticket_type"; } | { categoryId: string; ticketTypeId: string; type: "price_cell"; } | { type: "event_group"; } & { [key: string]: unknown; } | { type: "event_tag"; } & { [key: string]: unknown; } | { type: "event_metadata"; } & { [key: string]: unknown; })[]; type: "unlock"; } | { amountPerOrder?: number; amountPerTicket?: number; cap?: number | null; label?: string; percent?: number; targets?: ( | { eventId: string; type: "event"; } | { occurrenceId: string; type: "occurrence"; } | { ticketTypeId: string; type: "ticket_type"; } | { categoryId: string; ticketTypeId: string; type: "price_cell"; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; })[]; type: "discount"; } | { tag: string; type: "act_as_tag"; } | { targets?: ( | { eventId: string; type: "event"; } | { occurrenceId: string; type: "occurrence"; } | { ticketTypeId: string; type: "ticket_type"; } | { categoryId: string; ticketTypeId: string; type: "price_cell"; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; })[]; type: "waive_fees"; })[] | - |
request.label? | string | Description What a buyer and the order read Example Fan club presale |
request.maxOrders? | number | null | Description How many orders it may be used on (one use per order, whatever the quantity); null for no limit Example 100 |
request.validFrom? | string | null | Format: date-time Description Not usable before this instant Example 2026-10-01T09:00:00.000Z |
request.validUntil? | string | null | Format: date-time Description Not usable from this instant Example 2026-10-08T09:00:00.000Z |
requestOptions? | RequestOptions | - |
Returns#
Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>
Operation Id#
createCode
get()#
get: (codeId: string, requestOptions?: RequestOptions) => Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>;Get a code A code, archived or not, with its effects and remaining uses. Needs codes.read on its account.
Parameters#
| Parameter | Type |
|---|---|
codeId | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>
Operation Id#
getCode
list()#
list: (options?: {
includeArchived?: "true" | "false";
search?: string;
}, requestOptions?: RequestOptions) => Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (... | ... | ... | ... | ... | ... | ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (... | ... | ... | ... | ... | ... | ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}[]>;List codes
The organisation's codes on the accounts the caller holds codes.read on, newest first, optionally only those containing search (case-insensitive): how a counter finds the code a buyer meant. Archived codes are left out unless includeArchived=true. codes.read is also the counter's see-codes permission (TKT-344); a delegated token or API key reaches it only with the granular codes.read scope.
Parameters#
| Parameter | Type |
|---|---|
options? | { includeArchived?: "true" | "false"; search?: string; } |
options.includeArchived? | "true" | "false" |
options.search? | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (... | ... | ... | ... | ... | ... | ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (... | ... | ... | ... | ... | ... | ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}[]>
Operation Id#
listCodes
update()#
update: (codeId: string, request: {
active?: boolean;
channelIds?: string[] | null;
code?: string;
effects?: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
label?: string;
maxOrders?: number | null;
validFrom?: string | null;
validUntil?: string | null;
}, requestOptions?: RequestOptions) => Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>;Update a code
Change a code's text, label, active flag, validity, channels, order limit or effects; the owning account is fixed. effects replaces the list whole. Open carts holding the code price with it as it now is. The same permissions as creating it, on the channels it will be usable on; a code that has or gets a waive_fees effect needs codes.waive_fees. An archived code cannot be edited (409).
Parameters#
| Parameter | Type | Description |
|---|---|---|
codeId | string | - |
request | { active?: boolean; channelIds?: string[] | null; code?: string; effects?: ( | { targets: ( | { eventId: string; type: "event"; } | { occurrenceId: string; type: "occurrence"; } | { ticketTypeId: string; type: "ticket_type"; } | { categoryId: string; ticketTypeId: string; type: "price_cell"; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; })[]; type: "unlock"; } | { amountPerOrder?: number; amountPerTicket?: number; cap?: number | null; label?: string; percent?: number; targets?: ( | { eventId: ...; type: ...; } | { occurrenceId: ...; type: ...; } | { ticketTypeId: ...; type: ...; } | { categoryId: ...; ticketTypeId: ...; type: ...; } | ... & ... | ... & ... | ... & ...)[]; type: "discount"; } | { tag: string; type: "act_as_tag"; } | { targets?: ( | { eventId: ...; type: ...; } | { occurrenceId: ...; type: ...; } | { ticketTypeId: ...; type: ...; } | { categoryId: ...; ticketTypeId: ...; type: ...; } | ... & ... | ... & ... | ... & ...)[]; type: "waive_fees"; })[]; label?: string; maxOrders?: number | null; validFrom?: string | null; validUntil?: string | null; } | - |
request.active? | boolean | - |
request.channelIds? | string[] | null | - |
request.code? | string | Description What a buyer types. Stored upper-cased and matched case-insensitively; unique in the organisation Example BEST2FORYOU |
request.effects? | ( | { targets: ( | { eventId: string; type: "event"; } | { occurrenceId: string; type: "occurrence"; } | { ticketTypeId: string; type: "ticket_type"; } | { categoryId: string; ticketTypeId: string; type: "price_cell"; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; } | { type: ...; } & { [key: ...]: ...; })[]; type: "unlock"; } | { amountPerOrder?: number; amountPerTicket?: number; cap?: number | null; label?: string; percent?: number; targets?: ( | { eventId: ...; type: ...; } | { occurrenceId: ...; type: ...; } | { ticketTypeId: ...; type: ...; } | { categoryId: ...; ticketTypeId: ...; type: ...; } | ... & ... | ... & ... | ... & ...)[]; type: "discount"; } | { tag: string; type: "act_as_tag"; } | { targets?: ( | { eventId: ...; type: ...; } | { occurrenceId: ...; type: ...; } | { ticketTypeId: ...; type: ...; } | { categoryId: ...; ticketTypeId: ...; type: ...; } | ... & ... | ... & ... | ... & ...)[]; type: "waive_fees"; })[] | - |
request.label? | string | - |
request.maxOrders? | number | null | - |
request.validFrom? | string | null | Format: date-time |
request.validUntil? | string | null | Format: date-time |
requestOptions? | RequestOptions | - |
Returns#
Promise<{
accountId: string;
active: boolean;
archivedAt: string | null;
channelIds: string[] | null;
code: string;
createdAt: string;
createdBy: string | null;
effects: (
| {
targets: (
| {
eventId: string;
type: "event";
}
| {
occurrenceId: string;
type: "occurrence";
}
| {
ticketTypeId: string;
type: "ticket_type";
}
| {
categoryId: string;
ticketTypeId: string;
type: "price_cell";
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
}
| {
type: ...;
} & {
[key: ...]: ...;
})[];
type: "unlock";
}
| {
amountPerOrder?: number;
amountPerTicket?: number;
cap?: number | null;
label?: string;
percent?: number;
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "discount";
}
| {
tag: string;
type: "act_as_tag";
}
| {
targets?: (
| {
eventId: ...;
type: ...;
}
| {
occurrenceId: ...;
type: ...;
}
| {
ticketTypeId: ...;
type: ...;
}
| {
categoryId: ...;
ticketTypeId: ...;
type: ...;
}
| ... & ...
| ... & ...
| ... & ...)[];
type: "waive_fees";
})[];
id: string;
label: string;
maxOrders: number | null;
orderCount: number;
organisationId: string;
remainingOrders: number | null;
updatedAt: string;
validFrom: string | null;
validUntil: string | null;
}>
Operation Id#
updateCode