Bulk-create VoucherCodes
Imports an array of pre-existing voucher codes in a single request, creating each as a VoucherCode on the given site. This endpoint is intended for migrating voucher codes from a third-party system into Trybe — each code must be alphanumeric and unique within the organisation.
Every code in the batch is validated before any are written. If validation fails the entire request is rejected with a 422 and a per-field error map so you can correct and re-submit without wondering which records were written.
On success, all created VoucherCode objects are returned in the same order as the request array. The endpoint also creates an internal Import record that can be cross-referenced with the Trybe dashboard's import history.
Required permission: settings:manage.
Query parameters
Filter results by the site they belong to
Request body
Example request
{
"vouchers": [
{
"code": "GIFTABC123",
"amount": 50,
"balance": 50,
"valid_until": "2027-12-31",
"revenue_amount": 50
}
]
}Response
All voucher codes were successfully created.
Example response
{
"data": [
{
"code": "ABC123XYZ",
"valid_from_date": "2026-01-01T00:00:00+00:00",
"valid_to_date": "2027-01-01T00:00:00+00:00",
"amount": 5000,
"balance": 2500,
"currency": "gbp",
"value": 5000,
"partially_redeemable": true,
"uses_total": 7,
"uses_remaining": 5,
"fulfillment_status": "needs_dispatching",
"voucher_type": {
"name": "Spa Day Gift Voucher"
},
"recipient": {
"name": "Jane Doe",
"email": "jane@example.com"
},
"delivery": {
"method": "post",
"option": {
"name": "First class mail",
"price": 5000,
"revenue_centre": "spa"
}
},
"order": {
"order_ref": "TRY00",
"item_cost": 5000
},
"redemptions": [
{
"amount": 2500
}
],
"created_at": "2025-02-04T12:00:00+01:00",
"issued_at": "2026-01-02T09:00:00+00:00"
}
]
}