# Guide: Abandoned Basket Campaigns

### What is the typical user flow interacting with a Limio Basket?

The following diagram represents the flow of data from the call-to-action click (also called 'add offers to basket' or 'add to cart action') to an order completed.

{% hint style="info" %}
**Looking to manually inspect abandoned baskets in Limio Commerce?** This guide covers automating abandoned basket campaigns via the API. If you are a business user or RevOps team looking to manually review and follow up on abandoned baskets, see [Guide: Inspect and Follow Up on Abandoned Baskets](https://docs.limio.com/guides/feature-implementation-guides/guide-inspect-abandoned-baskets).
{% endhint %}

### How Abandoned Baskets are generated in Limio

When a customer adds an offer within a Limio Page, Limio will immediately create a basket. This will usually be done by clicking a 'Subscribe' call-to-action on a product, pricing, or offer page (often called add offers to basket or add to cart action).

**At that stage,** **the basket will include the offer added but not user information.** It will have a unique ID, such as `"id": "b2525b37-708c-4c5c-86cc-b5c4b1e8d775"`. At this stage, it is not yet possible to retarget this basket with an abandoned basket email campaign, as it is missing user information.

How user details get onto the basket depends on the authentication model:

* **Authenticated flows (SSO / identity provider):** When the customer logs in, Limio links the identity to the basket and the checkout form pre-fills `customerDetails` (including email) from the identity provider's claims.
* **Anonymous flows (no login required):** `customerDetails.email` is saved when the customer fills in the email field on the checkout form (on blur, since Release 104). No external login is required.

Once user details are present on the basket, two things can happen:

1. If the customer completes the order, the basket will be in `completed` status.
2. If the customer does not complete the order, the basket will remain in an `active` status.

In scenario 2, the basket is considered abandoned (`"completed": false`). **You will be able to retrieve these baskets through the Limio Abandoned Basket API.**

### API Reference <a href="#options" id="options"></a>

#### Purpose of this API

The aim of the API is to provide a single endpoint to find abandon baskets that have user data populated.

Customer can then integrate this API into their Email Service Provider (or other marketing channel such as Push Notification) to send Abandon Basket campaigns.

{% hint style="info" %}
**Building an email integration?** For a step-by-step guide on integrating the Abandoned Basket API with an email service provider (including filtering, deduplication, UTM tracking, promo codes, and recovery links), see [Abandoned Basket Email Integration](https://docs.limio.com/labs/integrations/abandoned-basket-email-integration).
{% endhint %}

#### Use of this API

Once you have retrieved abandoned baskets via this API, use the `recoveryLink` field to redirect users back into their abandoned checkout. The checkout will be populated with the same offer as the one they abandoned.

{% hint style="info" %}
From Release 108 onwards, we have introduced a new field into the abandoned checkout API response called recoveryLink.

This field returns a specific link that can be used to recover a user's basket and will be returned in the following format:

```javascript
recoveryLink: /api/checkout/recover?basketId={basket-id}&recover={token}
```

It should be shared only with the intended user who should recover the basket and includes a token which will be used by Limio to verify that the correct basket is being recovered.

It should be provided to users with the following pattern:

```
https://{shopDomain}/api/checkout/recover?basketId={basket-id}&recover={token}
```

{% endhint %}

Alternatively, you can use [purchase links](https://docs.limio.com/product/checkout/how-to-configure-purchase-links) if you'd like to send them to an alternative offer, for example an offer with 10% off.

#### Identifying the user

To identify the customer who abandoned a basket, use the `customerDetails.email` field from the API response. This is the canonical email field and is populated in both authentication models:

* **Anonymous authentication flows:** `customerDetails.email` is set when the customer fills in the email field on the checkout form. Since Release 104, this happens on blur (as soon as the customer moves to the next field), rather than waiting for form submission.
* **Authenticated flows (SSO / identity provider):** `customerDetails.email` is pre-filled from the identity provider's claims when the checkout page loads. The customer's email is available on the basket from the moment they reach the authenticated checkout.

The API response also includes an `identities` array, which contains identity metadata (provider, subject identifier). However, this does not always include a usable email address — particularly in anonymous flows, where the identity is a temporary session with no PII. **Use `customerDetails.email` as the primary field for identifying and contacting the customer.**

{% hint style="success" %}
**Since Release 104**, the email address is saved to the basket as soon as the customer types it and moves to the next field (on blur), rather than only on order submission. This means the `customerDetails.email` field is now populated much earlier in the checkout process — significantly increasing the number of abandoned baskets that include a contactable email address.

This applies to the **email field** subcomponent of the Modular Checkout Form. For authenticated flows, `customerDetails.email` is pre-filled from the identity provider regardless.
{% endhint %}
