Live pricing, stock, orders and shipment tracking for your dealer account, over HTTPS + JSON.
https://api.hpd.caEach request carries one header:
Authorization: smx {AppId}:{Signature}:{Timestamp}:{Nonce}
| Part | Value |
|---|---|
AppId | Your App ID. |
Timestamp | Current Unix time in seconds (UTC). Requests are accepted within a few minutes of the server clock — keep your clock synced (NTP). |
Nonce | A random string, new for every request (e.g. 32 hex characters). A nonce that has been seen recently is rejected as a replay. |
Signature | Base64( HMAC-SHA256( secretKey, stringToSign ) ) — the raw 32-byte HMAC, Base64-encoded. |
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 ) )
bodyHash is always present. For a GET (empty body) it is the MD5 of zero bytes: 1B2M2Y8AsgTpgAmY7PhCfg==?. Don't sign a ? when there is no query.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.
<?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']);
}
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"))
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);
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 are JSON in a common envelope:
{ "result": ..., "success": true, "errors": [] }
{ "success": false, "errors": ["Invalid Stock Code(s): XYZ123"] }
| HTTP | Meaning |
|---|---|
| 200 | Request 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. |
| 500 | Server error. Retry later; contact HPD if it persists. |
Responses can be gzip-compressed — send Accept-Encoding: gzip (curl --compressed, PHP CURLOPT_ENCODING => '').
| Path | Purpose | |
|---|---|---|
| GET | /get_inventory | Your price and stock for specific part numbers |
| GET | /full_catalog | Every product with your price |
| GET | /get_open_orders | Your open orders |
| GET | /get_order | One of your orders, with line items |
| GET | /get_parts_on_order | Every part on your open orders, with outstanding quantity |
| GET | /get_tracking_info | Carrier and tracking number for an invoice or order |
| GET | /frequent_purchases | Your most-purchased items (last 180 days) |
| GET | /popular | Best sellers across all dealers |
| GET | /related_products | Products related to a part |
| GET | /get_duty | Import duty for a part |
| POST | /place_order | Place an order on your account |
GET /get_inventorypart — 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).
GET /full_catalogNo 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.
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');
GET /get_tracking_infoPass 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]);
| Call | Parameters | Returns |
|---|---|---|
GET /frequent_purchases | none | Your top 10 items by quantity over the last 180 days: StockCode, Description, Available, OnOrder, total |
GET /popular | count (default 10), period in days (default 30), category (optional) | Best sellers: StockCode, Description, Available, OnOrder, total, category |
GET /related_products | stockCode | Products related to that part |
GET /get_duty | stockCode | stockCode, ImportDuty |
$r = hpd_api('GET', '/popular', ['count' => 25, 'period' => 90]);
$r = hpd_api('GET', '/related_products', ['stockCode' => 'ACA1002']);
POST /place_orderThe body is form-encoded (application/x-www-form-urlencoded), not JSON. Line items use indexed keys: oritems[0].StockCode, oritems[0].Ordered, …
| Field | |
|---|---|
ShipVia | Required. Ship, Hold or Drop Ship. |
CustPO | Your PO number. |
Notes | Instructions for HPD. |
DueDate | Requested date, e.g. 2026-12-01T00:00:00. |
oritems[n].StockCode | Required, one or more lines. |
oritems[n].Ordered | Quantity (default 1). |
oritems[n].AddDescr | Optional line note. |
ShipName, ShipCompany, ShipAdd, ShipAdd2, ShipCity, ShipState, ShipZip, ShipCntry, ShipPhone | Drop Ship only — ShipAdd, ShipCity, ShipState, ShipZip, ShipCntry and ShipPhone are then required. For Ship/Hold leave them out; your address on file is used. |
result lists the order number(s) created, e.g. ["Backorder Number: 123457", "Order Number: 123458"].$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