Skip to content

Requisition List Functions

The Requisition List drop-in provides 17 API functions for managing requisition lists and their items, including creating lists, adding/removing products, managing list metadata, and sharing lists with company colleagues.

Version: 1.4.0
FunctionDescription
addProductsToRequisitionListAdds products to a requisition list.
addRequisitionListItemsToCartAdds the chosen items from a requisition list to the logged-in user’s cart.
copyItemsBetweenRequisitionListsCopies items from one requisition list to another for a logged-in user.
createRequisitionListCreates a new requisition list with the name and description provided for the logged-in user.
deleteRequisitionListDeletes a requisition list identified by UID.
deleteRequisitionListItemsDeletes items from a requisition list.
getRequisitionListReturns information about the requested requisition list for the logged-in user.
getRequisitionListsReturns the requisition lists for the logged-in user.
getStoreConfigReturns details about the store configuration.
moveItemsBetweenRequisitionListsMoves items from one requisition list to another for a logged-in user.
updateRequisitionListUpdates an existing requisition list with the name and description provided for the logged-in user.
updateRequisitionListItemsUpdates the items of an existing requisition list with the quantity and options provided for the logged-in user.
getCompanyUsersReturns a list of active company users for the current company.
getSharedRequisitionListRetrieves a shared requisition list by its share token.
importSharedRequisitionListImports a shared requisition list into the current customer’s account using a share token.
shareRequisitionListByEmailShares a requisition list with one or more company users by email.
shareRequisitionListByTokenGenerates a shareable token for a requisition list.

Adds products to a requisition list.

const addProductsToRequisitionList = async (
requisitionListUid: string,
requisitionListItems: Array<RequisitionListItemsInput>
): Promise<RequisitionList | null>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier for the requisition list to which products will be added.
requisitionListItemsArray<RequisitionListItemsInput>YesAn array of product objects to add to the requisition list. Each object includes the product SKU, quantity, and optional configuration like parent SKU for configurable products, selected options (color, size), and entered options (custom text fields).

Emits the requisitionList/data event.

Returns RequisitionList or null.

Adds the chosen items from a requisition list to the logged-in user’s cart.

const addRequisitionListItemsToCart = async (
requisitionListUid: string,
requisitionListItemUids: Array<string>
): Promise<Array<AddToCartError> | null>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier for the requisition list containing the items to add to the cart.
requisitionListItemUidsArray<string>YesAn array of requisition list item UIDs to add to the cart. These are the unique identifiers for specific items within the list, not product SKUs.

Does not emit any drop-in events.

Returns Array<AddToCartError> | null.

Creates a new requisition list with the name and description provided for the logged-in user.

const createRequisitionList = async (
name: string,
description?: string
): Promise<RequisitionList | null>
ParameterTypeReq?Description
namestringYesThe display name for the new requisition list. This helps users identify and organize their lists (for example, Office Supplies Q1, Weekly Inventory Restock).
descriptionstringNoAn optional text description providing additional context about the requisition list’s purpose or contents (for example, Monthly recurring orders for maintenance supplies).

Emits the requisitionList/data event.

Returns RequisitionList or null.

Deletes a requisition list identified by uid.

const deleteRequisitionList = async (
requisitionListUid: string
): Promise<{
items: RequisitionList[];
page_info: any;
status: any;
} | null>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier for the requisition list to delete. This operation is permanent and removes the list and all its items.

Emits the requisitionLists/data event.

Promise<{
items: RequisitionList[];
page_info: any;
status: any;
} | null>

See RequisitionList.

Deletes items from a requisition list.

const deleteRequisitionListItems = async (
requisitionListUid: string,
items: Array<string>,
pageSize: number,
currentPage: number,
enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>
): Promise<RequisitionList | null>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier for the requisition list from which items will be removed.
itemsArray<string>YesAn array of requisition list item UIDs to remove. These are the unique identifiers returned in the list’s items array, not product SKUs.
pageSizenumberYesThe number of items to return per page in the updated requisition list response.
currentPagenumberYesThe page number for pagination (1-indexed). Used to retrieve a specific page of items after deletion.
enrichConfigurableProductsitems: Item[]NoSee function signature above

Emits the requisitionList/data event.

Returns RequisitionList or null.

Returns information about the requested requisition list for the logged-in user.

