Developers

Webhook API

Version 1

Data Genie sends every new or changed product record to an endpoint you run. Each request carries one record: one product in one country. Upsert it into your database on product_id and country, and your copy stays current.

How delivery works

  • When your feed starts, we send every record you've signed up for (the backfill). After that we send a record again whenever something about it changes: price, sale price, stock, images, sizes or description.
  • Each request is a JSON POST with one event and one record. A product sold in three countries is three records, each with its own price and currency.
  • Records are identified by product_id together with country. product_id is stable: the same product keeps the same id in every country and over time.

Set up

  • In your dashboard, open Webhook and add an https URL that accepts POST requests. It must be reachable from the internet.
  • Copy your signing secret (it starts with whsec_) and keep it on your server. Use it to check every request, as shown below.
  • Press Send test event. We send one real sample record, signed like live deliveries and marked "test": true, and show you what your endpoint answered. Test events don't use credits.
  • If your secret leaks, press Rotate secret. Requests are signed with the new secret straight away.

Events

TypeWhen
record.createdThe first time we send you this product in this country.
record.updatedAnything about a record you already have has changed. The record is always sent in full, not as a diff.

Treat both the same way: upsert. If you missed a record.created, the next record.updated still gives you the whole record.

Request body

{
  "id": "evt_8f2c41d6a0b94e1c9f3e7a2b5c6d8e01",
  "type": "record.updated",
  "created_at": "2026-10-17T09:41:07Z",
  "test": false,
  "data": {
    "product_id": "dg_fb2bcff0e7",
    "country": "GB",
    "brand": "Example Brand",
    "product_name": "Merino crew-neck jumper",
    "style_code": "1352161007",
    "category": "Women / Knitwear",
    "colour": "Dark brown",
    "description": "Fine-knit jumper in soft merino wool.",
    "sizes": ["XS", "S", "M", "L", "XL"],
    "primary_image_url": "https://images.example.com/p/1352161007-1.jpg",
    "image_urls": ["https://images.example.com/p/1352161007-1.jpg", "https://images.example.com/p/1352161007-2.jpg"],
    "currency": "GBP",
    "price": 34.99,
    "full_price": 49.99,
    "on_sale": true,
    "in_stock": true,
    "product_url": "https://www.example.com/en_gb/productpage.1352161007.html",
    "price_updated_at": "2026-10-17T09:40:52Z",
    "product_updated_at": "2026-10-12T06:15:03Z"
  }
}

Record fields

Any field we don't have for a record is null (or an empty list). New fields may be added; ignore ones you don't use.

FieldTypeMeaning
product_idstringOur stable id for the product. Part of the key.
countrystringTwo-letter market code (ISO 3166-1), for example US, GB, DE. Part of the key.
brandstringThe label that makes the product.
product_namestringThe product's name as sold in that market.
style_codestringThe brand's own style or article code.
categorystringThe seller's category for the product.
colourstringColour name as listed.
descriptionstringProduct description, plain text.
sizesarray of stringsSizes listed for the product.
primary_image_urlstringThe main product image.
image_urlsarray of stringsAll product images, main image first.
currencystringISO 4217 code of price and full_price, for example USD, EUR.
pricenumberThe price a buyer pays now, in currency, as shown in that market.
full_pricenumberThe price before any reduction. Equal to price when nothing is reduced.
on_salebooleantrue when price is below full_price.
in_stockbooleanWhether the product can be bought in that market.
product_urlstringThe product page in that market.
price_updated_atstringWhen we last saw the price change (UTC, ISO 8601).
product_updated_atstringWhen any other detail last changed (UTC, ISO 8601).

Storing records

Insert the record if it's new; otherwise replace your copy. Events can arrive out of order, so keep the newer one: compare price_updated_at and product_updated_at before overwriting.

PostgreSQL

CREATE TABLE products (
  product_id          text NOT NULL,
  country             char(2) NOT NULL,
  data                jsonb NOT NULL,
  price               numeric,
  currency            text,
  price_updated_at    timestamptz,
  product_updated_at  timestamptz,
  PRIMARY KEY (product_id, country)
);

INSERT INTO products (product_id, country, data, price, currency, price_updated_at, product_updated_at)
VALUES ($1, $2, $3, $4, $5, $6, $7)
ON CONFLICT (product_id, country) DO UPDATE SET
  data = EXCLUDED.data, price = EXCLUDED.price, currency = EXCLUDED.currency,
  price_updated_at = EXCLUDED.price_updated_at, product_updated_at = EXCLUDED.product_updated_at
WHERE GREATEST(products.price_updated_at, products.product_updated_at)
   <= GREATEST(EXCLUDED.price_updated_at, EXCLUDED.product_updated_at);

Verify signatures

Every request is signed with your secret, following the Standard Webhooks scheme, so you can also use one of its libraries. Each request has three headers:

HeaderValue
webhook-idThe event id (evt_…). Same value as id in the body; use it to drop duplicates.
webhook-timestampUnix time in seconds when we sent it. Reject requests more than 5 minutes old.
webhook-signaturev1, followed by a base64 HMAC-SHA256 signature. May hold several, separated by spaces; accept the request if any one matches.

To check it: take your secret without the whsec_ prefix and base64-decode it. Compute HMAC-SHA256 with that key over {webhook-id}.{webhook-timestamp}.{raw body}, base64-encode the result, and compare it with the signature in constant time. Use the raw request body exactly as received, before any JSON parsing.

Python

import base64, hashlib, hmac, time

def verify(secret: str, headers, body: bytes, tolerance: int = 300) -> bool:
    msg_id = headers["webhook-id"]
    ts = headers["webhook-timestamp"]
    if abs(time.time() - int(ts)) > tolerance:
        return False
    key = base64.b64decode(secret.removeprefix("whsec_"))
    expected = base64.b64encode(
        hmac.new(key, f"{msg_id}.{ts}.".encode() + body, hashlib.sha256).digest()
    ).decode()
    return any(
        hmac.compare_digest(expected, part.split(",", 1)[1])
        for part in headers["webhook-signature"].split()
        if part.startswith("v1,")
    )

Node.js

const crypto = require("crypto");

function verify(secret, headers, rawBody, tolerance = 300) {
  const id = headers["webhook-id"], ts = headers["webhook-timestamp"];
  if (Math.abs(Date.now() / 1000 - Number(ts)) > tolerance) return false;
  const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
  const expected = crypto.createHmac("sha256", key)
    .update(`${id}.${ts}.`).update(rawBody).digest("base64");
  return headers["webhook-signature"].split(" ").some((part) => {
    const [version, sig] = part.split(",");
    return version === "v1" && sig.length === expected.length &&
      crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
  });
}

Responding and retries

  • Answer with any 2xx status within 10 seconds. Store the record or put it on a queue, then reply; do slow work afterwards.
  • Anything else (a 4xx or 5xx, a timeout, or a connection error) counts as failed and we try again later, waiting longer between attempts.
  • A record can arrive more than once, for example when your reply was lost. Drop repeats by webhook-id, or simply upsert, which is safe to repeat.
  • We don't follow redirects. Give us the final URL.
  • Test events have "test": true. Treat them like any other event, or ignore them.

Credits

  • Each record delivered is paid from your balance: the first delivery of a product in a country, and every later update to it. Test events are free.
  • Add funds in your dashboard under Credits, any amount from $250. Each record is charged at the rate for your volume so far that month, so the rate drops as your monthly volume grows; the count starts again on the 1st.
  • If your balance runs out, deliveries pause and are held for 14 days, so adding funds in that time loses nothing.
Questions about the data or a delivery? Message us from your dashboard, or write to support@datagenie.space.