API Authentication
This document describes the authentication mechanism for the CardsPro API using custom HTTP headers with SHA-256-based signatures.
Overview
The CardsPro API uses a signature-based authentication system that requires three custom HTTP headers on every request. This ensures that requests are authenticated and have not been tampered with in transit.
Required HTTP Headers
All API requests must include the following three headers:
CAP-TOKEN
Your API Key
CAP-NONCE
Current timestamp in milliseconds
CAP-SIGN
SHA-256 signature (see calculation below)
Authentication Process
1. Obtain API Credentials
You need two credentials to authenticate:
API Key: Your public identifier (sent as
CAP-TOKEN)Secret Key: Your private signing key (used to generate
CAP-SIGN, never sent directly)
2. Generate the Nonce
Create a nonce using the current timestamp in milliseconds:
const nonce = Date.now().toString();3. Calculate the Signature
The signature calculation differs based on the HTTP method:
For POST Requests
Components:
CAP-NONCE: The timestamp in millisecondsrequest_body: The JSON or form-encoded request body as a stringquery_string: The URL query parameters (e.g.,param1=value1¶m2=value2)secret: Your Secret Key
For GET Requests
Components:
CAP-NONCE: The timestamp in millisecondsquery_string: The URL query parameters (e.g.,param1=value1¶m2=value2)secret: Your Secret Key
Note: If there are no query parameters, use an empty string for query_string.
Complete Request Examples
POST Request with Query Parameters
Signature Calculation:
GET Request with Query Parameters
Signature Calculation:
Last updated