const getRequisitionList = async (
requisitionListID: string,
currentPage?: number,
pageSize?: number,
enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>
): Promise<RequisitionList | null>
ParameterTypeReq?Description
requisitionListIDstringYesThe unique identifier for the requisition list to retrieve. Returns the list metadata and all items.
currentPagenumberNoThe page number for pagination (1-indexed). Defaults to page 1 if not specified.
pageSizenumberNoThe number of items to return per page. Controls pagination of the requisition list items.
enrichConfigurableProductsitems: Item[]NoSee function signature above

Emits the requisitionList/data event.

Returns RequisitionList or null.

Returns the requisition lists for the logged-in user.

const getRequisitionLists = async (
currentPage?: number,
pageSize?: number,
listItemsPageSize?: number
): Promise<RequisitionList[] | null>
ParameterTypeReq?Description
currentPagenumberNoThe page number for pagination (1-indexed). Used to navigate through multiple pages of requisition lists.
pageSizenumberNoThe number of requisition lists to return per page. Controls how many lists appear on each page.
listItemsPageSizenumberNoSets how many items are loaded per list in each GraphQL request. The default is 100. If a list has more than 100 items, additional requests are automatically made so users (like on a PDP “already on list” view) can see all items.

Emits the requisitionLists/data event.

Returns an array of RequisitionList objects or null.

Returns details about the store configuration.

const getStoreConfig = async (): Promise<any>

Does not emit any drop-in events.

Returns void.

Updates an existing requisition list with the name and description provided for the logged-in user.

const updateRequisitionList = async (
requisitionListUid: string,
name: string,
description?: string,
pageSize?: number,
currentPage?: number,
enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>
): Promise<RequisitionList | null>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier for the requisition list to update.
namestringYesThe new display name for the requisition list. Updates the list’s title.
descriptionstringNoThe new text description for the requisition list. Updates the list’s purpose or context information.
pageSizenumberNoThe number of items to return per page in the updated requisition list response.
currentPagenumberNoThe page number for pagination (1-indexed) in the updated requisition list response.
enrichConfigurableProductsitems: Item[]NoSee function signature above

Emits the requisitionList/data event.

Returns RequisitionList or null.

Updates the items of an existing requisition list with the quantity and options provided for the logged-in user.

const updateRequisitionListItems = async (
requisitionListUid: string,
requisitionListItems: Array<UpdateRequisitionListItemsInput>,
pageSize: number,
currentPage: number,
enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>
): Promise<RequisitionList | null>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier for the requisition list containing the items to update.
requisitionListItemsArray<UpdateRequisitionListItemsInput>YesAn array of requisition list items to update. Each object includes the item UID and the fields to modify (such as quantity, selected options, or entered options).
pageSizenumberYesThe number of items to return per page in the updated requisition list response.
currentPagenumberYesThe page number for pagination (1-indexed) in the updated requisition list response.
enrichConfigurableProductsitems: Item[]NoSee function signature above

Emits the requisitionList/data event.

Returns RequisitionList or null.

Moves items from one requisition list to another for a logged-in user.

const moveItemsBetweenRequisitionLists = async (
sourceRequisitionListUid: string,
destinationRequisitionListUid: string,
requisitionListItemUids: string[],
pageSize: number,
currentPage: number
): Promise<MoveItemsResult | null>
ParameterTypeReq?Description
sourceRequisitionListUidstringYesThe unique identifier for the requisition list from which items will be moved.
destinationRequisitionListUidstringYesThe unique identifier for the requisition list to which items will be moved.
requisitionListItemUidsstring[]YesAn array of requisition list item UIDs to move. These are the unique identifiers for specific items within the source list.
pageSizenumberYesThe number of items to return per page in the updated requisition list responses.
currentPagenumberYesThe page number for pagination (1-indexed) in the updated requisition list responses.

Emits the requisitionList/data event for the source list after items are moved.

Returns an object with the following structure, or null if the operation fails:

interface MoveItemsResult {
sourceList: RequisitionList | null;
destinationList: RequisitionList | null;
}
  • sourceList: The updated source requisition list after items have been moved, or null if not available.
  • destinationList: The updated destination requisition list after items have been added, or null if not available.

Copies items from one requisition list to another for a logged-in user.

