Fetch Recently Viewed Products [Beta]

Fetch Products that have been recently viewed by a Shopper


Contact support for using Beta Shopper APIs.


This API retrieves the products that are recently viewed by a shopper. For logged-in shoppers, all recently viewed are retrieved, while for non-logged-in shoppers, all recently viewed actions associated with their session on the device are retrieved. By default, the API returns a maximum of 12 recently viewed products.


Endpointrequest typeAPI Type
https://{{Swym API Endpoint}}/api/v3/shopper/fetch-recently-viewed-productsPOSTshopper

Query Params

pidstring (Encoded)YesUnique identifier for the store available in Swym Admin

Form Data

regidstringYesUnique identifier for the shopper generated by generate-regid
sessionidstringYesSession ID generated with generate-regId endpoint which does not expire without manual intervention

Example Curl

curl --location '{{Swym API Endpoint}}/api/v3/shopper/fetch-recently-viewed-products?pid={{URL Encoded PID}}' \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'regid={{regid}}' \
--data-urlencode 'sessionid={{sessionid}}'


Curl Placeholders

Assuming these values are provided above, the curl command should work correctly. However, if there are any issues with the API endpoint or the data being passed in the request, there could still be errors that need to be resolved before you can test these APIS.

{{Swym API Endpoint}}This needs to be replaced with the actual Swym API endpoint URL.
{{URL Encoded PID}}This needs to be replaced with the actual PID value, URL-encoded.
{{regid}}This needs to be replaced with the actual regid value.
{{sessionid}}This needs to be replaced with the actual session ID value.

Success Response

  "recentlyViewed": [
      // Number of times the product is viewed
      "count": 28,
      // Product ID from the Platform
      "productId": 7096231231686,
      // Timestamp at which the product was viewed last time
      "lastViewedTime": 1709013095458,
      // Varaint ID form the Platform
      "variantId": 41254655393990,
      // Produc URL
      "productURL": "https://demo.swym.it/products/ceramic-oval-basin",
      // Timestamp of the latest order placed with the product after it was viewed
      "lastOrderTimestamp": 1708426159001,
      // ID of the variant that was ordered after the product was viewed
      "lastOrderedVariantId": 41254655393990,
      // ID of the latest order placed with the product after it was viewed
      "lastOrderId": 2849832

Error Response:

If the request is unsuccessful, the API will return a JSON response with an error message and an HTTP status code indicating the type of error that occurred.

Status CodeTypeDescription
400Bad RequestYour request is invalid, change your request params and query and try again.
401UnauthorisedYou are performing an action on a resource that is not granted to the current logged-in user. Additionally, for REST APIs, this could mean your API key is wrong.
403ForbiddenYou are not allowed to request this data.
404Not FoundThe specified requested data could not be found.
429Too Many RequestsYou're raising too many requests! Slow down!
500Internal Server Error --We had a problem with our server. Try again later.
503Service UnavailableWe're temporarily offline for maintenance. Please try again later.