apidata.one docs Get a key

Webhooks and notices

When something happens that your site should act on, the API records a notice: a saved search has new matches, a favorite changed, a listing was removed, your account was suspended or reinstated, live data stopped or came back. You get notices in one of two ways, or both:

A notice is thin on purpose: IDs and the kind of change, never listing content. No price, address, remarks, photo or name is ever in a notice. When you act on one, fetch the listing through the API, so what you show or send is current and carries its compliance block. apidata.one never emails your visitors: your site sends its own (alert emails).

Every tier has notices, webhooks and the events list. They are per environment: a test key sees the sandbox's, a live key the live ones. The sandbox changes by itself every 5 minutes, so its saved searches and favorites produce real notices, and a sandbox trigger makes one on demand.

The notice

{
  "id": "evt_3yQ8mT1xKp7Zc2Nf5Rb9Wd",
  "type": "saved_search.matches",
  "createdAt": "2026-11-10T15:00:00.000Z",
  "accountId": "0b9f6c1e-52a7-4c3e-9d41-7a6f0c2b8e15",
  "clientId": "visitor-8841",
  "savedSearchId": "ss_Hq2Lw9Xc4Vb7Nm1Kp6Tz3R",
  "listingKeys": ["300451207716"],
  "changes": [{ "listingKey": "300451207716", "reasons": ["new"] }]
}
Field Meaning
id The notice's ID, evt_…. The same notice always has the same ID: de-duplicate by it
type One of the seven types below
createdAt When the notice was recorded
accountId Your account
clientId The consumer it concerns. Only on the three consumer types
savedSearchId The saved search. Only on saved_search.matches
listingKeys The listings concerned, at most 500. Empty on the account and data types
changes What happened, by type (below). Always an array

The webhook's body and the events list's item are the same JSON.

The seven types

Type For Recorded when changes
saved_search.matches one consumer listings that match a saved search are new or changed, at its alertFrequency [{ "listingKey": "…", "reasons": ["new"] }]
favorite.listing_updated one consumer a sync cycle changed one or more of the consumer's favorites [{ "listingKey": "…", "kinds": ["price"] }]
favorite.listing_removed one consumer favorites of the consumer were removed from the data ["removed"]
listing.removed the account listings were removed from the data ["removed"]
account.suspended the account the account was suspended ["suspended"]
account.reinstated the account the account was reinstated ["reinstated"]
data.stale the account live listing data stopped being served, and again when serving resumed ["started"] or ["ended"]

A ping is not a notice. It is sent only to an endpoint that is being registered or tested, and never appears in the events list:

{
  "id": "dlv_7Jc4Xn2Qw8Lm5Vt1Zr9Kb3",
  "type": "ping",
  "createdAt": "2026-11-10T15:00:00.000Z",
  "accountId": "0b9f6c1e-52a7-4c3e-9d41-7a6f0c2b8e15",
  "listingKeys": [],
  "changes": []
}

Answer it with a 2xx, whether or not its signature verifies, and do nothing else with it (why). Its id is its delivery's ID.

Receiving a webhook

Each notice is sent to every enabled endpoint of the account whose eventTypes include its type, as:

POST /your/path HTTP/1.1
Content-Type: application/json
User-Agent: apidata.one-webhooks/1
ApiData-Signature: t=1794322802,v1=<64 hex characters>
ApiData-Event-Id: evt_…
ApiData-Event-Type: saved_search.matches
ApiData-Delivery-Id: dlv_…
ApiData-Attempt: 1

{"id":"evt_…","type":"saved_search.matches", … }
Header Meaning
ApiData-Signature Proof that the request is ours and fresh. Verify it
ApiData-Event-Id The notice's ID (for a ping, the delivery's ID)
ApiData-Event-Type The notice's type, or ping
ApiData-Delivery-Id This notice's delivery to this endpoint, as the delivery list shows it
ApiData-Attempt 1 for the first attempt, 2 for the first retry, and so on

