Authentication
Before get started
Please check you have Access Key and Secret Key. If you don't have these keys, please contact Cabital service consultant.
Cabital Connect API uses signature authorization to validate the API request. The process of generating signature authorization is as follows:
- Add authentication parameters in request header:
ACCESS-KEY,ACCESS-TIMESTAMP,ACCESS-NONCE - Use the parameters from step 1 to compose the signature string
- Use
Secret Keyto encrypt the signature string - Use the encrypt result from step 3 as the value of parameter
ACCESS-SIGN, and add it to the request header - Request APIs with these parameters in the header:
ACCESS-KEY,ACCESS-TIMESTAMP,ACCESS-NONCE,ACCESS-SIGN
Be careful
- DO NOT share the
Secret Key, otherwise, it will cause information leakage and unpredictable loss of transaction. - If you encounter any problems with authentication, please contact Cabital service consultant and update the
Secret Keyimmediately.
Step 1: Add authentication parameters in request header¶
| Parameter | Description |
|---|---|
ACCESS-KEY |
Partner's Access Key |
ACCESS-TIMESTAMP |
Request timestamp, it must be within 30 seconds of the actual time of the request. Otherwise, it will be considered expired and the request will be rejected. |
ACCESS-NONCE |
The unique value (number or string) in every request. Only the first request will be processed with the same ACCESS-NONCE within 60 minutes. |
Step 2: Compose the signature string¶
StringToSign =
AccessTimestamp + \n +
RequestMethod + \n +
AccessNonce + \n +
RequestPath + \n +
RequestBody
| Parameter | Description |
|---|---|
AccessTimestamp |
As same as the header parameter ACCESS-TIMESTAMP |
RequestMethod |
Request method, should be upper case, e.g: GET, POST, PUT |
AccessNonce |
As same as the header parameter ACCESS-NONCE |
RequestPath |
Request path, exclude hostname but include query parameters e.g. /api/v1/accounts/6d92e7b4-715c-4ce3-a028-19f1c8c9fa6c/transfers?direction=CREDIT&has_conversion=true |
RequestBody |
Request body
|
Step 3: Encrypt the signature string¶
Encrypt the signature string with Secret Key by HMAC-SHA256, and encode the result in Base64 format.
You can validate the encryption result by using this online tool.
Step 4: Add encrypt result in request header¶
Use the encrypt result from step 3 as the value of parameter ACCESS-SIGN, and add it to the request header. The complete request header parameters as follows:
ACCESS-KEYACCESS-TIMESTAMPACCESS-NONCEACCESS-SIGN
Examples¶
Partner's information
Access Keyisb40b978e-ee0c-11ec-8573-0a3898443cb8Secret Keyis123(this is a sample, not a real secret key)
Example 1: GET Request¶
Take List all transfers by partner's account ID for example.
| Parameter | Description |
|---|---|
| Request URL | GET https://connect.cabital.com/api/v1/userextref/latibac_user_1656053354/transfers?direction=CREDIT&symbol=USDT&created_from=1633445160 |
| Request timestamp | 1660017228 |
| Request unique value | 1660017228636 |
- Compose signature string
- Encrypt the signature string, the result is
- The complete request as follows:
curl 'https://connect.cabital.com/api/v1/userextref/latibac_user_1656053354/transfers?direction=CREDIT&symbol=USDT&created_from=1633445160' \ --header 'ACCESS-KEY: b40b978e-ee0c-11ec-8573-0a3898443cb8' \ --header 'ACCESS-SIGN: cfa1WY0a5KcVM+NXUDqE1QVBJgO8euOUx59UVhwU6Zs=' \ --header 'ACCESS-TIMESTAMP: 1660017228' \ --header 'ACCESS-NONCE: 1660017228636'
Example 2: PUT Request¶
Take KYC Match API for example.
| Parameter | Description |
|---|---|
| Request URL | PUT https://connect.cabital.com/api/v1/accounts/bf07fe96-2b05-4281-94ad-4fe39394e707/match |
| Request timestamp | 1660025004 |
| Request unique value | 1660025004705 |
- Compose signature string
- Encrypt the signature string, the result is
- The complete request as follows:
curl -X PUT 'https://connect.cabital.com/api/v1/accounts/bf07fe96-2b05-4281-94ad-4fe39394e707/match' -d '{ "name": "John Doe", "id": "880730123", "id_document": "PASSPORT", "dob": "1985-11-05", "issued_by": "TWN" }' --header 'ACCESS-KEY: b40b978e-ee0c-11ec-8573-0a3898443cb8' \ --header 'ACCESS-SIGN: dtiC01bc8S/s2IoH1Rq6WrgNIwrKuE4wgxkyP8Cf9+c=' \ --header 'ACCESS-TIMESTAMP: 1660025004' \ --header 'ACCESS-NONCE: 1660025004705'