NEURVANCE®Open Cube dashboard ↗

CUBE 1.5.0 / DEVELOPER SETUP

Connect your store.
Understand each visit.

A step-by-step guide to sending Cube your visitors’ data, adding your products, and asking Cube what to show and how likely a visitor is to buy.

Sign in, subscribe, and create your API key after payment is verified.

01 / ACCOUNT & ACCESS

Create your secret websiteID.

Sign in to your Neurvance account, choose a Neurvance plan, and then open the Cube dashboard. Once payment is verified, choose Create API key and copy your secret websiteID. Canceling renewal keeps API access until the paid period ends. If a renewal payment fails, update your payment method in Manage billing to restore access after payment is verified.

  1. Choose Create API key in the dashboard.
  2. Copy the complete key when it appears. It is shown only once.
  3. Save this one secret as SHOP_WEBSITE_ID on your server. It is also your API key.

Your websiteID is your secret API key. These names refer to one credential. It is shown only when created or rotated. Cube keeps its own account identifiers internal; you do not need a separate public ID.

How do I generate a replacement credential?

With an active subscription, choose Rotate API key. Copy the new secret websiteID and update SHOP_WEBSITE_ID on your website server. The old credential immediately stops working. Your saved data and your products stay with your website.

Open Cube dashboard ↗
02 / SERVER CONNECTION

Keep the key on your server.

Visitor’s browserYour website serverCube API

The browser sends its measurements to your own server. Your server adds the secret websiteID and calls Cube over HTTPS. Never put the key in frontend code, browser storage, URLs, or logs. Cube accepts HTTPS only; a plain HTTP request is refused with 400. The calls you can make are /upload, /main and /perbuy, plus the products page.

Server environment
SHOP_API_URL=https://YOUR_CUBE_API_ADDRESS
SHOP_WEBSITE_ID=YOUR_SECRET_WEBSITEID_API_KEY

Use the Cube API address shown in your Cube dashboard. Add these values in your hosting provider’s private environment settings. With Python, install requests and use this helper:

Python server helper
import os
import requests

# Run on YOUR WEBSITE SERVER. Never send this key to a browser.
def cube_request(path, payload):
    response = requests.post(
        os.environ["SHOP_API_URL"].rstrip("/") + path,
        headers={"Authorization": "Bearer " + os.environ["SHOP_WEBSITE_ID"]},
        json=payload,
        timeout=(3, 25),
        allow_redirects=False,
    )
    response.raise_for_status()
    return response.json()

Every request is a JSON object sent with POST and Content-Type: application/json. Send the key in the Authorization: Bearer header. If you cannot set headers, put it in the JSON body as "websiteID" instead. Call this helper from your own protected server routes, check browser request origins, and never accept another visitor’s data as your own.

03 / VISIT DATA

Send six numbers every 10 seconds.

While a visitor is on your website, your server sends POST /upload every ten seconds with what the visitor has done so far. Cube saves it in your website’s history, which is what later predictions are based on.

Upload request JSON
{
  "bought_number": 0,
  "avgSpeed": 120,
  "avgCordinates": [640, 360],
  "productsSeen": 6,
  "productsClciked": 2,
  "clicks": 14
}
Upload from your server
# every 10 seconds, for each visitor on your website
visit = {
    "bought_number": 0,          # products bought in this visit (verified orders only)
    "avgSpeed": 120,             # average mouse speed
    "avgCordinates": [640, 360], # average mouse position [x, y]
    "productsSeen": 6,           # products the visitor has seen
    "productsClciked": 2,        # products the visitor has clicked
    "clicks": 14,                # mouse clicks
}
result = cube_request("/upload", visit)  # {"ok": true}

A saved upload returns {"ok": true}. 403 means your subscription is not active. When your order system has verified a payment, send the visit’s next upload with bought_number set to the number of products bought — product quantity, not money spent. Never trust a browser’s claim that an order was paid.

Field types and validation
  • Send all six fields in every upload. The names are exact, including productsClciked.
  • bought_number, productsSeen, productsClciked and clicks are whole numbers of 0 or more.
  • avgSpeed is a number of 0 or more. Cube stores it rounded to a whole number.
  • avgCordinates is a list [x, y] of two numbers of 0 or more, for example [640, 360].
  • A wrong or missing field returns 400 with a message naming the field, and nothing is saved.
04 / YOUR PRODUCTS

Tell Cube what you sell.

Open the products page at your Cube API address followed by /products. The dashboard shows the full link. Paste your secret websiteID to connect, then add each product with a name, a short bio (its description) and a price. You can delete products there too.

  • Cube reads each bio once, when you add it, and uses it to suggest the best product for a visitor.
  • Only your own products are shown, and only you can delete them.
  • Names are up to 200 characters, bios up to 2,000, and prices are 0 or more.

Add your products before you use /main. The secret websiteID is kept only while the products page is open; it is never saved in the browser.

05 / COMMANDS & BUYING CHANCE

Ask about the current visit.

Send what the visitor is doing right now as currentlyDoing, using the same numbers as the upload: speed is avgSpeed, clicks is clicks, clicked is productsClciked, and productsSeen is productsSeen.

POST /main returns the layout commands for this visitor and, when the product on screen is not the best fit, the product to show instead. Put the bio of the product the visitor is looking at in shown.

Main request JSON
{
  "shown": "Light linen shirt in sand, relaxed fit.",
  "currentlyDoing": {
    "speed": 120,
    "clicks": 14,
    "clicked": 2,
    "productsSeen": 6
  }
}
Example main response
{
  "commands": ["moreProducts()"],
  "spendMore": "moreProducts()",
  "best": "Wool overshirt in navy, regular fit."
}
  • commands is a list of moreProducts() (show more products) and lessProducts() (show fewer). It can be empty.
  • spendMore is moreProducts() when the visitor moves faster than your usual visitors, otherwise empty text.
  • best is the bio of one of your products to feature, or null when the shown product already fits.

POST /perbuy returns the visitor’s chance of buying as one sentence:

Perbuy request JSON
{
  "currentlyDoing": {
    "speed": 120,
    "clicks": 14,
    "clicked": 2,
    "productsSeen": 6
  }
}
Example perbuy response
{
  "result": "The user has a chance of buying 2.0 products"
}

Predictions start when your website has 1,000 saved rows. Until then, and when the subscription is not active, both calls answer with HTTP 200 and a message (for /main) or result (for /perbuy) such as “Not enough data to make a prediction. Please wait until more data is collected.” The dashboard shows how far your website is.

Commands are plain text. Compare them with your own list of actions; never evaluate response strings as code. These calls do not save anything.

06 / DATA CONTROL

Delete your saved data.

In the Cube dashboard, use Delete all Cube data. Enter your current secret websiteID and type DELETE. Cube removes every row it saved for your website. Your products, subscription, account and API key stay. Deleting your Neurvance account also cancels the subscription and removes your Cube data and products.

REFERENCE / ERRORS

Handle errors deliberately.

ResponseWhat to do
400Read the message: a field is missing or has the wrong type, the body is not a JSON object, or the request was sent over plain HTTP instead of HTTPS.
401Check the secret key. It may be expired, revoked, or replaced.
403Check the paid subscription. Open Manage billing to renew or update your payment method.
404The product does not exist or belongs to another website.
500Retry later with backoff. Contact support if it keeps happening.

Errors come back as JSON: {"error": "message"}. Retry only after you have fixed the cause.