Overview
Below is a brief overview of how to make API calls:- Send your IP address to our support team via email
- Create the JWT token according to our specification
- Generate the bodyhash by taking the JWT token and hashing it with SHA256 using the API Secret
- Sign JWTs with the Private Key
- Make the API call
1. Send Your IP Address
Send your IP address to our support team via email (support@mansa.com).This step is required before you can make any API calls. Your IP address must be whitelisted for security purposes.
2. Create the JWT Token
The JWT should be structured as follows:Details to generate the bodyhash can be found in the next subsection.
3. Generate the Bodyhash Signature
To generate the Bodyhash that needs to be included in the JWT token, use the following approach:- API_SECRET_PROVIDED_BY_US: The API Secret provided by Mansa
- jwt.uri: The URI of the API endpoint you’re calling
- requestBody: The serialized JSON string representing the request payload (request body) of your API call
- jwt.nbf: The “Not Before” claim in the JWT, representing the time before which the JWT must not be accepted for processing
- hashlib.sha512: The SHA-512 hashing algorithm
Ensure that you use the correct libraries and methods for your programming language to achieve the desired result.
4. Sign the JWT Token with the Private Key
The JWT must be signed with an Elliptic Curve Digital Signature Algorithm (ECDSA) using the P-256 curve and the SHA-256 hash algorithm (‘ES256’).5. Make an API Call
Every API request must include the following headers:- X-API-Key: The API Key provided to you by Mansa
- Authorization: Its value should be set to Bearer, followed by a space and the access token, which is a Base64-encoded JWT
These headers should be included in each API call to authenticate and authorize your requests.
API Call Rate Limit
The API implements request limits to encourage fair distribution of resources and to uphold system stability. We have established usage guidelines which dictate that a single business is limited to a certain number of requests per minute. If your needs deviate from these constraints, we encourage you to reach out to us. Our team is more than ready to engage in discussions about alternative arrangements that may be more suited to your specific requirements.Example Implementation
Here’s a complete example of how to implement the authentication process:This is a simplified example. In production, you’ll need to properly sign the JWT with your private key and handle all error cases.