Hi-Performance Distributors — Dealer API

Live pricing, stock, orders and shipment tracking for your dealer account, over HTTPS + JSON.

Getting started

Authentication (HMAC-SHA256)

Each request carries one header:

Authorization: smx {AppId}:{Signature}:{Timestamp}:{Nonce}
PartValue
AppIdYour App ID.
TimestampCurrent Unix time in seconds (UTC). Requests are accepted within a few minutes of the server clock — keep your clock synced (NTP).
NonceA random string, new for every request (e.g. 32 hex characters). A nonce that has been seen recently is rejected as a replay.
SignatureBase64( HMAC-SHA256( secretKey, stringToSign ) ) — the raw 32-byte HMAC, Base64-encoded.

The string to sign

Concatenate these seven values with no separators:

stringToSign = AppId
             + METHOD          // "GET" or "POST", upper case
             + path            // e.g. "/get_inventory", lower case, leading slash
             + query           // exactly as sent, INCLUDING the leading "?"; "" if none
             + Timestamp
             + Nonce
             + bodyHash        // Base64( MD5( raw request body bytes ) )
Common mistakes

Worked example

With the made-up credentials App ID AbCdEf123 and secret your-secret-key:

GET https://api.hpd.ca/get_inventory?part=ACA1002&part=AAN13103

Timestamp     1767225600
Nonce         5f2b9c0e8a7d4c1e9b3a6f0d2c8e1a47
bodyHash      1B2M2Y8AsgTpgAmY7PhCfg==

stringToSign  AbCdEf123GET/get_inventory?part=ACA1002&part=AAN1310317672256005f2b9c0e8a7d4c1e9b3a6f0d2c8e1a471B2M2Y8AsgTpgAmY7PhCfg==
Signature     Ycy/cNAVw3Dh4GTqmsCBdRzxPqyzg/tWnKHQ7AQmfKw=

Authorization: smx AbCdEf123:Ycy/cNAVw3Dh4GTqmsCBdRzxPqyzg/tWnKHQ7AQmfKw=:1767225600:5f2b9c0e8a7d4c1e9b3a6f0d2c8e1a47

If your code produces the same signature from these inputs, your signing is correct.

Client code

PHP

<?php
function hpd_api($method, $path, array $query = [], $body = '')
{
    $appId  = getenv('HPD_APP_ID');
    $secret = getenv('HPD_SECRET');

    $qs = '';
    foreach ($query as $k => $v) {
        foreach ((array)$v as $one) {                 // repeated keys: part=A&part=B
            $qs .= ($qs === '' ? '?' : '&') . rawurlencode($k) . '=' . rawurlencode($one);
        }
    }
    $ts    = time();
    $nonce = bin2hex(random_bytes(16));
    $bodyHash = base64_encode(md5($body, true));
    $toSign   = $appId . strtoupper($method) . strtolower($path) . $qs . $ts . $nonce . $bodyHash;
    $sig      = base64_encode(hash_hmac('sha256', $toSign, $secret, true));

    $headers = ["Authorization: smx $appId:$sig:$ts:$nonce"];
    if ($body !== '') $headers[] = 'Content-Type: application/x-www-form-urlencoded';

    $ch = curl_init('https://api.hpd.ca' . $path . $qs);
    curl_setopt_array($ch, [
        CURLOPT_CUSTOMREQUEST  => strtoupper($method),
        CURLOPT_HTTPHEADER     => $headers,
        CURLOPT_POSTFIELDS     => $body !== '' ? $body : null,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING       => '',                 // accept gzip (the catalogue is large)
        CURLOPT_TIMEOUT        => 120,
    ]);
    $json = curl_exec($ch);
    curl_close($ch);
    return json_decode($json, true);
}

$r = hpd_api('GET', '/get_inventory', ['part' => ['ACA1002', 'AAN13103']]);
if ($r['success']) {
    foreach ($r['result'] as $row) echo $row['PartNumber'], ' ', $row['Price'], ' ', $row['Available'], "\n";
} else {
    echo implode("\n", $r['errors']);
}

