Look up a code
Which reward a redemption code is, before redeeming it.
Returns information about a benefit using the code the member holds to redeem it.
It is what tells you which actions to take before redeeming: what kind of reward it is, how much discount to apply, whether it is a gift product. With that, your system can apply the benefit in the sale and only then mark it as used.
Looking up does not redeem: you can call it as many times as you need.
There is a version 2
v2 returns the same plus the
title, the discount's value and the product at the top level, without having
to dig into prize. For a new integration, that is the one to use.
Parameters
client_benefit_codestringpathrequiredThe redemption code the member holds.
Response
A Benefit object.
curl https://loybox-public-api-752998171300.southamerica-west1.run.app/v1/benefits/preview/887766 \
-H "Authorization: Bearer $LOYBOX_API_KEY"// 200 OK
{
"id": "b_9f2a",
"type": "percentage_discount",
"description": "20% de descuento en toda la tienda",
"cost": 250,
"expiration": "2026-12-31T23:59:59Z",
"benefit_type": "normal",
"color": "#f1a10d",
"buy_limit": 0,
"prize": {
"type": "percentage_discount",
"title": "20% off",
"description": "Válido en toda la tienda",
"value": 20,
"product": null,
"expiration": "2026-12-31T23:59:59Z",
"image": null
},
"tiendanube_coupon": null
}What to read depending on the type:
type | What to do |
|---|---|
percentage_discount | Apply the percentage in prize.value. |
absolute_discount | Subtract the amount in prize.value. |
free_product | Add the product in prize.product. |
Errors
| Code | When |
|---|---|
400 | The benefit was already used. |
401 | The API key is invalid: it has no commerce attached. |
404 | The benefit does not exist. |
422 | The code is not a valid format. |
A 400 here already tells you to stop: the code is burned and no discount should
be applied.