Skip to main content

Overview

Niobi supports two methods for generating request signatures:
  1. In Code (Custom Implementation): Run our deterministic SHA-256 signing algorithm directly on your backend server. Recommended for production.
  2. Via the Niobi Signature Generation API (POST /api/niobi-signature): Call Niobi’s helper endpoint to automatically compute and return the signed payload.
Important: params contains whatever the destination endpoint requires
In both methods, the inner "params": { ... } object is dynamic. It is not limited to a fixed set of fields; it must contain whatever specific parameters are required by the target API endpoint you are invoking (e.g., Collections parameters for collections or Payout parameters for disbursements).

Method 1: The Request Signing Algorithm (In Code)

For production environments where you want to minimize network latency and generate signatures entirely within your backend infrastructure, implement the following 10-step algorithm:
  1. Obtain Credentials: Log into your Niobi Dashboard, navigate to Workspace -> Integrations, and create an integration entity. Note your client_id, sender (integration title), and senderKey (Secret Key).
  2. Assemble the Pre-Signing Object: Create a JSON object containing your target endpoint parameters inside a nested params object, along with your metadata fields:
  3. Add a Salt (salt): Provide your own random string (for example, 16 to 32 alphanumeric characters). This is not provided by Niobi; it is an additional security and entropy layer you control on your server to guarantee that every payment request produces a unique signature.
  4. Include Client ID & Secret Key: Set "client_id" with your integration’s Client ID. Temporarily add your private Secret Key as "senderKey".
  5. Add Integration Title (sender): Pass the exact integration name registered in your dashboard as "sender".
  6. Sort Alphabetically (Recursive K-Sort): Sort all keys alphabetically in ascending order, applying the sort recursively for nested objects (such as params).
  7. Stringify Key-Value Pairs: Convert the sorted structure into a single string formatted as key=value, concatenated with &. Nested properties are represented using dot notation (e.g. params.amount=10000).
    Important URL Formatting: The callback_url (or client_callback_url) must not be URL-encoded in the stringified hash representation. For example: ...&params.callback_url=https://yourdomain.com/niobi/callback&...
  8. Hash the String with SHA-256: Apply the SHA-256 hashing algorithm to the concatenated string. This produces a 64-character hexadecimal hash string.
  9. Attach the Signature: Insert the resulting hash into the root JSON object as the "signature" field.
  10. Remove the Secret Key (senderKey): Delete the "senderKey" field from the payload completely before dispatching the request over the network.
Watch Out for Whitespace & Trailing Spaces:
Ensure that your credentials (client_id, senderKey, sender) and string parameter values do not contain inadvertent leading or trailing whitespace, newlines, or extra spaces. A single accidental trailing space when copying a key will alter the computed hash and cause your request to fail with a 403 Request was not verified error. We recommend trimming all string values before hashing.

Detailed Payload Walkthrough

1. Before Signing (Pre-Signature Payload)

2. Flattened, Sorted and Stringified Format

3. Final Signed Request Payload (Ready to Send to the Matching API Endpoint)


Implementation Code Examples


Method 2: Generating Signatures via the Niobi Signature Generation API

If you prefer not to write custom cryptographic sorting and hashing functions, or if you want to quickly test requests in Postman or Sandbox, Niobi provides a dedicated Signature Generation endpoint: Endpoint: POST /api/niobi-signature

Step 1: Send Your Request Parameters to the Signature Endpoint

Construct a request containing the following fields:

Step 2: Receive the Complete Signed Payload

Niobi validates your client_id, calculates the SHA-256 signature using your account’s registered Secret Key, and returns the full signed envelope inside the data object:

Step 3: Pass the Signed Payload to the Target API

You can now take the exact JSON object inside data and send it directly to your target endpoint (e.g. POST /api/v4/niobi-unified-collections or POST /api/v4/niobi-unified-payments) without changing or modifying anything as it is.
Do Not Modify the Returned Payload:
You must transmit the JSON object inside data exactly as returned, without adding, altering, or removing any fields. Any modification to parameters or values after generation will invalidate the signature and cause the target endpoint to reject your request with a 403 Request was not verified error.

Verifying Response & Webhook Signatures

When receiving a synchronous response or asynchronous webhook callback from Niobi, you can verify its authenticity using either code or the Verification API:

1. In Code (5 Steps):

  1. Extract Signature: Store the "signature" field from the incoming JSON and remove it from the object.
  2. Add Secret Key: Add "senderKey": "your_secret_key_here" into the object.
  3. Sort and Stringify: Alphabetically sort keys recursively (K-sort) and format into key=value concatenated with &.
  4. Compute SHA-256 Hash: Hash the string with SHA-256.
  5. Compare Signatures: Compare your computed hash with the signature received in Step 1.

2. Via the Verification Helper API:

Send the payload to POST /api/niobi-verify:

Next Steps

Now that you can generate valid signatures, proceed to construct the signed request envelope:
Step 2

How to Pass Signature in API Requests

Learn how to structure the final signed envelope, set required headers, and avoid common 403 errors.

Integration

Start Collecting Payments

Send signed requests to the unified collection API to accept customer payments.