Look up a code (v2)

Version 2 of the code lookup, with the title and the discount's value at the top level.

GET/v2/benefits/preview/{client_benefit_code}Commerce API key

It does the same as version 1, returning information about the benefit from the code the member holds to redeem it, but it returns three extra fields at the root of the object.

For a new integration, use this one.

What changes

FieldIn v1In v2
titleOnly inside prizeAt the root, and always present
valueOnly inside prizeAt the root
productOnly inside prizeAt the root

In practice: to apply the discount you no longer need to dig into prize or check that it exists. Every other field is the same.

Parameters

client_benefit_codestringpathrequired

The redemption code the member holds.

Response

A Benefit (v2) object.

curl https://loybox-public-api-752998171300.southamerica-west1.run.app/v2/benefits/preview/887766 \
  -H "Authorization: Bearer $LOYBOX_API_KEY"
// 200 OK
{
  "id": "b_9f2a",
  "type": "percentage_discount",
  "value": 20,
  "title": "20% off",
  "description": "Válido en toda la tienda",
  "product": null,
  "cost": 250,
  "expiration": "2026-12-31T23:59:59Z",
  "benefit_type": "normal",
  "color": "#f1a10d",
  "buy_limit": 0,
  "prize": null,
  "tiendanube_coupon": null
}

What to read depending on the type:

typeWhat to do
percentage_discountApply the percentage in value.
absolute_discountSubtract the amount in value.
free_productAdd the product in product.

How it is redeemed

The same as in v1: with POST /v1/benefits/redeem. Redemption has no version 2: the same code works for both.

Errors

CodeWhen
400The benefit was already used.
401The API key is invalid: it has no commerce attached.
404The benefit does not exist.
422The code is not a valid format.