const copyItemsBetweenRequisitionLists = async (
sourceRequisitionListUid: string,
destinationRequisitionListUid: string,
requisitionListItemUids: string[]
): Promise<CopyItemsResult | null>
ParameterTypeReq?Description
sourceRequisitionListUidstringYesThe unique identifier for the requisition list from which items will be copied.
destinationRequisitionListUidstringYesThe unique identifier for the requisition list to which items will be copied.
requisitionListItemUidsstring[]YesAn array of requisition list item UIDs to copy. These are the unique identifiers for specific items within the source list.

Does not emit any drop-in events.

Returns an object with the following structure, or null if the operation fails:

interface CopyItemsResult {
destinationList: RequisitionList | null;
}
  • destinationList: The updated destination requisition list after items have been copied, or null if not available.

Returns a list of active company users for the current company. Used to populate the recipient picker in the share-by-email flow.

const getCompanyUsers = async (): Promise<CompanyUser[]>

Does not emit any drop-in events.

Returns an array of CompanyUser objects.

interface CompanyUser {
id: string;
firstname: string;
lastname: string;
email: string;
}

Retrieves a shared requisition list by its share token. The caller must be authenticated and belong to the same company as the sender. Returns the sender’s display name alongside the read-only requisition list data.

const getSharedRequisitionList = async (
token: string,
currentPage?: number,
pageSize?: number,
enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>
): Promise<SharedRequisitionListResult | null>
ParameterTypeReq?Description
tokenstringYesThe share token from the URL (e.g. from ?requisition_id=<token>).
currentPagenumberNoThe page number for pagination (1-indexed). Defaults to page 1 if not specified.
pageSizenumberNoThe number of items to return per page.
enrichConfigurableProducts(items: Item[]) => Promise<Item[]>NoOptional function to enrich configurable product items with variant data before returning.

Does not emit any drop-in events.

Returns SharedRequisitionListResult | null. Returns null if the token is valid but the requisition list cannot be resolved.

interface SharedRequisitionListResult {
senderName: string;
requisitionList: RequisitionList;
}

Imports a shared requisition list into the current customer’s account using a share token. After a successful import, the recipient has full edit rights on the list.

const importSharedRequisitionList = async (
token: string
): Promise<ImportSharedRequisitionListResult>
ParameterTypeReq?Description
tokenstringYesThe share token extracted from the URL (e.g. from ?requisition_id=<token>).

Does not emit any drop-in events.

Returns ImportSharedRequisitionListResult.

interface ImportSharedRequisitionListResult {
requisitionList: RequisitionList | null;
userErrors: ImportSharedRequisitionListUserError[];
}
interface ImportSharedRequisitionListUserError {
message: string;
code: string;
}

Shares a requisition list with one or more company users by email. An email notification is sent to each recipient with a link to import the list.

const shareRequisitionListByEmail = async (
requisitionListUid: string,
customerUids: string[]
): Promise<Array<ShareRequisitionListByEmailError> | null>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier of the requisition list to share.
customerUidsstring[]YesAn array of company user IDs to share the list with. Obtain these from getCompanyUsers.

Does not emit any drop-in events.

Returns null on success, or an array of error objects if the share failed.

interface ShareRequisitionListByEmailError {
message: string;
code: string;
}

Generates a shareable token for a requisition list. The token is used to build a share URL that recipients can open to import the list into their own account.

const shareRequisitionListByToken = async (
requisitionListUid: string
): Promise<ShareRequisitionListByTokenResult>
ParameterTypeReq?Description
requisitionListUidstringYesThe unique identifier of the requisition list to generate a share token for.

Does not emit any drop-in events.

Returns ShareRequisitionListByTokenResult.

interface ShareRequisitionListByTokenResult {
token: string | null;
errorMessage: string | null;
}

The following data models are used by functions in this drop-in.

The RequisitionList object is returned by the following functions: addProductsToRequisitionList, createRequisitionList, deleteRequisitionList, deleteRequisitionListItems, getRequisitionList, getRequisitionLists, updateRequisitionList, updateRequisitionListItems, moveItemsBetweenRequisitionLists, copyItemsBetweenRequisitionLists.

interface RequisitionList {
uid: string;
name: string;
description: string;
updated_at: string;
items_count: number;
items: Item[];
page_info?: PageInfo;
}