APIs for service integration
How to request for the services provided by InsurAce.io
InsurAce.io APIs currently supports the following services:
Get $INSUR token information
Retrieve product information
Buy cover
Cancel cover
More APIs will be added soon.
The APIs are documented using Swagger. For details, please check:
Access Key
Some APIs may require a key to access, here is a public shared key:
dRsOlTd0UDcMkcCtunc7exPLz3eVnwikjNV4sebGalfq1qWpEzECQg==
If you find any problems using the key, please contact the technical team via Telegram, Discord or email to [email protected] .
Get $INSUR token information
To get the total and circulating supply of $INSUR, you can call these APIs:
getCirculation : get the sum of $INSUR in circulation on different networks
getTotalAmount : get the sum of all $INSUR on different networks
Retrieve product information
To retrieve product information such as product price, capacity, protocol name and etc. (Access Key required)
getProductList : Return a list of all products covered with details such as product id, name, capacity, product price, etc.
getCurrencyList : Return a list of tokens that can be used to purchase the cover with details such as token name, contract address, etc.
getCoverPremiumV2 : Return the price for a cover.
Buy cover
The full sample code for buying cover using JS code can be found here
You can follow the instruction there to run the test code.
Below is a step-by-step illustration of the JS code:
Step 1: Configuration
Prior to calling the APIs, you need to configure the following parameters first, here is a sample code:
httpApiCode: API access keyproductIds: Can be more than 1 IDs, which can be retrieved from Product List or by callinggetProductListAPIcoverCurrency: token address can be retrieved by callinggetCurrencyListAPI
Step 2: Call function
To buy covers, you need to use the following functions:
getCoverPremium()
Get the price of the cover by calling getCoverPremium API with the parameters specified in Step 1 includes chain, productIds, coverDays, coverAmounts, coverCurrency, owner wallet address and referralCode.
confirmCoverPremium()
Confirm the price by calling confirmCoverPremiumAPI using the results getting from the above function as the parameter.
buyCover()
Buy the cover with the confirmed information above.
Once done, you can call those functions in sequence. Here is a sample code for you:
Cancel Cover
The full sample code for buying cover using JS code can be found here
You can follow the instruction there to run the test code.
Below is a step-by-step illustration of the JS code:
Step 1: Configuration
Prior to calling the APIs, you need to configure the following parameters first, here is a sample code:
Step 2: Call function
To cancel cover, you need to use the function below:
cancelCover()
Cancel the cover with the coverID set in step 1 above.
You can call the function using the sample below:
Last updated