What your endpoint must do, in this order:

  1. Answer every ping with a 2xx, and never act on one. A ping is a request whose ApiData-Event-Type header is ping. Answer it 2xx whether or not its signature verifies: the ping that registers an endpoint is signed with a secret you haven't been given yet. A ping carries nothing, so there is nothing to act on.
  2. Until the endpoint's secret is stored on your server, answer every other request 503. It is then retried for 24 hours, by which time the secret is in place, and nothing is lost. Never answer 2xx to a notice you can't verify: a 2xx means "received", and that notice is never sent again.
  3. Once the secret is stored, verify every other request, and answer one that fails 400.
  4. Answer a verified notice with any 2xx within 10 seconds. Store the notice or put it on a queue, answer, and do the work afterwards. Fetching listings or sending email before you answer is the usual cause of timeouts.
  5. De-duplicate by id. A notice can arrive more than once (your 2xx was lost on the way and we retried), and notices can arrive out of order. Keep the IDs you have handled for at least 30 days.

Deliveries start the moment an endpoint is saved, which is before your server has stored its secret. A new endpoint receives every notice given out after it is saved, and that can include one recorded a few seconds before. Rule 2 covers them: they are answered 503 and come again, the first time a minute later.

What counts as a failure: any status that isn't 2xx, a redirect (never followed), no answer within 10 seconds, a TLS certificate that doesn't verify for your host name, or no connection. At most 64 KiB of your answer is read, and none of it is kept.

Retries. A failed delivery is tried again after 1, 2, 4, 8, 16, 32, 64 and 128 minutes, then about every 4 hours, with the last attempt 24 hours after the first: 14 attempts at most. After that the delivery is failed and is not sent again. The notice itself stays in the events list for its 30 days, so a server that was down for longer catches up from there. The delivery list shows every delivery of the last 30 days with its attempts and last result.

Pace. At most two requests at a time go to one endpoint, and one at a time while its last attempt failed.

Your address is checked on every attempt. The host name is resolved again each time, and the request is refused (refused_destination) unless every address it resolves to is public. Private, loopback, link-local and other reserved ranges are never called.

Verifying the signature

Anyone can send a POST to your URL. The signature proves a request came from us, for your endpoint, just now:

ApiData-Signature: t={unix seconds},v1={hex HMAC-SHA256(secret, t + "." + body)}

To verify: compute the HMAC yourself, compare it with v1 in constant time, and refuse a timestamp more than 5 minutes from your clock (that stops a recorded request from being replayed later). Read only t and v1, and ignore any other part of the header. Answer a request that fails with 400 and do nothing else with it.

The first ping can't be verified. When you register an endpoint, its ping arrives before you have been given the secret, which comes in the answer to that same request. That is why every ping is answered 2xx whatever its signature says. It holds for a second endpoint too: each endpoint has its own secret, and the new one's first ping is signed with the new secret, not with one you already hold.

To check that your verification works, send POST …/{id}/test once the secret is stored, and log whether its ping verified. A test ping is signed with the secret you hold.

The three functions below are complete and have no dependencies. They are also in this repository as runnable files, with the test vectors: verify.mjs, verify.py, verify.php and vectors.json.

Node.js

import { createHmac, timingSafeEqual } from 'node:crypto';

/**
 * True when `header` is a valid ApiData-Signature for `body` under `secret`.
 *
 * secret  the endpoint's secret, exactly as it was shown when the endpoint was created
 * header  the value of the ApiData-Signature header
 * body    the request body exactly as received: a Buffer, before any JSON parsing
 * now     the current time in Unix seconds (left out: the clock)
 */
