Skip to main content

PINGRAILS DEVELOPER REFERENCE · V1 API

Ping-Post API & Signed Webhooks

Integrate sub-80ms real-time auctions and constant-time HMAC-SHA256 outbound CRM webhooks with 7-attempt exponential retries and 1-click DLQ replay.

Test Live Direct Ingest
Section 1 · Publisher & Funnel Ingest API

Ping, Post & Direct Endpoints

POST/api/v1/ingest/ping
Authorization: Bearer pub_live_<token>

Step 1 of 2-phase RTB: submit anonymized lead attributes (zero PII). Returns the clearing bid and a 120-second pingId.

Request Body (JSON)
{
  "vertical": "INSURANCE",
  "serviceCode": "AUTO",
  "stateCode": "TX",
  "zipCode": "78701",
  "attributes": {
    "ownership": "own",
    "applicantAge": 34,
    "currentCarrier": "GEICO",
    "multiVehicle": true
  }
}
200 OK Responseapplication/json
{
  "status": "ACCEPTED",
  "pingId": "png_01j9a2k8f3d1",
  "clearingMode": "EXCLUSIVE",
  "bidCents": 2850,
  "buyerCount": 1,
  "expiresInSeconds": 120
}
Section 2 · Outbound HMAC-SHA256 Verification

Verifying X-PingRails-Signature

Every outbound lead webhook sent to your CRM includes an X-PingRails-Signature: t=<unix_ts>,v1=<hmac_sha256_hex> header signed over the exact string <t>.<rawBody> using your endpoint's secret. Reject any request older than ±300 seconds and compare digests in constant time.

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

export function verifyPingRailsSignature(
  rawBody: string,
  signatureHeader: string,
  signingSecret: string,
  toleranceSeconds = 300,
): boolean {
  const parts = Object.fromEntries(
    signatureHeader.split(',').map((kv) => kv.trim().split('=')),
  );
  const timestamp = Number.parseInt(parts.t ?? '', 10);
  const receivedV1 = parts.v1 ?? '';

  if (!Number.isFinite(timestamp) || !/^[a-f0-9]{64}$/i.test(receivedV1)) {
    return false;
  }

  // Enforce ±5 minute replay protection window
  const nowSeconds = Math.floor(Date.now() / 1000);
  if (Math.abs(nowSeconds - timestamp) > toleranceSeconds) {
    return false;
  }

  const expectedHex = createHmac('sha256', signingSecret)
    .update(`${timestamp}.${rawBody}`, 'utf8')
    .digest('hex');

  return timingSafeEqual(
    Buffer.from(expectedHex, 'hex'),
    Buffer.from(receivedV1.toLowerCase(), 'hex'),
  );
}
Interactive Web Crypto Tool

Live HMAC-SHA256 Signature Verifier

Test your webhook secret, raw JSON payload, and X-PingRails-Signature header locally in your browser via SubtleCrypto. Try editing one byte of the payload and re-verifying to see tamper detection fire immediately.

Verification Output
Click Generate Valid Header or Verify Signature to inspect HMAC computation.
Signed Message Format
1796253002.<329 UTF-8 bytes>
Computed Expected v1 Digest (SHA-256)
—
Always verify against the raw unparsed HTTP body. Re-serializing parsed JSON changes whitespace and invalidates the HMAC digest.

Delivery Retry Schedule & Dead-Letter Queue (DLQ)

Any non-2xx HTTP status or timeout (>10s) retries automatically across 7 exponential windows before archiving to DLQ for 1-click replay.

SSRF Guard Enforced
AttemptBackoff DelayCumulative WindowBehavior
Attempt 10ms (Immediate)T + 0sInitial real-time delivery post-COMMIT
Attempt 2+5 secondsT + 5sTransient network / 5xx retry
Attempt 3+30 secondsT + 35sCRM cold-start / burst retry
Attempt 4+2 minutesT + 2m 35sShort downstream deploy window
Attempt 5+10 minutesT + 12m 35sExtended outage backoff
Attempt 6+30 minutesT + 42m 35sExtended outage backoff
Attempt 7+2 hoursT + 2h 42mFinal automatic retry before DLQ
Dead-Letter QueueManual ReplayArchived1-click replay in /integrations portal (no re-charge)

Inbound CRM Disposition Sync (POST /api/v1/webhooks/inbound/[slug])

Push lead lifecycle updates (OPEN, CONTACTED, QUOTED, BOUND, DISPUTED) and closed revenue cents back from AgencyZoom, EZLynx, ServiceTitan, Jobber, HubSpot, or Salesforce to automatically update your PingRails Kanban board and ROI attribution.