novinzodevelopers
RPCReferenceVariant insights

GetVariantInsights

POST/rpc#GetVariantInsights

How each of a product's variants sells, brings buyers back and what those buyers spend, for sellers and plugins with its analytics:read grant. A store API key can call it, a read-only one included. Plugins can call this RPC with the invocation token after the store grants analytics:read.

Authorization

__Host-sh*<token>

Dashboard session cookie (name prefix __Host-sh), set by sign in and managed by the browser.

In: cookie

x-store-id<token>

The store the seller acts on.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

_tag*"Request"

Value in

  • "Request"
id*string

Correlates the response line with this request.

tag*"GetVariantInsights"

Value in

  • "GetVariantInsights"
payload*
headers*array<any>

Leave empty; the server prepends the HTTP request headers.

Itemsitems <= 0

Response Body

application/json

printf '%s\n' '{"_tag":"Request","id":"0","tag":"GetVariantInsights","payload":{"productId":"<uuid>","period":{"from":"string","to":"string"},"returnWindowDays":7},"headers":[]}' |  curl -X POST "$NOVINZO_API/rpc" \  -H "Content-Type: application/ndjson" \  -H "Authorization: Bearer $NOVINZO_API_KEY" \  --data-binary @-
{  "_tag": "Exit",  "requestId": "string",  "exit": {    "_tag": "Success",    "value": {      "currency": "AED",      "variants": [        {          "variantId": "string",          "name": "string",          "removed": true,          "currentPrice": {            "amountMinorUnits": "string",            "currency": "AED"          },          "priceVsCheapest": 0,          "units": -9007199254740991,          "revenue": {            "amountMinorUnits": "string",            "currency": "AED"          },          "revenueShare": 0,          "returnRate": {            "_tag": "Rate",            "returned": -9007199254740991,            "eligible": -9007199254740991          },          "returnRateByWindow": [            {              "days": 7,              "rate": {                "_tag": "Rate",                "returned": -9007199254740991,                "eligible": -9007199254740991              }            }          ],          "next": [            {              "variantId": "string",              "count": -9007199254740991            }          ]        }      ],      "firstPurchase": [        {          "variantId": "string",          "newBuyers": -9007199254740991,          "valueAfter": [            {              "days": 30,              "value": {                "_tag": "Average",                "perBuyer": {                  "amountMinorUnits": "string",                  "currency": "AED"                },                "buyers": -9007199254740991              }            }          ]        }      ],      "otherCurrencyOrders": -9007199254740991    }  }}