For the complete documentation index, see llms.txt. This page is also available as Markdown.

Generate voucher codes in bulk

Generates count random voucher codes for a basket offer. Each code is the prefix followed by length characters randomly drawn from alphabet. All generated codes are created in active status.

Generation runs asynchronously: the endpoint returns 201 Created immediately with an empty body, and the codes appear in the list endpoint once the background job completes.

Validation rules:

  • The target basket offer must be of type bulk_voucher_code and in active status.

  • The alphabet and length must allow at least count distinct codes (len(alphabet) ^ length >= count).

  • The overall code length (prefix + length) must not exceed 32 characters.

  • No previously generated batch may exist with the same prefix and the same overall length.

post
/bulk_voucher_codes/bulk_create/
Authorizations
AuthorizationstringRequired

Token credential sent in the Authorization header, in the form: Token <your-token>. Requires a staff (admin) account.

Body

The payload of a bulk code generation request.

basket_offerintegerRequired

Identifier of the target basket offer. The offer must be of type bulk_voucher_code and in active status.

countinteger · min: 1Required

The number of codes to generate.

prefixstring · min: 2Required

The fixed prefix every generated code starts with.

alphabetstring · min: 1Optional

The characters the random part of the codes is drawn from. Only uppercase English letters and digits are allowed; duplicate characters are collapsed.

Default: ABCDEF0123456789
lengthinteger · min: 1Optional

The length of the random part appended to the prefix. prefix + length must not exceed 32 characters.

Default: 8
Responses
201

The generation job was queued. The response body is empty.

No content

post/bulk_voucher_codes/bulk_create/
POST /api/remote/1/bulk_voucher_codes/bulk_create/ HTTP/1.1
Host: sandbox.akinon.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 85

{
  "basket_offer": 1,
  "count": 1,
  "prefix": "text",
  "alphabet": "ABCDEF0123456789",
  "length": 8
}

No content

Last updated

Was this helpful?