Deleted Items Keep Showing Up in my APP

Hi Guys, anyone encountered the problem when you deleted an item from the Square Dashboard, but as you fetch the CatalogAPI, all the historic items came up, even those I deleted years ago. I tried using different filter to get rid of those old items it still didn’t work. Code below didn’t work also… Cheers

const catalogItems = await apiClient.fetchAllPages(
‘/catalog/list’,
‘objects’,
{
types: ‘ITEM’,
include_deleted_objects: false

      }
    );

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Search for Items and Objects
Catalog API
Retrieve Catalog Objects

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

these documentations did not help unfortunately

The Catalog API is designed to retain deleted objects for auditing purposes. When you delete an object, it remains in the catalog but is marked as deleted. The “include_deleted_objects” parameter in the SearchCatalogObjects endpoint is used to include or exclude these deleted objects in the response.

In your case, you have set “include_deleted_objects” to false, which should exclude deleted objects from the response. However, if you’re still seeing deleted objects, it might be due to the use of the ‘/catalog/list’ endpoint.

Instead, try using the ‘SearchCatalogObjects’ endpoint with “include_deleted_objects” set to false. This should return only active objects and exclude any that have been deleted.

This answer was reviewed by @Bryan-Square.