---
title: "Checklists API"
url: "https://help.productfruits.com/en/article/javascript-api-checklists"
language: "en"
last_updated: "2025-02-17T08:34:35.147Z"
---

# Checklists API

## Description

This JS API provides you access to checklists. Access methods on this object:

> `productFruits.api.checklists`

## Methods

> `markItemAsDone``(internalId,` `expand``)`

Marks an item by its `internalId` as completed. The `internalId` parameter has to be set in the Product Fruits administration. If you set `expand` to true, it will open the popup with checklist items

* * *

> `injectToElement``(checklistId, element, options =` `{ checkEligibility: boolean }``)`

If the Display Mode is set to Embedded, call this method to inject the checklist into your element. You must pass a JS HTML element, not a CSS selector.

The last parameter is optional. You can pass options. Currently, we support the `checkEligibility` parameter which does segmentation evaluation and the checklist will be injected only if the segmentation of the checklist matches.

* * *

> `isChecklistEligible``(checklistId)`

This method returns a Promise. It checks if the checklist rules/assigned segment matches. The return values are `eligible` or `not_eligible`. In the case the checklist is already disposed, you will get `disposed`.

The result is cached for a short time.

* * *

> `getChecklists()`

Returns an array of active checklists and their states. Object properties are `id`, `name`, `items`, `state`. Possible states are `not_touched` (the checklist is waiting for the first interaction from the user), `finished` and `in_progress`. 

It also returns an array of checklist items and their states. You will get `id` (a PF-generated ID), `internalId` (for API-driven items), `title` (object with titles, language codes as keys), `state` properties. Possible states are `done`, `open` (for ordered checklists, the item which is currently unlocked), `tbd` (locked items in ordered checklists, non-completed items in unordered checklists).

**Please note**, that if the checklist is finished and dismissed (closed) by the user, it won't be returned from this API. There is currently no way to get a list of completed/dismissed checklists via JS API.

* * *

#### **Account-specific API methods**  
 

> `*resetForCurrentUser(checklistId)*`

This method provides the ability to reset a checklist for the current user.

This API method can be turned on for your account upon request. It is **not active by default**. Please let us know if you'd like us to activate it for your account!

Note: this method is not compatible with group checklists.

**Parameters:**

-   `checklistId` (required): Specifies the checklist to reset.  
     

* * *

> `listen(event, callback)`

Listens to an event that occurs on tours. See the next section to get event names.

## Events

> `item-launched`

> **Argument** `id`, `internalId`

Fired when the user launches the item.

> `item-completed`

> **Argument** `id`, `internalId`

Fired when the user completes the item.

> `dismissed`
> 
> **Argument** `**id**`**,** `**reason**`

Fired when the checklist is dismissed. The `reason` argument can be one of `not-completed` or `completed`.
