This sound more like a use case for CloudPages Code Resource. Retrieving a content block using API will not result in executing the AMPscript within, as this only happens during Preview, Send or VAWP contexts.
You can use JSON code resource to execute the Ampscript, and print the output e.g. in this type of structure:
{
"voucher": "XYZ123",
"contactKey": "0031232c5e3db2",
"claimed": "2021-03-23T18:25:43.511Z"
}
Your code should consist of two parts, one with logic claiming the voucher - receiving the contactKey, or other identificator of the person you assign the voucher to, from a request parameter.
And second part printing the output, e.g. like this:
{
"voucher": "%%=v(@vouchercode)=%%",
"contactKey": "%%=v(@contactkey)=%%",
"claimed": "%%=v(@claimedtime)=%%"
}
Be mindful that these code resources reside at publicly available URLs, and are not secure. So you should take applicable precautions to prevent unauthorised execution of your Ampscript.