> For the complete documentation index, see [llms.txt](https://docs.sparkloop.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sparkloop.app/client-api/offers.md).

# Offers

Offer methods live under `SL.client.offers`. They all return promises and work with the [Offer object](/client-api/objects/offer.md).

The expected flow is a single, short-lived pass: `generate` (or `fetch`) → display → `claim`. Keep the time between generating and claiming as short as possible.

{% hint style="warning" %}
Never cache or store offers. If an offer is no longer recommendable when your `claim` call arrives, it is discarded — see [Errors & Warnings](/client-api/errors-and-warnings.md).
{% endhint %}

### generate()

Generates fresh offers for the current reader. Takes no arguments.

Returns an array of [Offer](/client-api/objects/offer.md) objects.

```js
const offers = await SL.client.offers.generate();
```

### fetch({ uuid })

Fetches a single offer by its uuid.

* `uuid` *(required)* — the offer's uuid.

Returns a single [Offer](/client-api/objects/offer.md) object, including the `recommendable` field.

Use `fetch` to spotlight a specific offer — for example, one that is contextual to the content surrounding it. It is not meant as an extra step between `generate` and `claim`: offers you just generated can be claimed directly.

Always check `recommendable` before displaying a fetched offer. When it's `false`, don't show it — claims to it will be discarded.

```js
const offer = await SL.client.offers.fetch({ uuid: "offer_recommendation_9f8e7d6c5b4a" });

if (offer.recommendable) {
  // render the offer in your UI
}
```

### claim({ email, uuid })

Claims an offer for the reader.

* `uuid` *(required)* — the offer's uuid.
* `email` — the reader's email address. Required for `lead` offers, not required for `click` or `action` offers.

The return value depends on the offer's `conversion_type`:

* `lead` offers return `{ response: "ok" }`.
* `click` and `action` offers return `{ redirect_url }`.

```js
// Lead offer
await SL.client.offers.claim({ email: "reader@example.com", uuid: offer.uuid });

// Click or action offer
window.open(offer.redirect_url, "_blank");
SL.client.offers.claim({ uuid: offer.uuid });
```

{% hint style="info" %}
For `click` and `action` offers, the redirect URL is already included in the [Offer object](/client-api/objects/offer.md). Browsers only allow opening a new tab for a short moment after a click, so don't make the reader wait for a network roundtrip: redirect or open the new tab immediately using the offer's `redirect_url`, then call `claim` — it's what registers the claim with SparkLoop.
{% endhint %}

{% hint style="danger" %}
Readers must explicitly choose the offers you claim for them. Misleading readers into claiming offers without their consent results in a permanent block of your SparkLoop account.
{% endhint %}
