SnapPar Enterprise REST API & Webhooks
Integrate NetSuite, SAP, shop-floor scales, RFID gates, and automated purchasing workflows directly with SnapPar bins, spatial warehouse health maps, and immutable compliance audit trails.
Authentication & Quickstart
Issue scoped machine tokens (sk_live_...) from Admin Settings → Enterprise API Keys. Send tokens via X-API-Key or Authorization: Bearer. Workspaces must hold an active Enterprise Fleet subscription (403 ENTERPRISE_PLAN_REQUIRED otherwise).
https://snappar.apphttps://api.snappar.iohttp://localhost:8080Quickstart Examples
# 1. Export OUT & LOW bins with supplier order URLs
curl -sS "https://snappar.app/api/v1/reports/deficits?urgency=OUT" \
-H "X-API-Key: sk_live_your_key"
# 2. Push ERP stock counts back to SnapPar
curl -sS -X POST "https://snappar.app/api/v1/bins/bulk-stock" \
-H "X-API-Key: sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"items":[{"bin_qr_id":"A01-B02-04","current_stock":24,"par_level":20}]}'const headers = { 'X-API-Key': process.env.SNAPPAR_API_KEY, 'Content-Type': 'application/json' };
const deficits = await fetch('https://snappar.app/api/v1/reports/deficits', { headers }).then(r => r.json());
console.log('Bins needing reorder:', deficits.total_bins, 'Est. cost:', deficits.total_estimated_cost);
const sync = await fetch('https://snappar.app/api/v1/bins/bulk-stock', {
method: 'POST', headers,
body: JSON.stringify({ items: [{ bin_qr_id: 'A01-B02-04', current_stock: 24 }] }),
}).then(r => r.json());import os, requests
headers = {"X-API-Key": os.environ["SNAPPAR_API_KEY"]}
deficits = requests.get("https://snappar.app/api/v1/reports/deficits", headers=headers, timeout=10)
deficits.raise_for_status()
print("Deficit bins:", deficits.json()["total_bins"])API Key Scopes, Rate Limits & Error Codes
Machine keys default to 120 requests/minute per key with X-RateLimit-Remaining andX-RateLimit-Reset headers. Human-session Admin routes (/api-keys,/team, /billing, /workspace) reject API keys with403 SESSION_AUTH_REQUIRED to prevent privilege escalation.
| Scope | Permitted Operations | Covered Routes |
|---|---|---|
| bins:read | Read-only bin catalog, barcode locate, product lookup & deficit CSV/JSON | GET /bins, /bins/{id}, /bins/locate, /products/{code}, /reports/deficits |
| bins:write | Create/update bins, bulk ERP stock sync, IoT telemetry, CSV import & ASN tracking | POST/PUT/DELETE /bins*, /bins/bulk-stock, /telemetry/bins, /receiving/asn |
| requests:read | List and filter replenishment requests by status & unix timestamp | GET /requests?status=&since= |
| requests:write | Create, approve, deny, receive, and attach external ERP POs to requests | POST /requests*, PATCH /requests/{id}/external-po |
| audit:read | Query paginated compliance audit logs in JSON or formula-safe CSV | GET /audit-logs |
| locations:read | Read facility tree, live bay stockout health, and dock walk-order | GET /orgs/{orgId}/locations/{tree,health,walk-order} |
| locations:write | Modify location nodes, layouts, cloning & bin bindings (Pro/Enterprise) | POST/PUT/PATCH/DELETE /orgs/{orgId}/locations* |
| webhooks:manage | Admin-role key required: register, test ping, inspect deliveries & delete hooks | GET/POST/DELETE /webhooks/endpoints*, /webhooks/deliveries |
| * | Wildcard machine scope across API routes (still blocked on session-only Admin routes) | All scoped REST endpoints except /api-keys, /team, /billing, /workspace |
| HTTP | Code | Cause | Resolution |
|---|---|---|---|
| 401 | INVALID_API_KEY | Missing, malformed, expired, or revoked sk_live_ token | Rotate or re-issue a key from Admin Settings -> Enterprise API Keys |
| 403 | ENTERPRISE_PLAN_REQUIRED | Workspace is on Solo/Pro or downgraded from Enterprise Fleet | Upgrade workspace subscription to Enterprise Fleet |
| 403 | INSUFFICIENT_SCOPE | API key lacks the required granular scope (e.g. bins:write) | Issue a new key including the required scope shown per endpoint |
| 403 | SESSION_AUTH_REQUIRED | Machine key called a human-session route (/api-keys, /team, /billing, /workspace) | Use an interactive Admin JWT session instead of X-API-Key |
| 409 | CONFLICT | Duplicate active pending reorder request or rotating a revoked API key | Update the existing request or issue a fresh API key |
| 429 | RATE_LIMIT_EXCEEDED | Exceeded 120 requests/min sliding window for this key | Back off until X-RateLimit-Reset unix timestamp |
REST Endpoint Reference
Generated directly from openapi_spec.json. All endpoints accept and return UTF-8 JSON (and RFC-4180 formula-safe CSV where noted via ?format=csv).
Bins & ERP Sync
Catalog CRUD, barcode resolution, workflow transitions, ERP stock upserts, and deficit reporting.
GET/api/v1/binsList workspace binsbins:read
Returns all bins in the caller's workspace, optionally filtered by substring query `?q=`.
q(query, string)Filter by title, QR ID, or barcode.workspace_id(query, string)Workspace scope (ProductAdmin only for cross-org).
curl -X GET "https://snappar.app/api/v1/bins" \
-H "X-API-Key: sk_live_your_key"{
"bins": [
{
"id": "bin_bolt_m8",
"bin_qr_id": "A01-B02-04",
"current_stock": 4,
"par_level": 20
}
],
"count": 1
}{
"error": "API key missing required scope: bins:write",
"code": "INSUFFICIENT_SCOPE"
}{
"error": "API key missing required scope: bins:write",
"code": "INSUFFICIENT_SCOPE"
}{
"error": "API key missing required scope: bins:write",
"code": "INSUFFICIENT_SCOPE"
}POST/api/v1/binsCreate inventory binbins:write
Creates a physical bin mapping with QR code, barcode, par level, and vendor URL. Floor Scanners are blocked.
curl -X POST "https://snappar.app/api/v1/bins" \
-H "X-API-Key: sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"id":"bin_bolt_m8","workspace_id":"ws_acme","bin_qr_id":"A01-B02-04","upc_barcode":"049000028904","title":"M8x25 Stainless Hex Bolt (50pk)","category":"Fasteners","primary_vendor_url":"https://www.mcmaster.com/91287A142","default_price":14.5,"par_level":20,"current_stock":4,"location_short_code":"A01-B02-04","location_display":"North Plant > Aisle 1 > Bay 2","status":"LOW"}'{
"id": "bin_bolt_m8",
"workspace_id": "ws_acme",
"bin_qr_id": "A01-B02-04",
"upc_barcode": "049000028904",
"title": "M8x25 Stainless Hex Bolt (50pk)",
"category": "Fasteners",
"primary_vendor_url": "https://www.mcmaster.com/91287A142",
"default_price": 14.5,
"par_level": 20,
"current_stock": 4,
"location_short_code": "A01-B02-04",
"location_display": "North Plant > Aisle 1 > Bay 2",
"status": "LOW"
}{
"id": "bin_bolt_m8",
"workspace_id": "ws_acme",
"bin_qr_id": "A01-B02-04",
"upc_barcode": "049000028904",
"title": "M8x25 Stainless Hex Bolt (50pk)",
"category": "Fasteners",
"primary_vendor_url": "https://www.mcmaster.com/91287A142",
"default_price": 14.5,
"par_level": 20,
"current_stock": 4,
"location_short_code": "A01-B02-04",
"location_display": "North Plant > Aisle 1 > Bay 2",
"status": "LOW"
}GET/api/v1/bins/{id}Fetch single bin by ID, QR ID, or UPCbins:read
id(path, required, string)
curl -X GET "https://snappar.app/api/v1/bins/bin_bolt_m8" \
-H "X-API-Key: sk_live_your_key"{
"id": "bin_bolt_m8",
"workspace_id": "ws_acme",
"bin_qr_id": "A01-B02-04",
"upc_barcode": "049000028904",
"title": "M8x25 Stainless Hex Bolt (50pk)",
"category": "Fasteners",
"primary_vendor_url": "https://www.mcmaster.com/91287A142",
"default_price": 14.5,
"par_level": 20,
"current_stock": 4,
"location_short_code": "A01-B02-04",
"location_display": "North Plant > Aisle 1 > Bay 2",
"status": "LOW"
}PUT/api/v1/bins/{id}Update bin configurationbins:write
id(path, required, string)
curl -X PUT "https://snappar.app/api/v1/bins/bin_bolt_m8" \
-H "X-API-Key: sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"id":"bin_bolt_m8","workspace_id":"ws_acme","bin_qr_id":"A01-B02-04","upc_barcode":"049000028904","title":"M8x25 Stainless Hex Bolt (50pk)","category":"Fasteners","primary_vendor_url":"https://www.mcmaster.com/91287A142","default_price":14.5,"par_level":20,"current_stock":4,"location_short_code":"A01-B02-04","location_display":"North Plant > Aisle 1 > Bay 2","status":"LOW"}'{
"id": "bin_bolt_m8",
"workspace_id": "ws_acme",
"bin_qr_id": "A01-B02-04",
"upc_barcode": "049000028904",
"title": "M8x25 Stainless Hex Bolt (50pk)",
"category": "Fasteners",
"primary_vendor_url": "https://www.mcmaster.com/91287A142",
"default_price": 14.5,
"par_level": 20,
"current_stock": 4,
"location_short_code": "A01-B02-04",
"location_display": "North Plant > Aisle 1 > Bay 2",
"status": "LOW"
}{
"id": "bin_bolt_m8",
"workspace_id": "ws_acme",
"bin_qr_id": "A01-B02-04",
"upc_barcode": "049000028904",
"title": "M8x25 Stainless Hex Bolt (50pk)",
"category": "Fasteners",
"primary_vendor_url": "https://www.mcmaster.com/91287A142",
"default_price": 14.5,
"par_level": 20,
"current_stock": 4,
"location_short_code": "A01-B02-04",
"location_display": "North Plant > Aisle 1 > Bay 2",
"status": "LOW"
}DELETE/api/v1/bins/{id}Delete binbins:write
id(path, required, string)
curl -X DELETE "https://snappar.app/api/v1/bins/bin_bolt_m8" \
-H "X-API-Key: sk_live_your_key"{
"deleted": true
}POST/api/v1/bins/bulk-stockBatch sync stock, par levels, prices & supplier URLsbins:write
Synchronizes ERP stock counts, par levels, pricing, and vendor URLs in one batch. Records audit trail entries and fires `bin.stock_out`, `bin.stock_low`, or `bin.restocked` webhooks on state transitions.
curl -X POST "https://snappar.app/api/v1/bins/bulk-stock" \
-H "X-API-Key: sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"items":[{"bin_qr_id":"A01-B02-04","current_stock":0,"par_level":24,"default_price":15.25}]}'{
"items": [
{
"bin_qr_id": "A01-B02-04",
"current_stock": 0,
"par_level": 24,
"default_price": 15.25
}
]
}{
"updated": 1,
"updated_bins": [
{
"id": "bin_bolt_m8",
"bin_qr_id": "A01-B02-04",
"current_stock": 0
}
]
}{
"error": "API key missing required scope: bins:write",
"code": "INSUFFICIENT_SCOPE"
}GET/api/v1/bins/locateResolve UPC/case barcode to matching bins sorted by urgencybins:read
barcode(query, required, string)Scanned UPC, EAN, or alternate case barcode.
curl -X GET "https://snappar.app/api/v1/bins/locate" \
-H "X-API-Key: sk_live_your_key"{
"barcode": "049000028904",
"bins": [
{
"id": "bin_bolt_m8",
"bin_qr_id": "A01-B02-04"
}
],
"count": 1
}POST/api/v1/bins/{id}/statusTrigger bin workflow status update (Good, Low, Out)bins:write
Executes `notice_flag`, `milkman_audit`, `kanban_loop`, `receiving_reset`, or `sensor_webhook` (Fleet-gated).
id(path, required, string)
curl -X POST "https://snappar.app/api/v1/bins/bin_bolt_m8/status" \
-H "X-API-Key: sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"fill_status":"Low","workflow":"milkman_audit","current_stock":5,"notes":"Morning aisle check"}'{
"fill_status": "Low",
"workflow": "milkman_audit",
"current_stock": 5,
"notes": "Morning aisle check"
}GET/api/v1/reports/deficitsExport OUT and LOW replenishment deficits (JSON or CSV)bins:read
urgency(query, string)supplier(query, string)Filter by vendor host substring (e.g. mcmaster, amazon).location_prefix(query, string)format(query, string)
curl -X GET "https://snappar.app/api/v1/reports/deficits" \
-H "X-API-Key: sk_live_your_key"{
"workspace_id": "ws_acme",
"generated_at": 1795300000,
"total_bins": 1,
"total_deficit_units": 24,
"total_estimated_cost": 366,
"by_supplier": {
"mcmaster.com": 1
},
"items": [
{
"bin_qr_id": "A01-B02-04",
"title": "M8x25 Hex Bolt",
"status": "OUT",
"deficit_qty": 24,
"estimated_cost": 366
}
]
}Replenishment & Requests
Reorder queue inspection, approval/denial/receiving actions, and external ERP PO linking.
GET/api/v1/requestsList reorder requests with ?status= & ?since= filterrequests:read
status(query, string)since(query, integer)Unix timestamp lower bound on created_at.
curl -X GET "https://snappar.app/api/v1/requests" \
-H "X-API-Key: sk_live_your_key"{
"requests": [
{
"id": "req_1795300200",
"product_id": "bin_bolt_m8",
"quantity": 20,
"status": 1
}
],
"count": 1
}POST/api/v1/requestsCreate replenishment requestrequests:write
curl -X POST "https://snappar.app/api/v1/requests" \
-H "X-API-Key: sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"product_id":"bin_bolt_m8","quantity":20,"notes":"Flagged at bay 2"}'{
"product_id": "bin_bolt_m8",
"quantity": 20,
"notes": "Flagged at bay 2"
}{
"id": "req_1795300200",
"workspace_id": "ws_acme",
"product_id": "bin_bolt_m8",
"quantity": 20,
"status": 1,
"notes": "Below par on North Aisle 1",
"created_at": 1795300200
}POST/api/v1/requests/{id}/approveApprove request and generate fulfillment cart linkrequests:write
id(path, required, string)
curl -X POST "https://snappar.app/api/v1/requests/bin_bolt_m8/approve" \
-H "X-API-Key: sk_live_your_key"{
"request": {
"id": "req_1795300200",
"status": 2
},
"cart_link": "https://www.mcmaster.com/91287A142"
}POST/api/v1/requests/{id}/denyDecline reorder requestrequests:write
id(path, required, string)
curl -X POST "https://snappar.app/api/v1/requests/bin_bolt_m8/deny" \
-H "X-API-Key: sk_live_your_key"{
"request": {
"id": "req_1795300200",
"status": 4
},
"status": "declined"
}POST/api/v1/requests/{id}/receiveMark request received and restock target binrequests:write
id(path, required, string)
curl -X POST "https://snappar.app/api/v1/requests/bin_bolt_m8/receive" \
-H "X-API-Key: sk_live_your_key"PATCH/api/v1/requests/{id}/external-poAttach ERP PO number and optionally mark ORDEREDrequests:write
id(path, required, string)
curl -X PATCH "https://snappar.app/api/v1/requests/bin_bolt_m8/external-po" \
-H "X-API-Key: sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"po_number":"ERP-PO-4490","vendor":"McMaster-Carr","mark_ordered":true}'{
"po_number": "ERP-PO-4490",
"vendor": "McMaster-Carr",
"mark_ordered": true
}{
"request": {
"id": "req_1795300200",
"status": 3,
"notes": "[PO: ERP-PO-4490 · McMaster-Carr]"
}
}IoT Telemetry & Receiving
Idempotent sensor/PLC readings and supplier Advanced Shipping Notice (ASN) ingestion.
POST/api/v1/telemetry/binsBatch ingest IoT scale/RFID/PLC telemetry with idempotencybins:write
Ingests measured quantities or fill statuses from shop-floor scales, RFID gates, or PLCs with per-workspace idempotency deduplication.
curl -X POST "https://snappar.app/api/v1/telemetry/bins" \
-H "X-API-Key: sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"readings":[{"bin_id":"A01-B02-04","measured_qty":3,"sensor_id":"scale-bay2","idempotency_key":"scale-bay2-1795300120"}]}'{
"readings": [
{
"bin_id": "A01-B02-04",
"measured_qty": 3,
"sensor_id": "scale-bay2",
"idempotency_key": "scale-bay2-1795300120"
}
]
}{
"processed": 1,
"deduplicated": 0
}POST/api/v1/orgs/{orgId}/receiving/asnIngest supplier Advanced Shipping Notice & tracking numbersbins:write
Attaches carrier tracking numbers to one or more matching bins, logs an audit entry, and emits a `shipment.tracked` webhook.
orgId(path, required, string)
curl -X POST "https://snappar.app/api/v1/orgs/ws_acme/receiving/asn" \
-H "X-API-Key: sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"tracking_number":"1Z999AA10123456784","po_number":"PO-2026-8841","items":[{"bin_qr_id":"A01-B02-04"}]}'{
"tracking_number": "1Z999AA10123456784",
"po_number": "PO-2026-8841",
"items": [
{
"bin_qr_id": "A01-B02-04"
}
]
}{
"matched_bin_ids": [
"bin_bolt_m8"
],
"tracking": [
"1Z999AA10123456784"
],
"unmatched": []
}Spatial Warehouse
Hierarchical facility tree, live bay stockout rollups, and dock-anchored walk sequences.
GET/api/v1/orgs/{orgId}/locations/treeFetch hierarchical warehouse tree & 2D floor planlocations:read
orgId(path, required, string)
curl -X GET "https://snappar.app/api/v1/orgs/ws_acme/locations/tree" \
-H "X-API-Key: sk_live_your_key"{
"tree_version": 4,
"roots": {
"site_north": {
"id": "site_north",
"name": "North Plant",
"type": "site"
}
}
}GET/api/v1/orgs/{orgId}/locations/{siteId}/healthLive bay & aisle stockout rollup for a warehouse sitelocations:read
orgId(path, required, string)siteId(path, required, string)
curl -X GET "https://snappar.app/api/v1/orgs/ws_acme/locations/site_north/health" \
-H "X-API-Key: sk_live_your_key"{
"site_id": "site_north",
"summary": {
"OUT": 1,
"LOW": 2,
"TRANSIT": 1,
"OK": 8,
"EMPTY": 0
},
"bays": [
{
"bay_id": "bay_2",
"bay_name": "Bay 2",
"short_code": "B02",
"aisle_name": "Aisle 1",
"status": "OUT",
"bin_count": 6,
"deficit_qty": 24
}
]
}GET/api/v1/orgs/{orgId}/locations/{siteId}/walk-orderOrdered spatial walk-path sequence anchored to dock/doorlocations:read
orgId(path, required, string)siteId(path, required, string)
curl -X GET "https://snappar.app/api/v1/orgs/ws_acme/locations/site_north/walk-order" \
-H "X-API-Key: sk_live_your_key"{
"site_id": "site_north",
"walk_order": [
"bay_1",
"bay_2",
"bay_5"
],
"count": 3
}Compliance & Audit
Immutable bin, workflow, and machine-token traceability records in JSON or formula-safe CSV.
GET/api/v1/audit-logsQuery paginated bin traceability audit logs (JSON or CSV)audit:read
bin_id(query, string)workflow(query, string)actor(query, string)q(query, string)from(query, integer)to(query, integer)limit(query, integer)offset(query, integer)format(query, string)
curl -X GET "https://snappar.app/api/v1/audit-logs" \
-H "X-API-Key: sk_live_your_key"{
"entries": [
{
"id": "aud_1795300120",
"workflow": "bulk_stock_sync",
"action": "updated",
"actor": "API Key: NetSuite ERP"
}
],
"total": 1,
"count": 1
}GET/api/v1/openapi.jsonFetch public OpenAPI 3.1 contractpublic
curl -X GET "https://snappar.app/api/v1/openapi.json"Outbound Webhooks
HMAC-SHA256 signed event endpoint subscriptions, synchronous ping tests, and delivery logs.
GET/api/v1/webhooks/endpointsList outbound webhook subscriptionswebhooks:manage
curl -X GET "https://snappar.app/api/v1/webhooks/endpoints" \
-H "X-API-Key: sk_live_your_key"{
"endpoints": [
{
"id": "wh_1795300400",
"url": "https://erp.acme.com/hooks/snappar",
"events": [
"bin.stock_out"
]
}
],
"count": 1
}POST/api/v1/webhooks/endpointsRegister HTTPS webhook endpoint & receive whsec_ secretwebhooks:manage
Validates URL against HTTPS and SSRF rules (blocking internal/metadata IPs) and returns the HMAC signing secret once.
curl -X POST "https://snappar.app/api/v1/webhooks/endpoints" \
-H "X-API-Key: sk_live_your_key" \
-H "Content-Type: application/json" \
-d '{"url":"https://erp.acme.com/hooks/snappar","description":"SAP Purchasing Bus","events":["bin.stock_out","bin.stock_low","request.created"]}'{
"url": "https://erp.acme.com/hooks/snappar",
"description": "SAP Purchasing Bus",
"events": [
"bin.stock_out",
"bin.stock_low",
"request.created"
]
}{
"endpoint": {
"id": "wh_1795300400",
"secret_prefix": "whsec_98ab12cd"
},
"signing_secret": "whsec_98ab12cd..."
}DELETE/api/v1/webhooks/endpoints/{id}Delete webhook endpointwebhooks:manage
id(path, required, string)
curl -X DELETE "https://snappar.app/api/v1/webhooks/endpoints/bin_bolt_m8" \
-H "X-API-Key: sk_live_your_key"{
"deleted": true,
"id": "wh_1795300400"
}POST/api/v1/webhooks/endpoints/{id}/testSend synchronous HMAC-signed webhook.test payloadwebhooks:manage
id(path, required, string)
curl -X POST "https://snappar.app/api/v1/webhooks/endpoints/bin_bolt_m8/test" \
-H "X-API-Key: sk_live_your_key"{
"delivery": {
"id": "dlv_1795300500",
"event": "webhook.test",
"status_code": 200,
"success": true
}
}GET/api/v1/webhooks/deliveriesInspect recent webhook delivery attemptswebhooks:manage
endpoint_id(query, string)limit(query, integer)
curl -X GET "https://snappar.app/api/v1/webhooks/deliveries" \
-H "X-API-Key: sk_live_your_key"{
"deliveries": [
{
"id": "dlv_1795300500",
"event": "webhook.test",
"status_code": 200,
"success": true
}
],
"count": 1
}API Keys (Session Only)
Interactive Admin session endpoints for minting, rotating, and revoking sk_live_ tokens.
GET/api/v1/api-keysList Enterprise API keys (Admin session)session:admin
Requires an interactive Admin browser/user session (`403 SESSION_AUTH_REQUIRED` if called with `X-API-Key`).
curl -X GET "https://snappar.app/api/v1/api-keys" \
-H "Authorization: Bearer $ADMIN_SESSION_TOKEN"{
"api_keys": [
{
"id": "key_1795300300",
"name": "NetSuite ERP",
"prefix": "sk_live_4a9c2f10",
"active": true
}
],
"count": 1
}{
"error": "API key missing required scope: bins:write",
"code": "INSUFFICIENT_SCOPE"
}POST/api/v1/api-keysCreate scoped sk_live_ API key (Admin session)session:admin
curl -X POST "https://snappar.app/api/v1/api-keys" \
-H "Authorization: Bearer $ADMIN_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"NetSuite ERP","role":"Admin","scopes":["bins:read","bins:write","requests:read"],"expires_in_days":90}'{
"name": "NetSuite ERP",
"role": "Admin",
"scopes": [
"bins:read",
"bins:write",
"requests:read"
],
"expires_in_days": 90
}{
"api_key": {
"id": "key_1795300300",
"prefix": "sk_live_4a9c2f10"
},
"plaintext_key": "sk_live_4a9c2f10..."
}POST/api/v1/api-keys/{id}/rotateRotate active API key secret (Admin session)session:admin
id(path, required, string)
curl -X POST "https://snappar.app/api/v1/api-keys/bin_bolt_m8/rotate" \
-H "Authorization: Bearer $ADMIN_SESSION_TOKEN"DELETE/api/v1/api-keys/{id}Revoke API key (Admin session)session:admin
id(path, required, string)
curl -X DELETE "https://snappar.app/api/v1/api-keys/bin_bolt_m8" \
-H "Authorization: Bearer $ADMIN_SESSION_TOKEN"{
"revoked": true,
"api_key": {
"id": "key_1795300300",
"active": false
}
}Signed Outbound Webhooks
Subscribe HTTPS endpoints to live warehouse stockouts, reorder approvals, and supplier ASN shipments. Every delivery includes X-SnapPar-Event, X-SnapPar-Delivery, andX-SnapPar-Signature: t=<unix>,v1=<hmac_sha256_hex> signed with yourwhsec_... secret.
Production and staging enforce HTTPS endpoints, reject embedded credentials, private/CGNAT/ULA/link-local/metadata IPs (at registration and DNS dial time), and disable HTTP redirects.
Compute HMAC-SHA256 over {timestamp}.{raw_json_body} using your UTF-8 signing secret, compare with constant-time equality, and reject timestamps older than 300 seconds.
| Event | Trigger | Key Data Fields |
|---|---|---|
| bin.stock_out | Bin drops to 0 stock via scan, telemetry, or bulk sync | bin_id, bin_qr_id, title, workflow, current_stock, par_level |
| bin.stock_low | Bin transitions into LOW state at or below par level | bin_id, bin_qr_id, title, workflow, current_stock, par_level |
| bin.restocked | Bin returns to OK above par via restock or bulk sync | bin_id, bin_qr_id, title, workflow, current_stock, par_level |
| bin.supplier_swapped | Primary/fallback vendor redirect target switched for bin | bin_id, bin_qr_id, active_vendor_target, active_url |
| request.created | New replenishment request queued by worker or sensor | request_id, product_id, quantity, requester |
| request.approved | Manager or Admin approves a replenishment request | request_id, product_id, quantity |
| request.denied | Manager or Admin declines a replenishment request | request_id, product_id, quantity |
| request.received | Ordered request marked received and bin stock incremented | request_id, product_id, quantity |
| shipment.tracked | Supplier ASN ingests carrier tracking numbers for bins | bin_ids, tracking_numbers, po_number, note |
| webhook.test | Manual synchronous verification ping from Admin or API | message |
Webhook Payload Envelope
{
"id": "dlv_1795300500",
"event": "bin.stock_out",
"workspace_id": "ws_acme",
"timestamp": 1795300500,
"data": {
"bin_id": "bin_bolt_m8",
"bin_qr_id": "A01-B02-04",
"title": "M8x25 Stainless Hex Bolt (50pk)",
"workflow": "sensor_webhook",
"status": "OUT",
"current_stock": 0,
"par_level": 20
}
}Verify X-SnapPar-Signature
import crypto from 'node:crypto';
export function verifySnapParSignature(rawBody, headerValue, secret, maxAgeSec = 300) {
const parts = Object.fromEntries(headerValue.split(',').map(p => p.split('=')));
const ts = Number(parts.t);
if (!ts || Math.abs(Math.floor(Date.now() / 1000) - ts) > maxAgeSec) return false;
const expected = crypto.createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex');
return parts.v1?.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(parts.v1, 'utf8'), Buffer.from(expected, 'utf8'));
}import hashlib, hmac, time
def verify_snappar_signature(raw_body: bytes, header_value: str, secret: str, max_age_sec: int = 300) -> bool:
parts = dict(item.split("=", 1) for item in header_value.split(",") if "=" in item)
ts = int(parts.get("t", "0"))
if abs(int(time.time()) - ts) > max_age_sec:
return False
signed = f"{ts}.".encode() + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(parts.get("v1", ""), expected)func VerifySnapParSignature(rawBody []byte, header, secret string) bool {
var ts, sig string
for _, part := range strings.Split(header, ",") {
if k, v, ok := strings.Cut(strings.TrimSpace(part), "="); ok {
if k == "t" { ts = v } else if k == "v1" { sig = v }
}
}
unixTS, err := strconv.ParseInt(ts, 10, 64)
if err != nil || math.Abs(float64(time.Now().Unix()-unixTS)) > 300 { return false }
mac := hmac.New(sha256.New, []byte(secret))
_, _ = fmt.Fprintf(mac, "%d.", unixTS)
mac.Write(rawBody)
return hmac.Equal([]byte(sig), []byte(hex.EncodeToString(mac.Sum(nil))))
}Ready to connect your ERP or shop-floor sensors?
Start a 14-day Enterprise Fleet trial in Admin Settings to mint scoped sk_live_ keys and register signed webhooks.