try out ↗

← API Index


/api/admin/voucher/create2

Creates individual voucher codes for a voucher item and returns them. The lifetime of the codes is taken from validuntil, else from days, else from the item (items.voucherdays, 0 = unlimited). If customers are given, the codes are bound to them: amount codes per customer; a customer who still has unused codes for the item keeps those, only their lifetime is renewed, and they are returned instead. Requires the permission to create vouchers.

Change Note: Successor of /api/admin/voucher/create: parameters of the admin form (lifetime, customers), returns exactly the created codes.

Parameters

Name Description Type
iid id of the voucher item; it has to be redeemable by individual code (type 7, 8, 30-39, 50-59) (required) int
amount number of codes to create, 1..10000; per customer if customers are given (required) int
len number of random characters of a code, 1..20 (required) int
prefix prefix put in front of the random characters, up to 5 of letters, digits and . _ - string
customers comma separated customer ids the codes are bound to string
oo-rf optionally define the response-format for this call. One of: compact (default) | compacts | full | fulls | json | md | html | js | openapi | yaml String
oo-auth optionally force the API to check against the role (instead of silently not returning data). For guests or public access, the default is -1. 0 (regular customer) and above define the role for which the current session is expected to be authorized. int

Response Types

Type Version Description
CreateVoucherResult 1 Result of creating individual voucher codes
CreatedVoucher 1 An individual voucher code created for a voucher item

OpenAPI

See create2.yaml