Shopee SDK API Reference - v1.11.0
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    config: ShopeeConfig

    Methods

    • Add items to a shop category

      Use this call to add items list to certain shop_category

      Parameters

      • params: AddItemListParams

        Parameters for adding items

        Parameters for adding items to a shop category

        • item_list: number[]

          List of item IDs to add. Max 100 items per request

        • shop_category_id: number

          ShopCategory's unique identifier

      Returns Promise<AddItemListResponse>

      A promise that resolves to the add item list response containing:

      • shop_category_id: The shop category ID
      • current_count: Count of items after addition
      • invalid_item_id_list: List of invalid item IDs with error details

      When the API request fails or returns an error:

      • error_param: Total item number exceeds limit (5000)
      • error_param: Automatic & shopee category cannot add items
      • error_service: Shop category id is not found
      const result = await sdk.shopCategory.addItemList({
      shop_category_id: 12345,
      item_list: [100001, 100002, 100003]
      });
      console.log('Items in category:', result.response.current_count);
    • Add a new shop category

      Use this call to add a new shop collection

      Parameters

      • params: AddShopCategoryParams

        Parameters for adding a shop category

        Parameters for adding a new shop category

        • name: string

          ShopCategory's name

        • Optionalsort_weight?: number

          ShopCategory's sort weight. Max: 2147483546

      Returns Promise<AddShopCategoryResponse>

      A promise that resolves to the add shop category response containing:

      • shop_category_id: The newly created shop category ID

      When the API request fails or returns an error:

      • error_param: ShopCategory name is duplicated or exceeds 40 characters
      • error_param: Sort_weight should be between [0, 2147483546]
      • error_param: Maximum number of categories (1500) reached
      const result = await sdk.shopCategory.addShopCategory({
      name: 'Summer Collection',
      sort_weight: 10
      });
      console.log('Category ID:', result.response.shop_category_id);
    • Delete items from a shop category

      Use this api to delete items from shop category

      Parameters

      • params: DeleteItemListParams

        Parameters for deleting items

        Parameters for deleting items from a shop category

        • item_list: number[]

          List of item IDs to delete. Max 100 items per request

        • shop_category_id: number

          ShopCategory's unique identifier

      Returns Promise<DeleteItemListResponse>

      A promise that resolves to the delete item list response containing:

      • shop_category_id: The shop category ID
      • current_count: Count of items after deletion
      • invalid_item_id_list: List of invalid item IDs with error details

      When the API request fails or returns an error:

      • error_param: Automatic & shopee category cannot delete items
      • error_param: At most 100 items can be deleted per operation
      • error_service: Shop category id is not found
      const result = await sdk.shopCategory.deleteItemList({
      shop_category_id: 12345,
      item_list: [100001, 100002]
      });
      console.log('Remaining items:', result.response.current_count);
    • Delete an existing shop category

      Use this call to delete an existing shop collection

      Parameters

      • params: DeleteShopCategoryParams

        Parameters for deleting a shop category

        Parameters for deleting a shop category

        • shop_category_id: number

          ShopCategory's unique identifier

      Returns Promise<DeleteShopCategoryResponse>

      A promise that resolves to the delete shop category response containing:

      • shop_category_id: The deleted shop category ID
      • msg: Result message

      When the API request fails or returns an error:

      • error_param: Automatic & shopee category cannot be deleted
      • error_service: Shop category id is not found
      const result = await sdk.shopCategory.deleteShopCategory({
      shop_category_id: 12345
      });
      console.log('Deleted category:', result.response.shop_category_id);
    • Get items in a shop category

      Use this call to get items list of certain shop_category

      Parameters

      • params: GetShopCategoryItemListParams

        Parameters for getting items

        Parameters for getting items in a shop category

        • [key: string]: string | number | boolean | undefined
        • Optionalpage_no?: number

          Page number. Default: 0. page_size*page_no should be [0, 2147483446]

        • Optionalpage_size?: number

          Results per page. Default: 1000. Range: [0, 1000]

        • shop_category_id: number

          ShopCategory's unique identifier

      Returns Promise<GetShopCategoryItemListResponse>

      A promise that resolves to the get item list response containing:

      • item_list: List of item IDs
      • total_count: Total number of items in this category
      • more: Whether there are more pages

      When the API request fails or returns an error:

      • error_service: Shop category id is not found
      • error_param: Page number should be [1, 2147483446/page_size]
      const result = await sdk.shopCategory.getItemList({
      shop_category_id: 12345,
      page_size: 100,
      page_no: 1
      });
      console.log('Items:', result.response.item_list);
      console.log('Has more:', result.response.more);
    • Get list of shop categories

      Use this call to get list of shop categories

      Parameters

      • params: GetShopCategoryListParams

        Parameters for getting shop category list

        Parameters for getting shop category list

        • [key: string]: string | number | boolean | undefined
        • page_no: number

          Specifies the starting entry of data to return. Range: [1, 2147483647]

        • page_size: number

          Specifies the total returned data per entry. Range: [1, 100]

      Returns Promise<GetShopCategoryListResponse>

      A promise that resolves to the shop category list response containing:

      • shop_categorys: List of shop categories with id, status, name, and sort_weight
      • total_count: Total number of shop categories
      • more: Whether there are more pages

      When the API request fails or returns an error:

      • error_param: Invalid parameters
      • error_auth: Invalid access_token or partner_id
      const categories = await sdk.shopCategory.getShopCategoryList({
      page_size: 100,
      page_no: 1
      });
      console.log('Total categories:', categories.response.total_count);
    • Update an existing shop category

      Use this call to update an existing collection

      Parameters

      • params: UpdateShopCategoryParams

        Parameters for updating a shop category

        Parameters for updating a shop category

        • Optionalname?: string

          ShopCategory's name

        • shop_category_id: number

          ShopCategory's unique identifier

        • Optionalsort_weight?: number

          ShopCategory's sort weight

        • Optionalstatus?: string

          ShopCategory's status. Applicable values: NORMAL, INACTIVE, DELETED

      Returns Promise<UpdateShopCategoryResponse>

      A promise that resolves to the update shop category response containing:

      • shop_category_id: The updated shop category ID
      • name: Updated name
      • sort_weight: Updated sort weight
      • status: Updated status

      When the API request fails or returns an error:

      • error_param: ShopCategory name is duplicated
      • error_param: Shopee category cannot edit name and sort_weight
      • error_service: Shop category id is not found
      const result = await sdk.shopCategory.updateShopCategory({
      shop_category_id: 12345,
      name: 'Winter Collection',
      status: 'NORMAL'
      });