# Look up a code (https://docs.loybox.com.ar/en/api-reference/beneficios/consultar-codigo)



<Endpoint method="GET" path="/v1/benefits/preview/{client_benefit_code}" auth="api-key" />

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](https://docs.loybox.com.ar/api-reference/beneficios/canjear).

Looking up does not redeem: you can call it as many times as you need.

<Callout type="info" title="There is a version 2">
  [v2](https://docs.loybox.com.ar/api-reference/beneficios/consultar-codigo-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.
</Callout>

## Parameters
<Fields>
  <Field name="client_benefit_code" type="string" location="path" required="true">
    The redemption code the member holds.
  </Field>
</Fields>

## Response
A [Benefit](https://docs.loybox.com.ar/api-reference/objetos#beneficio) object.

```bash
curl https://loybox-public-api-752998171300.southamerica-west1.run.app/v1/benefits/preview/887766 \
  -H "Authorization: Bearer $LOYBOX_API_KEY"
```

```json
// 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.
