Skip to main content

Authentication parameters

The Payward Services API uses HMAC signing. Every authenticated request must include the following headers:
  • API-Key HTTP header parameter: your public API key.
  • API-Nonce HTTP header parameter: monotonically increasing integer nonce.
  • API-Sign HTTP header parameter: HMAC-SHA512 signature of the request.

Setting the API-Key parameter

The value for the API-Key HTTP header parameter is your public API key. Contact your Payward account representative to obtain API credentials.
From your API key-pair, clearly identify which key is public and which key is private.
  • The public key is sent in the API-Key header parameter.
  • The private key is never sent, it is only used to encode the signature for API-Sign header parameter.

Setting the API-Nonce parameter

The value for the API-Nonce HTTP header parameter must be a monotonically increasing integer for the API key. Use a high-resolution timestamp, such as nanoseconds since the Unix epoch, unless your integration already has a stronger monotonic counter.

Setting the API-Sign parameter

The value for the API-Sign HTTP header parameter is an HMAC-SHA512 signature of the request, base64-encoded.

Algorithm steps

  1. Choose a nonce: generate a monotonically increasing integer.
  2. Build the nonce payload: concatenate the nonce and the exact request body bytes.
    • For requests without a body: use the nonce only.
    • For requests with a body: use the exact bytes you send on the wire.
  3. Hash the nonce payload: generate a SHA-256 digest.
  4. Build the message: concatenate the URL path, including query string, and the SHA-256 digest.
  5. Sign: generate HMAC-SHA512 over the message using your base64-decoded secret.
  6. Encode: base64-encode the signature.

Examples

The following code snippets demonstrate how to generate the signature in Python and JavaScript.

Complete request example

Here’s a complete example making an authenticated GET request to list assets.

Query parameters in signature

When your request includes query parameters, they must be included in the URL path used for signature generation. Use the exact same path string in both the signature and the request URL.

Request body in signature

For requests that send a body (POST, PUT), the body bytes used to compute the signature must match the bytes sent on the wire exactly. Differences in whitespace, key ordering, or encoding will produce a signature mismatch. The recommended pattern is to serialize the body once and reuse the same string for both signing and the HTTP request:

Troubleshooting