Applies to: Catalog API
Learn how to archive, unarchive, and manage catalog items.
You can archive a catalog item when you don't want the item to show up in search results. This removes clutter from search requests.
Unlike deleted items, archived items remain fully or mostly operational. The Square API has full support and all CRUD operations are allowed as with any active catalog items. In the Square Dashboard or on Square POS devices, operational support is somewhat restricted:
- An item can be archived and unarchived in the Square Dashboard. It can be unarchived on Retail POS devices.
- Archived items can be viewed in the Square Dashboard using the
Archivedfilter in the Items library. - Archived items can be scanned on Square POS devices.
- Editable attributes of an archived item cannot be updated in the Square Dashboard or on POS devices.
- Archived items aren't displayed on Square POS devices, except in the following cases:
- Transaction refunds on Retail POS
- Pending purchase orders on Retail POS
- Stock counts on Retail POS
- Receive stock on Retail POS
- Existing invoices
- Sales reports
- Saved shopping carts
Programmatically speaking, an archived item has the is_archived field set to true on the CatalogItem instances. It becomes unarchived when the is_archived field is set to false.
If the item ID is known, the archived catalog item can be retrieved by calling RetrieveCatalogObject or BatchRetrieveCatalogObjects.
If the item ID isn't known, the archived catalog item can be queried by calling SearchCatalogItems with the
archived_state=ARCHIVED_STATE_ARCHIVEDquery expression. Thearchived_statefilter can take other ArchivedState values to support returning non-archived catalog items or both archived and non-archived catalog items.
The SearchCatalogObjects endpoint can also return any archived items along with non-archived ones.
Note
Restaurant sellers cannot use the Square Dashboard to archive items, unarchive items, or retrieve archived items. However, they can do so using the Catalog API. API-initiated archived items aren't visible in the Square Dashboard.
To archive an item using the Catalog API, call the UpsertCatalogObject endpoint to archive an item while setting the is_archived attribute to true.
The following example shows how to archive an item by calling UpsertCatalogObject, while setting the is_archived input parameter to true.
Upsert catalog object
Unlike a deleted object, an archived item remains fully operational using the Catalog API. For example, given the item ID, you can call RetrieveCatalogObject to retrieve an archived item.
The following example shows how to call the RetrieveCatalogObject endpoint to return an archived item that's identified by the specified item ID (7MV6J3MSDAVHHRZJCVU2I63G):
Retrieve catalog object
When archived item IDs aren't known, you can query archived items by calling the SearchCatalogItems endpoint while specifying the archived_state query filter to ARCHIVED_STATE_ARCHIVED.
The following example shows how to call SearchCatalogItems with the archived_state filter to query archived items:
Search catalog items
If you don't explicitly set archived_state, the default value is ARCHIVED_STATE_NOT_ARCHIVED and you get only non-archived items in return.
To receive both the archived and non-archived items, set archived_state to ARCHIVED_STATE_ALL.
An archived item can be unarchived. To do so using the Catalog API, call the UpsertCatalogObject while specifying the archived item ID, setting the is_archived field to false, and keeping other writable properties intact.
The following example request shows how to unarchive an archived item:
Upsert catalog object