---
updatedAt: 2025-08-06T08:47:24.000Z
agentTools:
  projectIndex: https://developers.getswym.com/llms.txt
---

# Fetch User Lists

Fetches all of the lists owned by the logged in shopper without the list contents.

## swat.wishlist.fetchUserLists

Fetches  **all<Glossary>List</Glossary>** owned by the logged-in shopper without the list contents using Javascript APIs

### Definition

**`swat.wishlist.fetchUserLists(onSuccess, onError)`**

### Example

Here's an example demonstrating how to use this API to get all the **Lists** owned by the logged-in shopper:

```javascript JavaScript
// Define success callback  
let onSuccess = function(data) {  
  // Executed when the user lists data is successfully fetched  
  console.log("Successfully fetched user lists data of the shopper: ", data);  
}

// Define error callback  
let onError = function(error) {  
  console.log("Error while fetching user lists", error);  
}

// Fetch the user lists of the shopper  
swat.wishlist.fetchUserLists(onSuccess, onError);
```

### API Parameters

| Argument  | Type       | Description                                                         |
| :-------- | :--------- | :------------------------------------------------------------------ |
| onSuccess | `function` | Called when all the **Lists** are successfully fetched.             |
| onError   | `function` | Called when there is an **error** while fetching all the **Lists**. |

### Success Response

The success response contains an array of [Lists](#list-fields) owned by the shopper. Each **List** has information like its name, type, lid, created timestamp (cts), and other useful metadata.

This information can be used to retrieve or manipulate the **Lists** in future API calls.

```json success.json
{
    // status of the api call as success or error
    "status": "success",
    "data": [
        {
            // Unique identifier for the device.
            "di": "96f35dcb-699d-46ca-ad09-6f9503ca3275",
            // Type of the list (in this case, "wl" means it is a wishlist)
            "lty": "wl",
            // Unique identifier for the shopper.
            "uid": "k6EjhHmacSbNDQW/9ZM24umd2pV5VLUDe44sNcfSunM=",
            // Timestamp of when the list was created
            "cts": 1692122947783,
            // Name of the list
            "lname": "My Wishlist",
            // User who created the list
            "cby": "support@swymcorp.com",
            // Unique identifier for the list
            "lid": "1e086691-b88a-48df-9cac-fa7da8c57827",
            // Unique merchant Id
            "pid": "jID7uqlAM3iF/xqAmtL8eFr0kC7nvE/NDXyrLxZ1Y6E=",
            "st": 1,
            "id": "965d94ac-6927-40ea-9d94-ac692730ea9a",
            "uts": 1692122947783,
            "_pkey": "k6EjhHma",
            "_t": 1,
            // User email id of the list.
            "uby": "support@swymcorp.com",
            "lhash": "bXktd2lzaGxpc3Q=",
            // User for whom the list was created
            "cfor": "support@swymcorp.com"
        }
    ]
}
```

## Other References

### List Fields

```javascript
{
  "lid": "swym generated list ID",
  "lname": "List name. List names need not be unique, i.e. If uniqueness is needed API caller should ensure dupes are not",
  "lty": "_recommends", //To prevent mixing with enduser created wishlists
  "lnote": "Optional. List note, single line of note at the list level",
  "lprops": {}, //Optional. Map or properties - {}. Not available downstream for reporting or segmentation queries
  "anonRead": "Optional. Default - false. Boolean flag if anonymous read is allowed for the given List ID",
  "_cp": false,
  "cby": "Created by email address",
  "uby": "Updated by email address",
  "cts": "Created at in milliseconds",
  "uts": "Updated at in milliseconds",
}
```

| Argument | Type    | required?  | Description                                                                                                                                               |
| :------- | :------ | :--------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- |
| lid      | string  | Yes        | List id to identify the list uniquely.                                                                                                                    |
| lname    | string  | Yes        | List name.                                                                                                                                                |
| lty      | string  | (optional) | List type - when null, it represents wishlist. When set to a value eg: `_saveForLater`, gets added to a different type of list separate from the wishlist |
| lnote    | string  | (optional) | Optional note                                                                                                                                             |
| lprops   | object  | (optional) | Optional. Map of custom fields                                                                                                                            |
| anonRead | boolean | (optional) | Optional. True if the list can be read anonymously with `lid`                                                                                             |
| `_cp`    | boolean | (optional) | Optional. True if list duplication is in progress, copying the list items for large lists                                                                 |
| cts      | number  | (optional) | Created time at in milliseconds                                                                                                                           |
| uts      | number  | (optional) | Last updated time at in milliseconds                                                                                                                      |
| cby      | string  | (optional) | Email address of the user if known when list was created                                                                                                  |
| uby      | string  | (optional) | Email address of the user if known when list was last updated                                                                                             |