Voucher pools and codes tools

search_voucher_pools

Searches the voucher pools in a project, or fetches one by ID. Voucher pools are named collections of unique discount or promo codes that campaigns draw from when sending to customers. Omit pool_id to list all voucher pools — you get each pool's name, the total number of codes, and how many are still available. Pass pool_id to fetch the full details of a single pool, including a used_by list of the campaigns or resources that draw from it. Use list_voucher_codes to inspect the individual codes inside a pool.

Request parameters

NameTypeRequired?Description
project_idstrYesThe project ID returned by list_projects.
pool_idstr | nullNoThe voucher pool ID for direct lookup. Omit to list all; provide to fetch one.

Response parameters

The tool returns a VoucherPoolsResponse when pool_id is omitted, or a VoucherPoolResponse when it's provided.

The VoucherPoolsResponse object has the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
datalist[VoucherPoolSummary]The voucher pools defined in the project.
errorstr | nullError message if the request failed.

The VoucherPoolSummary object has the following fields:

FieldTypeDescription
idstrThe voucher pool's unique ID.
namestrThe pool's display name. Unique within the project.
totalintThe total number of codes in the pool.
availableintThe number of codes still available (not yet assigned or redeemed).

The VoucherPoolResponse object has the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
dataVoucherPool | nullThe full voucher pool record.
errorstr | nullError message if the request failed.

The VoucherPool object adds the following fields on top of the summary record:

FieldTypeDescription
company_idstrThe project ID this pool belongs to.
used_bylist[any]Campaigns or other resources that draw from this pool.

list_voucher_codes

Lists the individual codes inside a voucher pool. Each code has a statusavailable (not yet used), assigned (given to a customer but not redeemed), or redeemed (fully used) — plus assignment and redemption timestamps where applicable. There is no detail endpoint for individual codes; this list is the only way to inspect them.

Request parameters

NameTypeRequired?Description
project_idstrYesThe project ID returned by list_projects.
pool_idstrYesThe voucher pool ID returned by search_voucher_pools.
skipintNoPagination offset. Defaults to 0.
countintNoNumber of codes to return. Defaults to 20. Maximum 1,000.

Response parameters

The tool returns a VoucherCodesResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
datalist[VoucherCode]The voucher code records on this page.
matchedint | nullThe total number of codes in the pool that match the current filter.
matched_limitedbool | nullWhether the matched count was capped by a server limit.
skipintThe pagination offset that was applied.
limitintThe maximum number of records returned.
errorstr | nullError message if the request failed.

The VoucherCode object has the following fields:

FieldTypeDescription
codestrThe voucher code string, for example SUMMER20 or ABC-123.
statusstrOne of available, assigned (given but not redeemed), or redeemed.
assigned_timefloat | nullUnix timestamp of when the code was assigned to a customer.
redeemed_timefloat | nullUnix timestamp of when the code was redeemed.


Did this page help you?

© Bloomreach, Inc. All rights reserved.