Python 3

import base64, hashlib, hmac, os, secrets, time
from urllib.parse import urlencode
import requests

APP_ID, SECRET = os.environ["HPD_APP_ID"], os.environ["HPD_SECRET"]

def hpd_api(method, path, query=None, body=b""):
    qs = ("?" + urlencode(query, doseq=True)) if query else ""
    ts, nonce = str(int(time.time())), secrets.token_hex(16)
    body_hash = base64.b64encode(hashlib.md5(body).digest()).decode()
    to_sign = APP_ID + method.upper() + path.lower() + qs + ts + nonce + body_hash
    sig = base64.b64encode(hmac.new(SECRET.encode(), to_sign.encode(), hashlib.sha256).digest()).decode()
    headers = {"Authorization": f"smx {APP_ID}:{sig}:{ts}:{nonce}"}
    if body:
        headers["Content-Type"] = "application/x-www-form-urlencoded"
    return requests.request(method, "https://api.hpd.ca" + path + qs, data=body or None,
                            headers=headers, timeout=120).json()

print(hpd_api("GET", "/get_open_orders"))

Node.js (18+)

const crypto = require('crypto');
const APP_ID = process.env.HPD_APP_ID, SECRET = process.env.HPD_SECRET;

async function hpdApi(method, path, query = {}, body = '') {
  const params = new URLSearchParams();
  for (const [k, v] of Object.entries(query)) [].concat(v).forEach(x => params.append(k, x));
  const qs = params.toString() ? '?' + params.toString() : '';
  const ts = Math.floor(Date.now() / 1000).toString();
  const nonce = crypto.randomBytes(16).toString('hex');
  const bodyHash = crypto.createHash('md5').update(body, 'utf8').digest('base64');
  const toSign = APP_ID + method.toUpperCase() + path.toLowerCase() + qs + ts + nonce + bodyHash;
  const sig = crypto.createHmac('sha256', SECRET).update(toSign, 'utf8').digest('base64');
  const headers = { Authorization: `smx ${APP_ID}:${sig}:${ts}:${nonce}` };
  if (body) headers['Content-Type'] = 'application/x-www-form-urlencoded';
  const res = await fetch('https://api.hpd.ca' + path + qs, { method, headers, body: body || undefined });
  return res.json();
}

hpdApi('GET', '/get_tracking_info', { order: '123456' }).then(console.log);

curl (bash + openssl)

APP_ID="your-app-id"; SECRET="your-secret"
METHOD=GET; URLPATH=/get_parts_on_order; QS=""
TS=$(date +%s); NONCE=$(openssl rand -hex 16)
BODYHASH=$(printf '' | openssl dgst -md5 -binary | base64)
SIG=$(printf '%s' "$APP_ID$METHOD$URLPATH$QS$TS$NONCE$BODYHASH" \
      | openssl dgst -sha256 -hmac "$SECRET" -binary | base64)
curl -s --compressed -H "Authorization: smx $APP_ID:$SIG:$TS:$NONCE" "https://api.hpd.ca$URLPATH$QS"

Responses & errors

Responses are JSON in a common envelope:

{ "result": ..., "success": true,  "errors": [] }
{                "success": false, "errors": ["Invalid Stock Code(s): XYZ123"] }
HTTPMeaning
200Request processed. Always check success — validation problems come back as 200 with success: false and a message in errors.
401"Authentication Failed!" — bad signature, unknown App ID, clock too far off, or a reused nonce. Also returned for an endpoint your key is not allowed to call.
500Server error. Retry later; contact HPD if it persists.

Responses can be gzip-compressed — send Accept-Encoding: gzip (curl --compressed, PHP CURLOPT_ENCODING => '').

Endpoints

PathPurpose
GET/get_inventoryYour price and stock for specific part numbers
GET/full_catalogEvery product with your price
GET/get_open_ordersYour open orders
GET/get_orderOne of your orders, with line items
GET/get_parts_on_orderEvery part on your open orders, with outstanding quantity
GET/get_tracking_infoCarrier and tracking number for an invoice or order
GET/frequent_purchasesYour most-purchased items (last 180 days)
GET/popularBest sellers across all dealers
GET/related_productsProducts related to a part
GET/get_dutyImport duty for a part
POST/place_orderPlace an order on your account

