NEDApayDevelopersConnect API · v1
Build

Sign every request

Each request carries four headers. The signature proves the request came from you, was made just now, and was not changed on the way.

The four headers

HeaderValue
X-Connect-KeyYour key, for example nc_test_…
X-Connect-TimestampThe current time in Unix seconds. Refused if more than 5 minutes off.
X-Connect-Nonce16 to 64 random letters, digits, - or _. Never reuse one.
X-Connect-SignatureHex HMAC-SHA256, made with your secret, of the string below.

The string to sign

Five parts joined with dots:

timestamp . nonce . METHOD . path-with-query . sha256hex(raw request body, or empty)
  • path is exactly what you request, including the query: /v1/transactions?limit=20.
  • body is the exact JSON text you send. Sign the same bytes you put on the wire.

Example in Node

Node
import crypto from 'node:crypto';

function connectHeaders({ keyId, secret, method, path, body = '' }) {
  const timestamp = String(Math.floor(Date.now() / 1000));
  const nonce = crypto.randomBytes(16).toString('hex');
  const bodyHash = crypto.createHash('sha256').update(body).digest('hex');
  const signature = crypto
    .createHmac('sha256', secret)
    .update([timestamp, nonce, method.toUpperCase(), path, bodyHash].join('.'))
    .digest('hex');
  return {
    'X-Connect-Key': keyId,
    'X-Connect-Timestamp': timestamp,
    'X-Connect-Nonce': nonce,
    'X-Connect-Signature': signature,
  };
}
Retries need a fresh nonce. A nonce works once, so sign again with a new nonce and timestamp every time you retry a request.

Calls on behalf of a user

The read routes need the four signature headers plus the user's access token: Authorization: Bearer <access_token>.

When signing goes wrong

CodeStatusWhat to do
INVALID_CREDENTIALS401Unknown or revoked key, or the signature does not match. Check the string you sign.
TIMESTAMP_OUT_OF_RANGE401Check your server clock.
INVALID_NONCE, NONCE_REUSED401Use a fresh nonce for every request, including retries.
IP_NOT_ALLOWED403The call came from a server address that is not registered for you.