API documentation
The KnalpotRacing Catalog API is a read-only catalog service for marketplace and commerce applications.
Endpoints
Public catalog
No authentication required. HET, stock, product media, brand and category fields are safe for storefront use.
Private catalog
Server-to-server only. Public responses expose HET only. Private responses may expose the internal tiers authorized by the client scope.
Health
Authentication
Private requests use HMAC-SHA256 signatures. Never expose a Client Secret in browser JavaScript, mobile bundles or public repositories.
Required headers
| Header | Value |
|---|---|
X-KR-Client-Id | Client ID |
X-KR-Timestamp | Unix timestamp |
X-KR-Nonce | Unique 16–160 character nonce |
X-KR-Signature-Version | v1 |
X-KR-Signature | 64-character lowercase SHA-256 HMAC |
Canonical request
Build the signing payload in exactly this order:
HTTP_METHOD PATH_WITH_SORTED_QUERY TIMESTAMP NONCE SHA256(REQUEST_BODY)
- Request method must be uppercase.
- Request path with sorted query parameters must match the actual request.
- Unix timestamp must stay inside the allowed clock skew.
- Unique nonce may only be used once.
- SHA-256 request body hash uses the exact raw body bytes.
Available scopes
| Scope | Description |
|---|---|
catalog.read | Read public/private catalog records. |
pricing.internal.read | Read restricted pricing tiers. |
stock.read | Read stock quantities and status. |
orders.read / orders.write | Reserved for commerce integration. |
inventory.reserve / inventory.release | Reserved for commerce inventory flows. |
Response schema
Public responses expose HET only. Private responses may expose the internal tiers authorized by the client scope.
{
"id": 123,
"barcode": "ABC-123",
"name": "Product name",
"prices": {
"modal": 100000,
"distributor": 110000,
"reseller": 120000,
"admin": 125000,
"bengkel": 130000,
"het": 150000
},
"stock": { "qty": 10, "status": "IN_STOCK" }
}Common errors
| Code | HTTP | Description |
|---|---|---|
INVALID_SIGNATURE | 401 | Invalid or missing HMAC credentials. |
REQUEST_EXPIRED | 401 | Timestamp is outside the allowed time window. |
REPLAY_DETECTED | 409 | Nonce has already been used. |
INSUFFICIENT_SCOPE | 403 | Client does not have the required scope. |
RATE_LIMITED | 429 | Client request quota exceeded. |
Code examples
import crypto from "node:crypto";
const baseUrl = "https://api.knalpotracing.com";
const path = "/v1/catalog/private/";
const timestamp = Math.floor(Date.now() / 1000).toString();
const nonce = crypto.randomBytes(18).toString("hex");
const bodyHash = crypto.createHash("sha256").update("").digest("hex");
const canonical = ["GET", path, timestamp, nonce, bodyHash].join("\n");
const signature = crypto.createHmac("sha256", process.env.KR_CLIENT_SECRET)
.update(canonical).digest("hex");
const response = await fetch(baseUrl + path, {
headers: {
"X-KR-Client-Id": process.env.KR_CLIENT_ID,
"X-KR-Timestamp": timestamp,
"X-KR-Nonce": nonce,
"X-KR-Signature-Version": "v1",
"X-KR-Signature": signature
}
});$clientId = getenv('KR_CLIENT_ID');
$secret = getenv('KR_CLIENT_SECRET');
$path = '/v1/catalog/private/';
$timestamp = (string) time();
$nonce = bin2hex(random_bytes(18));
$bodyHash = hash('sha256', '');
$canonical = implode("\n", ['GET', $path, $timestamp, $nonce, $bodyHash]);
$signature = hash_hmac('sha256', $canonical, $secret);Request private API access
Private API access is issued manually after verification.
To request Client ID and Client Secret, contact the KnalpotRacing API administrator through WhatsApp. Credentials are created only after the intended use, environment and required scopes are reviewed.
Security notes
- Store production secrets in server environment variables or a secret manager.
- Use separate credentials for development, staging and production.
- Enable IP restrictions when the production egress IP is stable.
- Rotate credentials immediately if exposure is suspected.
- Never log raw Client Secrets or canonical signing secrets.