General API changes

This section contains a description of the changes that apply to requests in Calypso API 2.0

Signing requests changes

All the requests should now include the obligatory POST parameter timestamp instead of nonce parameter that has been used earlier.

timestamp represents current unix UTC timestamp in milliseconds. The value must not be less than 3 minutes in the past and not greater than 3 minutes in the future.

To create the sign:

  1. Build the body of the request with correct timestamp (instead of nonce)
  2. Encrypt the request body with method HMAC-SHA512 using the body as a message and the secret key as a key.
  3. Convert bytes to string of hexadecimal digits.

Examples of timestamp building:

  • Javascript
var timestamp = new Date().getTime();
  • Python
import time

timestamp = round(time.time() * 1000)

The signing itself has not undergone any changes. You can find detailed tutorial here.

New request parameter

Most of the requests should now also include the obligatory POST parameter account which represents the account in which you want to request or change data.

Please contact Technical Support to find the list of available to you accounts.

New request specific data parameter name

The request specific data should now be included in payload parameter instead of request.

For example:

  • Calypso 1.0 request
curl --location --request POST '<<baseUrl>>/api/v1/invoice/single/create' \
--header 'Key: <your_api_key>' \
--header 'Sign: <your_sign>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "nonce": 13292792792,
  "request": {
    ...
  }
}'
  • Calypso 2.0 request
curl --location --request POST '<<baseUrl2>>/api/v1/pub/invoice/create' \
--header 'Key: <your_api_key>' \
--header 'Sign: <your_sign>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "timestamp": 13292792792,
  "account": "0xc195df92dd9db2a8f28e597981f113d6e7582f8b",
  "payload": {
    ...
  }
}'