Pricing & availability — GET /get_inventory

part — a part number; repeat it for several parts (?part=A&part=B). Part numbers are upper-cased for you.

$r = hpd_api('GET', '/get_inventory', ['part' => ['ACA1002', 'AAN13103']]);

Each row: PartNumber, Description, Available, OnOrder, ETA (next expected receipt, if any), Price (your price).

Full catalogue — GET /full_catalog

No parameters. Every product with your pricing — a large response (tens of thousands of rows, several MB compressed); fetch it at most a few times a day and accept gzip.

$r = hpd_api('GET', '/full_catalog');
foreach ($r['result'] as $p) { /* $p['PartNumber'], $p['Price'], $p['Available'], ... */ }

Each row includes PartNumber, Description, Title, Category, AltCode, Model, Available, OnOrder, Discontinued, ModifiedOn, AddedOn, CADmap, USDmap, Manufacturer, ETA, Price, PrimaryImage.

Your orders

GET /get_open_orders — no parameters. Your orders that are not yet complete.

$r = hpd_api('GET', '/get_open_orders');

GET /get_order?number=123456 — one order with its line items. An order number that is not on your account returns not found.

$r = hpd_api('GET', '/get_order', ['number' => 123456]);

GET /get_parts_on_order — no parameters. One row per line on your open orders: PartNumber, Ordered, Shipped, Outstanding, Price, OrderNumber, OrderDate, OrderReference, OrderPO, OrderStatus.

$r = hpd_api('GET', '/get_parts_on_order');

Shipment tracking — GET /get_tracking_info

Pass either invoice or order (not both). Returns TrackNum and ShipVia for your shipments.

$r = hpd_api('GET', '/get_tracking_info', ['invoice' => 193493]);
$r = hpd_api('GET', '/get_tracking_info', ['order' => 123456]);

Product insights

CallParametersReturns
GET /frequent_purchasesnoneYour top 10 items by quantity over the last 180 days: StockCode, Description, Available, OnOrder, total
GET /popularcount (default 10), period in days (default 30), category (optional)Best sellers: StockCode, Description, Available, OnOrder, total, category
GET /related_productsstockCodeProducts related to that part
GET /get_dutystockCodestockCode, ImportDuty
$r = hpd_api('GET', '/popular', ['count' => 25, 'period' => 90]);
$r = hpd_api('GET', '/related_products', ['stockCode' => 'ACA1002']);

Placing an order — POST /place_order

The body is form-encoded (application/x-www-form-urlencoded), not JSON. Line items use indexed keys: oritems[0].StockCode, oritems[0].Ordered, …

Field
ShipViaRequired. Ship, Hold or Drop Ship.
CustPOYour PO number.
NotesInstructions for HPD.
DueDateRequested date, e.g. 2026-12-01T00:00:00.
oritems[n].StockCodeRequired, one or more lines.
oritems[n].OrderedQuantity (default 1).
oritems[n].AddDescrOptional line note.
ShipName, ShipCompany, ShipAdd, ShipAdd2, ShipCity, ShipState, ShipZip, ShipCntry, ShipPhoneDrop Ship only — ShipAdd, ShipCity, ShipState, ShipZip, ShipCntry and ShipPhone are then required. For Ship/Hold leave them out; your address on file is used.
$body = http_build_query([
    'ShipVia' => 'Ship',
    'CustPO'  => 'PO-1001',
    'Notes'   => 'Please ship complete',
    'oritems[0].StockCode' => 'ACA1002', 'oritems[0].Ordered' => 2,
    'oritems[1].StockCode' => 'AAN13103', 'oritems[1].Ordered' => 1,
], '', '&', PHP_QUERY_RFC3986);

$r = hpd_api('POST', '/place_order', [], $body);   // hash and send the SAME $body
Orders placed through the API are real orders on your account. Test with the read-only calls first.