export function verifyWebhook(secret, header, body, now = Math.floor(Date.now() / 1000)) {
  if (typeof secret !== 'string' || secret === '' || typeof header !== 'string') return false;
  let timestamp = null;
  const signatures = [];
  for (const part of header.split(',')) {
    const at = part.indexOf('=');
    if (at < 0) continue;
    const name = part.slice(0, at);
    const value = part.slice(at + 1);
    if (name === 't') timestamp = value;
    else if (name === 'v1') signatures.push(value);
  }
  if (timestamp === null || !/^[0-9]{1,15}$/.test(timestamp)) return false;
  // Refuse a timestamp more than five minutes from now, in either direction.
  if (Math.abs(now - Number(timestamp)) > 300) return false;
  const expected = Buffer.from(
    createHmac('sha256', secret).update(`${timestamp}.`).update(body).digest('hex'),
  );
  let valid = false;
  for (const signature of signatures) {
    const given = Buffer.from(signature);
    // Constant time: never compare signatures with === .
    if (given.length === expected.length && timingSafeEqual(given, expected)) valid = true;
  }
  return valid;
}

With Express, take the raw body for the webhook route, not the parsed one. The handler follows the rules above in their order:

app.post('/webhooks/apidata', express.raw({ type: 'application/json' }), (req, res) => {
  const secret = process.env.APIDATA_WEBHOOK_SECRET; // this endpoint's own secret, once stored
  const verified = Boolean(secret) && verifyWebhook(secret, req.get('ApiData-Signature'), req.body);
  if (req.get('ApiData-Event-Type') === 'ping') {
    console.log(`apidata ping, verified: ${verified}`);
    return res.status(204).end(); // every ping: 2xx, verified or not, and nothing else
  }
  if (!secret) return res.status(503).end(); // no secret stored yet: retried, never lost
  if (!verified) return res.status(400).end();
  const notice = JSON.parse(req.body.toString('utf8'));
  queue.add(notice); // answer first, work afterwards
  res.status(204).end();
});

Python

import hashlib
import hmac
import time


def verify_webhook(secret, header, body, now=None):
    """True when `header` is a valid ApiData-Signature for `body` under `secret`.

    secret  the endpoint's secret, exactly as it was shown when the endpoint was created
    header  the value of the ApiData-Signature header
    body    the request body exactly as received: bytes, before any JSON parsing
    now     the current time in Unix seconds (left out: the clock)
    """
    if not isinstance(secret, str) or secret == "" or not isinstance(header, str):
        return False
    if isinstance(body, str):
        body = body.encode("utf-8")
    if now is None:
        now = int(time.time())
    timestamp = None
    signatures = []
    for part in header.split(","):
        name, found, value = part.partition("=")
        if not found:
            continue
        if name == "t":
            timestamp = value
        elif name == "v1":
            signatures.append(value)
    if timestamp is None or not (timestamp.isascii() and timestamp.isdigit()):
        return False
    if len(timestamp) > 15:
        return False
    # Refuse a timestamp more than five minutes from now, in either direction.
    if abs(now - int(timestamp)) > 300:
        return False
    signed = timestamp.encode("ascii") + b"." + body
    expected = hmac.new(secret.encode("utf-8"), signed, hashlib.sha256).hexdigest()
    valid = False
    for signature in signatures:
        # Constant time: never compare signatures with == .
        if hmac.compare_digest(expected.encode("ascii"), signature.encode("utf-8")):
            valid = True
    return valid

With Flask, the same rules in the same order:

import json
import os

from flask import Flask, request

app = Flask(__name__)


@app.post("/webhooks/apidata")
def apidata_webhook():
    secret = os.environ.get("APIDATA_WEBHOOK_SECRET", "")  # this endpoint's own secret, once stored
    body = request.get_data()
    verified = verify_webhook(secret, request.headers.get("ApiData-Signature", ""), body)
    if request.headers.get("ApiData-Event-Type") == "ping":
        app.logger.info("apidata ping, verified: %s", verified)
        return "", 204  # every ping: 2xx, verified or not, and nothing else
    if not secret:
        return "", 503  # no secret stored yet: retried, never lost
    if not verified:
        return "", 400
    queue.put(json.loads(body))  # answer first, work afterwards
    return "", 204

