This content applies to WaaS 1.0 only. We highly recommend that you upgrade to WaaS 2.0.
Introduction
This article explains how Coboâs WaaS Service authenticates API clients. If you are using one of the five WaaS SDKs provided by Cobo, you can skip this article because the SDKs already encapsulate the authentication mechanism for you. If you donât use the SDKs, you would have to implement the authentication by yourself, this article explains how. Cobo API Key authentication requires each request to be signed except public API interfaces. The data needs to be signed as the following:HTTP HOST
- Development: https://api.dev.cobo.com
- Production: https://api.cobo.com
HTTP_METHOD
Capitalized GET or POST. Please note: Cobo doesnât accept JSON payloads in HTTP POST. Please use form-data.HTTP_REQUEST_PATH
The PATH part of the URL request. For example: /v1/test/ in https://api.dev.cobo.com/v1/test/.NONCE
The UNIX EPOCH timestamp when calling the API is in milliseconds.PARAMS
If the parameters are:password=password
username=username
Because âpâ is sorted before âuâ in the alphabet, âpasswordâ should be placed before âusernameâ and then connected as
follows:
password=password&username=username
API parameters are key-value string pairs. Parameters need to be normalized before signing. The rule is as follows:
- Sort parameters by keys alphabetically.
- Transform each parameter to a string in the format of âkey=valueâ.
- Connect the strings with &.
Example
For the following requests:Method | URL | Nonce |
---|---|---|
POST | https://api.dev.cobo.com/v1/custody/test/ | 1537498830736 |
Parameter | Value |
---|---|
type | limit |
side | buy |
amount | 100.0 |
price | 100.0 |
symbol | btcusdt |
- BIZ-API-KEY This field contains the API key.
- BIZ-API-SIGNATURE This field contains the signature.
- BIZ-API-NONCE This field contains the nonce.
Create API key
To ensure secure access to your crypto assets under Cobo Custody via APIs, Cobo mandates the use of ECDSA signatures for authentication in all API calls. Access to the API is denied without proper authentication. Generate and manage API keys effortlessly using the Cobo-provided SDK (here). Hereâs a sample Python SDK:Python
api_secret is your private key and should be stored securely.api_key is your public key and needs to be set in your custody account.
Test API Key
Once youâve added your API key to your Custody account (see How to set API key on Custody in the quickstart section), we provide two methods to test whether your API key has been configured successfully. Test API key by SDKs:Python
View Response
View Response
Test API key by Playground: We also provide an exciting API interaction tool called Playground, which makes testing APIs a breeze. To learn how to use Playground, refer to the Interactive API Playground section.
SDKS
Feel free to share your feedback to improve our documentation!