Toptimize

[Beta] Retrieve objects

⚠️ Beta Access Required

Contact your sales representative to gain access to this endpoint and start using it.

Use the /retrieval endpoint to get recommendations of which products are relevant given a certain context. Context is provided by user information, plus seed products. This can be used to retrieve object to display on a PDP (single seed product) or in a cart (multiple seed products).

In order to provide retrieval, Topsort requires that events are also sent, as a source of information.

post/toptimize/v1/retrieval

Request

  • Base URL: https://api.topsort.com
  • URL: https://api.topsort.com/toptimize/v1/retrieval
  • Auth: HTTP bearer

Request body

slotsinteger required

How many objects to retrieve.

opaqueUserIdstring required

The opaque user ID is an anonymized unique identifier that maps to the original user ID without revealing the original value. This identifier allows Topsort to correlate user activity between auctions and user interactions, independent of the user's logged-in status. For apps or sites where users might interact while logged out, we recommend generating a random identifier (UUIDv7) on the first load, storing it on local storage (cookie, local storage, etc), and letting it live for at least a year. Otherwise, if your users are always logged in for interactions, you may use a hash of your customer ID. Correct purchase attribution requires long-lived opaque user IDs consistent between auction and event requests.

objectType'listings' | 'banners' required

The type of object that needs to be retrieved.

deviceType'desktop' | 'mobile'

The device the user is on.

seedProductIdsstring[] required
mode'all' | 'complement' | 'similar'

Retrieval mode, how to interpret the context to get objects.

Example request

{
  "slots": 5,
  "opaqueUserId": "u_9ske45",
  "seedProductIds": [
    "p_PJbnN",
    "p_ojng4"
  ],
  "mode": "all",
  "objectType": "listings",
  "deviceType": "mobile"
}

Response

The retrieval results. Each retrieved products is accompanied by their relevancy score.

objectType'listings' | 'banners' required

The type of object that was predicted.

Example response

{
  "objectType": "listings",
  "objects": [
    {
      "id": "p_xh90s",
      "score": 0.978
    },
    {
      "id": "p_12lp0",
      "score": 0.953
    },
    {
      "id": "p_ds7ui",
      "score": 0.877
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.