With Django, the header is request.headers.get("ApiData-Signature", "") and the body is request.body.

PHP

/**
 * True when $header is a valid ApiData-Signature for $body under $secret.
 *
 * $secret  the endpoint's secret, exactly as it was shown when the endpoint was created
 * $header  the value of the ApiData-Signature header: $_SERVER['HTTP_APIDATA_SIGNATURE']
 * $body    the request body exactly as received: file_get_contents('php://input')
 * $now     the current time in Unix seconds (left out: the clock)
 */
function apidata_verify_webhook(string $secret, string $header, string $body, ?int $now = null): bool
{
    if ($secret === '') {
        return false;
    }
    $now = $now ?? time();
    $timestamp = null;
    $signatures = [];
    foreach (explode(',', $header) as $part) {
        $at = strpos($part, '=');
        if ($at === false) {
            continue;
        }
        $name = substr($part, 0, $at);
        $value = (string) substr($part, $at + 1);
        if ($name === 't') {
            $timestamp = $value;
        } elseif ($name === 'v1') {
            $signatures[] = $value;
        }
    }
    if ($timestamp === null || preg_match('/^[0-9]{1,15}$/D', $timestamp) !== 1) {
        return false;
    }
    // Refuse a timestamp more than five minutes from now, in either direction.
    if (abs($now - (int) $timestamp) > 300) {
        return false;
    }
    $expected = hash_hmac('sha256', $timestamp . '.' . $body, $secret);
    $valid = false;
    foreach ($signatures as $signature) {
        // Constant time: never compare signatures with == or === .
        if (hash_equals($expected, $signature)) {
            $valid = true;
        }
    }
    return $valid;
}

The same rules in the same order:

$secret = getenv('APIDATA_WEBHOOK_SECRET') ?: ''; // this endpoint's own secret, once stored
$body = file_get_contents('php://input');
$verified = apidata_verify_webhook($secret, $_SERVER['HTTP_APIDATA_SIGNATURE'] ?? '', $body);
if (($_SERVER['HTTP_APIDATA_EVENT_TYPE'] ?? '') === 'ping') {
    error_log('apidata ping, verified: ' . ($verified ? 'yes' : 'no'));
    http_response_code(204); // every ping: 2xx, verified or not, and nothing else
    exit;
}
if ($secret === '') {
    http_response_code(503); // no secret stored yet: retried, never lost
    exit;
}
if (!$verified) {
    http_response_code(400);
    exit;
}
$notice = json_decode($body, true);
// store the notice or queue it here; answer first, work afterwards
http_response_code(204);

Test vectors

vectors.json holds 16 cases: the secret, the timestamp, the body, the header, the time on your clock (now, Unix seconds) and whether verification must pass. They include a valid signature, a tampered body, an old timestamp, a timestamp from the future, a refreshed timestamp on an old signature, another secret, and an empty secret. Run your own code against all of them before you rely on it. Each of the three files answers one case on standard input:

echo '{"secret":"whsec_…","header":"t=…,v1=…","body":"{…}","now":1794322803}' | node verify.mjs

and prints true or false (python verify.py and php verify.php work the same way).

Suspension and reinstatement

While your account is suspended:

When the account is reinstated, account.reinstated is recorded. Notices more than 24 hours old at that moment are dropped, from deliveries and from the events list alike; the rest go out.

After a reinstatement, re-check every listing page or copy you stored. The dropped notices can include removals. For each listing you kept, ask GET /v1/listings/{listingKey} again: 404 listing_not_found means delete it, and anything else replaces what you had. Do this when you receive account.reinstated.

When a notice is late

Limits

What Limit
Endpoints per account 10
Listing keys in one notice 500
Time to answer a webhook 10 seconds
Attempts per delivery 14, over 24 hours
Notices and deliveries kept 30 days
Endpoint registrations and tests 10 in any 10 minutes, per account

This page as Markdown