Concepts

Authentication

Every request to /api/v1/* is authenticated with an API key plus an HMAC-SHA256 signature over the request body.

Overview

CallNode uses paired credentials — a public API key (shown to you in the dashboard) and a private API secret (shown exactly once at creation time). The key identifies which account is making the request; the secret signs the request body so we can detect tampering and replays.

Secrets are shown once
When you create or rotate an API key, the dashboard displays the plaintext secret exactly once. Save it to a password manager or secure secret store immediately. If you lose it, rotate the key.

Required headers

Every request to /api/v1/* requires the following four headers:

HeaderRequiredPurpose
X-Api-KeyRequiredYour API key.
X-TimestampRequiredUnix seconds. Must be within ±300s of server clock.
X-SignatureRequiredHex-encoded HMAC-SHA256(secret, timestamp + "\n" + body).
X-Idempotency-KeyRequiredUUID. Replays within 5 minutes return the original response.
Content-TypeRequiredapplication/json

Computing the signature

The signature is an HMAC-SHA256 over the request timestamp, a literal newline (\n), and the exact JSON body bytes you send on the wire. Any change to the body — whitespace, key order, escaping — invalidates the signature.

sign.jsJavaScript
const crypto = require('crypto');

const ts = Math.floor(Date.now() / 1000).toString();
const body = JSON.stringify(payload);          // canonical bytes you send
const sig = crypto.createHmac('sha256', apiSecret)
                  .update(ts + '\n' + body)
                  .digest('hex');

// headers
const headers = {
  'X-Api-Key':         apiKey,
  'X-Timestamp':       ts,
  'X-Signature':       sig,
  'X-Idempotency-Key': crypto.randomUUID(),
  'Content-Type':      'application/json'
};
Sign exactly what you send
Compute the signature on the same string you place in the request body. If you callJSON.stringify(payload) twice with different libraries you may get different bytes (different key orders, different whitespace). Build the string once, then use the same variable for both the signature and the body.

Clock skew tolerance

The server accepts timestamps within ±300 secondsof its current clock. If your timestamp is outside that window you'll receive:

HTTPErrorBehavior
401clock_skewResponse includes X-Server-Time header so the client can self-correct and retry.

Idempotency

Every call to POST /api/v1/outbound/calls requires anX-Idempotency-Key header containing a UUID you generate. If we see the same key from the same account again within 5 minutes, we return the original response instead of placing a duplicate call.

Replay response

Idempotency replays return HTTP 200 OK (not 202 Accepted) and include the original call's current state, plus an idempotencyReplay: true flag.

JSON
{
  "callId":           "cn-ob-7f3a18a2-9b40-4e1e-9c4e-1b8b9b8e6b3a",
  "status":           "answered",
  "idempotencyReplay": true,
  "createdAt":        "2026-05-24T17:31:08.421Z"
}

Secret rotation

When you rotate a key's secret from the dashboard, the previous secret remains valid for 24 hours. During that window, requests signed with either secret are accepted. After 24 hours, only the new secret is valid.

This dual-secret window lets you:

  • Rotate keys without downtime.
  • Deploy the new secret to your application without a hard cutover.
  • Confirm the new secret works in production before the old one expires.

Environments

The key prefix indicates which environment a key belongs to:

PrefixEnvironmentBehavior
cn_live_liveReal outbound calls and messages. Real billing. Real concurrency cap.
cn_test_testSimulated calls and messages: nothing reaches a carrier, no billing. See Test Mode.