Skip to content
PriceBell
Documentation

SDKs

Call the PriceBell API from your language with typed methods, your key read from the environment and retries handled. Open source, under the MIT license.

Install

Quick start

Create an API key in your dashboard and set it as PRICEBELL_API_KEY: every client reads it from there and sends it as a Bearer token. This script tracks a product, then reads its price history.

Node.js
import { PriceBellClient } from "@pricebell/sdk";

// Reads your API key from PRICEBELL_API_KEY.
const client = new PriceBellClient();

// Track a product and get its first price.
const { data: product } = await client.trackProduct({
  product: "https://www.google.com/search?ibp=oshop&q=airpods+pro+2&prds=catalogid:6883422599141817139&gl=us&udm=28",
  wait: true,
});
console.log(product.title, product.price, product.currency);

// Its price history, oldest first.
const { data: tracked } = await client.getProduct({ id: product.product_id, days: 90 });
for (const point of tracked.history) console.log(point.checked_at, point.price);

// Any product ID's history, tracked or not, without using credits.
const { data: history } = await client.getGoogleProductHistory({ google_product_id: "6883422599141817139" });
console.log(history.lowest_price, history.highest_price);
Python
from pricebell import PriceBellClient

# Reads your API key from PRICEBELL_API_KEY.
with PriceBellClient() as client:
    # Track a product and get its first price.
    product = client.track_product(product="https://www.google.com/search?ibp=oshop&q=airpods+pro+2&prds=catalogid:6883422599141817139&gl=us&udm=28", wait=True).data
    print(product["title"], product["price"], product["currency"])

    # Its price history, oldest first.
    tracked = client.get_product(id=product["product_id"], days=90).data
    for point in tracked["history"]:
        print(point["checked_at"], point["price"])

    # Any product ID's history, tracked or not, without using credits.
    history = client.get_google_product_history(google_product_id="6883422599141817139").data
    print(history["lowest_price"], history["highest_price"])

Methods

One method per endpoint, named after its operation in the API reference, with the same parameter names. Java and PHP use the Node.js names, Go the same in PascalCase (TrackProduct), .NET with Async (TrackProductAsync), and Ruby the Python names.

Client methods
Node.jsPythonEndpointDoes
getAccountget_accountGET /accountPlan and remaining credits
searchGoogleShoppingsearch_google_shoppingGET /searchSearch Google Shopping
getGoogleProductHistoryget_google_product_historyGET /historyPrice history of any product ID
listProductslist_productsGET /productsList tracked products
trackProducttrack_productPOST /productsTrack a product
getProductget_productGET /products/{id}Get a product and its price history
updateProductupdate_productPATCH /products/{id}Change alerts and checks
checkProductcheck_productPOST /products/{id}/checkCheck the price now
deleteProductdelete_productDELETE /products/{id}Stop tracking a product
getSellersget_sellersGET /products/{id}/sellersGet a product's sellers
compareRegionscompare_regionsGET /products/{id}/compareCompare a product across countries
trackInRegionstrack_in_regionsPOST /products/{id}/compareAlso track a product in other countries
updateComparisonupdate_comparisonPATCH /products/{id}/compareSet the comparison's currency and alert
leaveComparisonleave_comparisonDELETE /products/{id}/compareTake a product out of its comparison
clearTargetPriceclear_target_pricePATCH /products/{id}Remove a product's target price

Errors and retries

A failed request throws an error with the HTTP status and the API's error code, such as api_limit or product_limit: PriceBellApiError (status, errorCode) in Node.js, PriceBellAPIError (status, error_code) in Python. Network errors and 408, 500, 502, 503 and 504 answers are retried up to 3 times; 429 and other errors aren't, since rate limits last until the hour is over.

Start tracking

Create an account, confirm your email and get 50 free credits to try the API.