API Link template

Copy a Node HMAC signing example for API-triggered link fetch jobs.

External systems should not create link resolution work through anonymous webhooks. This template signs the payload with timestamp and nonce headers, includes an idempotency key, and posts a controlled job into an API Link endpoint.

Direct answer

How should an API Link request be signed?

An API Link request should include a timestamp, nonce, API key, idempotency key, JSON payload, and an HMAC signature over the timestamp, nonce, and body so the relay can reject stale, replayed, or tampered requests.

Copyable artifact

Copy the Node signing skeleton.

Replace the endpoint, API key, secret, and payload fields with your account values. Use a unique idempotency key per logical job so retries stay predictable.

javascript Node HMAC signing example
import crypto from "node:crypto";

const API_KEY = "lp_live_example";
const API_SECRET = "replace-with-api-link-secret";
const endpoint = "https://your-link-peeler.example/api/links/fetch";

const payload = {
  idempotencyKey: "offer-001-2026-05-26",
  trackingUrl: "https://trk.example/a1",
  source: "platform_api",
  rowId: "offer-001"
};

const timestamp = Math.floor(Date.now() / 1000).toString();
const nonce = crypto.randomUUID();
const body = JSON.stringify(payload);
const signingBase = [timestamp, nonce, body].join(".");

const signature = crypto
  .createHmac("sha256", API_SECRET)
  .update(signingBase)
  .digest("hex");

const response = await fetch(endpoint, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Link-Peeler-Key": API_KEY,
    "X-Link-Peeler-Timestamp": timestamp,
    "X-Link-Peeler-Nonce": nonce,
    "X-Link-Peeler-Signature": signature
  },
  body
});

if (!response.ok) {
  throw new Error(await response.text());
}

console.log(await response.json());
Implementation steps

Keep the request strict before it creates work.

The example is intentionally explicit about signing inputs because that boundary is where generic webhook examples usually become unsafe.

01

Build payload

Include the tracking URL, source, row identity, and idempotency key for the logical job.

02

Add replay controls

Generate a current timestamp and one-time nonce for every request.

03

Sign exact bytes

Sign the timestamp, nonce, and JSON body that the server will verify.

04

Queue work

Let the relay validate, gate quota, and create a task for desktop pickup.

05

Consume result state

Read the resulting final URL and conclusion from the active data channel.

Internal links

Related operating pages

Templates work best when they are connected to the guide, integration, and tool pages that explain the surrounding workflow.

R1

API Links integration

See how signed external systems connect to desktop-executed link work.

R2

Signed API link fetch workflow

Read the lifecycle behind HMAC, nonce, idempotency, queueing, and desktop pull.

R3

Security

Review the public security model for API signing and desktop boundaries.

Template FAQ

Questions about API Link signing.

Why sign timestamp, nonce, and body together?

The server needs to know the payload was not tampered with and that replay controls belong to the exact request body.

What should idempotencyKey contain?

Use a stable identifier for the logical job, such as source row ID plus intended run date or external event ID.

Can this run from a scheduled worker?

Yes. Scheduled workers, internal tools, and scripts can use the same signing pattern to create controlled link fetch jobs.

Does this call the desktop directly?

No. The request creates cloud-side work that a linked desktop retrieves through outbound polling.