Introduction
Welcome to the Vauld Enterprise API's!

You can use our API to access our secure endpoints, which can help you create wallets for your users or create lending and borrowing orders without having to create a user/wallet. Welcome to the Vauld Enterprise API documentation! You can use our API to access secure endpoints, which can help you create wallets for your users and get access to our lending and borrowing functionalities. We have language bindings in JavaScript. You can view relevant code samples over to the right in the dedicated dark section as shown. You can switch the programming language of the examples shown with tabs displayed on the top-left corner of the region.
Getting Started
Base URL for testnet
https://apis.bankofhodlers.com


To get access to production URL's and API keys, contact us at partner@vauld.com. The testnet we use for ETH and ERC20 is kovan network.
For you to get started using testnet, test API key and organisationID are provided in each offered API type page's introduction.
For more reading on mainnets and testnets: Ethereum 101: Mainnet and testnets
Testnet and Mainnet addresses are different for some Blockchain Protocols, The appropriate documentation should reflect this when applicable.
Alright, if that's all good, let's get started!
Authentication
We use HMAC based authentication, for further reading on the protocol: HMAC documentation

To authenticate the APIs, we create an HMAC hash for the payload (in URI format) using the SHA-256 hashing algorithm using the provided APIKey as the seed. The HMAC hash generated is converted to it's Hex notation and is passed to the response body in the format mentioned below, with the headers set to

Content-Type: application/json.
hmac: _HMAC_Hash_asHex_
Replace   _HMAC_Hash_asHex_   with the hash as described above.
Replace   _Request_inJSON_   with the json payload (request body) required for the API endpoint.
Replace   _your_APIKey_ with the APIkey provided for your Organisation.
To authenticate, use this format:

# You can use any hmac library that supports SHA256 algorithm
# Illustrative code generate hmac for a payload

const CryptoJS = require('CryptoJS');

const jsonToURI = async (jsonObj) => {
var output = '';
var keys = Object.keys(jsonObj);
keys.forEach(function(key) {
output = output + key + '=' + jsonObj[key] + '&';
});
return output.slice(0, -1);
}

const payload = '_Request_inJSON_';
const secret = '_your_APIKey_' // make this your secret!!

let URIencodedPayload = jsonToURI(JSON.parse(payload));
let hmac = CryptoJS.HmacSHA256(URIencodedPayload, secret);
et hash = hmac.toString(CryptoJS.enc.Hex);
Introduction - APIs for INR FIAT Rails
These set of APIs are for enterprises looking to integrate FIAT rails in India. They provide the ability to create an INR wallet for users, deposit INR to the wallet, and buy and sell cryptocurrencies with the deposited INR amount. They allow users to deposit INR via Cards/UPI/NEFT/IMPS/RTGS, and to withdraw INR to any bank account in 1 business day.

This document outlines the details of the APIs used to:

1. Create a user account
2. Complete KYC for a user
3. Deposit and withdraw INR
4. Buy and sell crypto with INR
5. Withdraw Crypto

NOTE: Prerequisites for using the APIs

1. Contact hello@vauld.com for your API_KEY and orgID
2. Creating a user account is a mandatory prerequisite for all the other APIs
3. Completing their KYC is a mandatory prerequisite for INR deposits/withdrawals and INR Buy/Sell

Base URL:
https://api-dev.bankofhodlers.com/enterprise/api/v1/ (Development/Testing)
https://enterprise-api.bankofhodlers.com/enterprise/api/v1/ (Production)
Authentication
We use HMAC based authentication.

To authenticate the APIs, we create an HMAC hash for the payload (in URI format) using the SHA-256 hashing algorithm using the provided APIKey as the seed. The HMAC hash generated is converted to it's Hex notation and is passed to the response body in the format mentioned below, with the headers set to

Content-Type: application/json.
hmac: _HMAC_Hash_asHex_
Replace   _HMAC_Hash_asHex_   with the hash as described above.
Replace   _Request_inJSON_   with the json payload (request body) required for the API endpoint.
Replace   _your_APIKey_ with the APIkey provided for your Organisation.
To authenticate, use this format:

# You can use any hmac library that supports SHA256 algorithm
# Illustrative code generate hmac for a payload

const CryptoJS = require('CryptoJS');

const jsonToURI = async (jsonObj) => {
var output = '';
var keys = Object.keys(jsonObj);
keys.forEach(function(key) {
output = output + key + '=' + jsonObj[key] + '&';
});
return output.slice(0, -1);
}

const payload = '_Request_inJSON_';
const secret = '_your_APIKey_' // make this your secret!!

let URIencodedPayload = jsonToURI(JSON.parse(payload));
let hmac = CryptoJS.HmacSHA256(URIencodedPayload, secret);
et hash = hmac.toString(CryptoJS.enc.Hex);

pm.request.headers.add({
key: 'hmac',
value: hash
});
Note:
1. All token values in calls and responses will be in base value.
Token Symbol Base
Bitcoin btc 100000000
Ethereum eth 1000000000000000000
Ripple xrp 1000000
Stellar xlm 10000000
True USD tusd 1000000000000000000
Multi-Collateral Dai dai 1000000000000000000
Tether usdt 1000000
USD Coin usdc 1000000
Basic Attention Token bat 1000000000000000000
Paxos pax 1000000000000000000

2. All KYC documents are auto-approved in 30 seconds without verification in the test environment
3. INR Deposits confirmations are auto-approved without verification. INR withdrawals will remain in pending state.
4. For ETH and ERC20 tokens transaction, kovan network is used in testnet.
5. We dont prefill crypto wallets with any tokens, so please transfer testnet funds to your assigned wallet address for smooth exchange to and from fiat.
6. Fee Structure
Token Deposit Exchange Fees (on token that is being bought) , in % of value exchanged
BTC 0 0.25
ETH 0 0.25
TUSD 0 0.25
DAI 0 0.25
PAX 0 0.25
USDT 0 0.25
USDC 0 0.25
XRP 0 0.25
XLM 0 0.25
BAT 0 0.25
INR 0 0.25

7. Withdrawal fees are dynamic and dependent on the network used.
8. Minimum amount for withdrawal is $5 worth of token being withdrawn
9. Minimum amount for withdrawal is $5 worth of token being withdrawn.
10. Minimum amount to exchange is at least $10 worth of token being exchanged.
11. All responses will have the following format
                            
{
  success: true / false,
  data: {//in case of success true
  [JSON data with relevant fields]
  },
  error: {//in case of success false
    message: “Single line error”,
    stack: “reason for failure”
  }
}
                            
                          
Sample response format : Success
                            
{
success: true
data: {
  Name: “Rajesh Kumar”
 }
}

                            
                          
Sample response format : Failed
                            
{
success: false
error: {
    message: “403”,
    stack: “This user already exists on our platform”
  }
}


                            
                          
In the documentation below, only the data part of the response will be mentioned.
User Module
Creating user account
HTTP POST Request
{{url}}/users/create
Request Parameters
Parameter comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userIdentifier A unique identifier of the user. Can be alphanumeric value. Will be used to identify a user from your end
Response Data
Parameter comments
success true or false based on whether user creation succeeded or failed
userID The userID returned while creating the user
Get User Details
HTTP POST Request
{{url}}/users/details
Request Parameters
Parameter comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
Response Data
Parameter Value Comments
userID The ID of the user who created the request
kycStatus {
status: failed,
cause:”invalid document”
}
There can be 5 status:
1. success
2. open
3. failed
4. pending
5. notSubmitted
If failed, cause will also be mentioned Status is open when KYC basic is submitted but Documents are not uploaded
inrBalance {balance:amount, locked: amount}
crypto [{token: “btc”, address:”btcaddr”, balance:”value”, locked:”value”}] 'balance' and 'locked' is in base value, for Eg: 1 ETH will be 1000000000000000000
depositBankDetails {name:”name”, accountNumber:”accNo”, ifsc:”ifsc”} Account to which the user should deposit for the INR to be reflected in his account
withdrawBankDetails [{accountID:”id”, name:”name”, accountNumber:”accNo”, ifsc:”ifsc”}] Array of all accounts added by the user
Get All Transactions
HTTP POST Request
{{url}}/users/txns
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
Response Data
Parameter Comments
txns Array of all transactions by the user
Get Organisation user list
HTTP POST Request
{{url}}/users/orgUsers
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
Response Data
Parameter Comments
allOrgUsers Array of all users under the organisation
Sample Response:
{
    "success": true,
        "data": {
        "allOrgUsers": [
              {
                    "userID": "5fb6b1b9643b3500180q409d",
                    "userIdentifier": "test1911"
              }
           ]
     }
}
KYC Module
Complete KYC
The APIs below outline an instant, automated KYC verification process for your users. They will enable you to initiate the KYC process, upload the necessary documents, verify them instantly and complete the KYC process.

The prerequisites for this KYC process are:

1. A valid Indian identity document (Aadhar Card, Voter ID or Passport). NOTE: We do not support driving licenses at the moment.
2. A PAN card
3. A clear selfie
Initiate KYC verification process
This API initiates the KYC process for a user
HTTP POST Request
{{url}}/kyc/initiateKyc
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
docType User identification document that will be submitted for verification. Following documents are supported 1. passport 2. voterID 3. aadhar
Response Data
Parameter Value Comments
success true/false
Request for upload url
This API provides you with URLs to which you will have to upload the user’s document and selfie
HTTP POST Request
{{url}}/kyc/getUploadUrl
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
Response Data
Parameter Comments
documentFront URL to front side of selected document while initiating kyc process [passport/voterID/aadhar]
documentBack URL to back side of selected document while initiating kyc process [passport/voterID/aadhar]
selfie URL to upload selfie image of the user
panCard URL to upload PAN Card of the user
Upload images
HTTP PUT Request
1. Upload the images to the url received from the previous step using a PUT request.
2. It is an amazon S3 bucket URL which expires in 30 minutes
3. Image type should be JPG/JPEG and file size should be a maximum of 5 MB
Verify Document
  1. This endpoint needs to be called for all the uploaded document URLs [ i.e for front/back side of the selected document [passport/voterID/aadhar] and PAN Card.]
  2. This endpoint helps in real time document validation.
  3. For example, if passport was selected, this endpoint needs to be called 3 times with following parameter:
    1. doc: passport, frontOrBack: front
    2. doc: passport, frontOrBack: back
    3. doc: pan, frontOrBack: front
HTTP POST Request
{{url}}/kyc/verifyDoc
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
documentType Document type that needs to be verified. passport/aadhaar/voterID/pan
frontOrBack front / back , depending on which side of the document needs to be verified.
Response Data
Parameter Comments
data Data that was machine read from the uploaded document.
Verify Selfie
This endpoint needs to be called to verify that the user’s selfie matches the photo in the uploaded identity document
HTTP POST Request
{{url}}/kyc/verifySelfie
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
Response Data
Parameter Comments
data Data that was machine read from the uploaded document.
Instant KYC Approval
Once all the documents [ i.e identity document’s front/ back, pan card and selfie] are verified successfully, this endpoint needs to be called to approve the KYC and successfully complete the KYC verification process. On success, this endpoint also creates a unique virtual INR account number for the user, that is used to deposit money into the user’s account.
HTTP POST Request
{{url}}/kyc/instantApproval
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
Response Data
Parameter Comments
success true/false
Manual KYC verification flow
As a failsafe, in case the automated kyc flow doesn’t accept the documents, and needs to be manually verified, please use the following endpoint to submit for manual verification of the documents. Approval through this flow can be expected in 30 minutes. Status after verification will be reflected in kycStatus of the user.
HTTP POST Request
{{url}}/kyc/initiateManualVerification
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
Response Data
Parameter Comments
success true or false
KYC Status
HTTP POST Request
{{url}}/kyc/getKYCStatus
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
Response Data
Parameter Comments
status There can be 5 status
  1. accepted
  2. open
  3. failed
  4. pending
  5. notSubmitted
If failed, the cause will also be mentioned. Status is open when the basic KYC is submitted but documents are not uploaded
Deposit/Withdraw Module
Integrate Instant Payment SDK (Deprecated)
Add this script in the head section of your index.html
<script type="text/javascript" src="https://bohstaticfiles.s3.amazonaws.com/cardsSDK_v1_0.min.js"></script>
This SDK is for test environment. You may request us for the production SDK after successfully integrating and testing the functionality. You can initiate an instant payment by the following function that is exposed via BoH object on the window
window.BoH.makeInstantPayment(paymentRequest, 'paymentEl', successCallbackFn, errorCallbackFn);
Method Parameters
Parameter Comments
paymentRequest A javascript object with the following key value pairs:
{
  amount: 100.50,
  userID: 'The userID returned while creating the user
          (NOTE: Completing the users KYC is a mandatory
          prerequisite for this API)',
  orgID: 'Your organisation ID (contact hello@vauld.com
          if you do not have one)',
  apiKey: 'Your API key'
}
                              

The amount passed should be a valid javascript number
paymentEl The id of the html DOM element (preferably a full width div element) in which the payment page would be rendered on the website
successCallbackFn The javascript callback function to be invoked in case of a successful transaction. The response object passed as the argument to the function would be of the format:
{
  status: 'success',
  message: 'The server message',
  amount: 'The amount that has been added to the users
          INR balance',
  updatedBalance: 'The updated balance in the INR wallet
                  after crediting the amount'
}
                              
errorCallbackFn The javascript callback function to be invoked in case of a failed transaction. The response object passed as the argument to the function would be of the format:
{
  status: 'fail',
  message: 'The server message',
  amount: 'The amount for which payment was attempted'
}
                              
You can cancel an ongoing payment by invoking the following method:
window.BoH.cancelOnGoingPayment();
Submit deposit confirmation (Deprecated)
HTTP POST Request
{{url}}/fiat/paymentConfirmed
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user (NOTE: Completing the users KYC is a mandatory prerequisite for this API)
paymentID RTGS/IMPS/NEFT reference id
amount Amount in INR transferred for deposits
Response Data
Parameter Comments
txnID Reference ID for submitted deposit entry
User needs to deposit in the unique account number created for user after KYC is successfully verified. As soon as INR is transferred to the virtual account, user’s Vauld wallet INR balance gets updated.
Add withdraw bank account details
HTTP POST Request
{{url}}/fiat/addBankAccount
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
name Name of account holder
accountNumber Account number
ifsc IFSC code
Response Data
Parameter comments
accountID ID for the account just added. Pass this along when requesting withdrawal
status Approved/Rejected
error if rejected, reason for rejection
Remove withdraw bank account details
HTTP POST Request
{{url}}/fiat/removeBankAccount
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
bankAccountID ID generated while adding bank account details, Alternative this can be fetched from userDetails response in withdrawBankDetails section.
Response Data
Parameter comments
accountDetails Updated account details array of object
Request withdrawal
HTTP POST Request
{{url}}/fiat/requestWithdrawal
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user (NOTE: Completing the users KYC is a mandatory prerequisite for this API)
bankAccountID Bank account ID
amount Amount in String
Response Data
Parameter comments
message Comments for readability of the transaction
txnID Reference ID for submitted withdrawal entry
Buy/Sell Module
Fetch Price
HTTP POST Request
{{url}}/fiat/getAllPrice
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
Response Data
Parameter Value Comments
allPair
                            
[
  {
      "pair": "BTC/INR",
      "bid": "909657.04",
      "ask": "909784.70"
  },
  {
      "pair": "XRP/INR",
      "bid": "24.06",
      "ask": "24.06"
  },
  {
      "pair": "XLM/INR",
      "bid": "8.49",
      "ask": "8.49"
  },
  {
      "pair": "TUSD/INR",
      "bid": "78.23",
      "ask": "78.24"
  },
  {
      "pair": "USDC/INR",
      "bid": "78.23",
      "ask": "78.24"
  },
  {
      "pair": "BAT/INR",
      "bid": "20.18",
      "ask": "20.21"
  },
  {
      "pair": "PAX/INR",
      "bid": "78.23",
      "ask": "78.24"
  },
  {
      "pair": "ETH/INR",
      "bid": "31283.36",
      "ask": "31285.71"
  },
  {
      "pair": "DAI/INR",
      "bid": "79.42",
      "ask": "79.46"
  },
  {
      "pair": "BUSD/INR",
      "bid": "78.24",
      "ask": "78.25"
  }
]
                            
                          
Current bid and ask for token pairs, 'bid' and 'ask' is in INR
Get Token Exchange Amount
HTTP POST Request
{{url}}/fiat/getPrice
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
amount Amount is in base value, Eg: if 1 ETH is required, pass 1000000000000000000
type 'buy'/'sell'
token Symbol of token supported by our platform
Response Data
Parameter Comments
baseToken Token symbol which is getting exchanged
quoteToken Token symbol to which exchange is desired
baseAmount 'baseAmount' is in base value. Eg: 1 ETH will be 1000000000000000000
quoteAmount 'quoteAmount' is in base value. Eg: 1 ETH will be 1000000000000000000
exType Type of exchange
Create order
HTTP POST Request
{{url}}/fiat/createOrder
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
type buy/sell
token Name of token “btc”, ”eth” etc
inrAmount INR value
tokenAmount tokenAmount (amount is in base value, e.g if 1 ETH is required, pass 1000000000000000000)
Response Data
Parameter Value Comments
orderID value Order ID of the order placed. Can be used to track transaction
Get order status
HTTP POST Request
{{url}}/fiat/details
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user (NOTE: Completing the users KYC is a mandatory prerequisite for this API)
orderID ID of the order placed
Response Data
Parameter Value Comments
orderStatus success/failed/pending
type buy/sell
depositToken btc Name of token “btc”, ”eth” etc
destinationToken inr Name of token “btc”, ”eth”, "inr" etc
depositAmount Deposit token value
destinationAmount Destination token value
Get all Orders
HTTP POST Request
{{url}}/fiat/allExchangeOrders
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
Response Data
Parameter Value Comments
txns An array of all the orders placed, each entry will be an object consisting of following details.
                            
[
   {
  	"orderID":
      "60487c6f82ccb3001db66ccc",
  	"depositToken":"eth",
  	"destinationToken":"inr",
  	"depositAmount":7769000000000000,
  	"destinationAmount":1042.34,
  	"status":"complete",
  	"type":"sell",
  	"fees":2.08
   }
]

                            
                          
status : openOrder , complete, refunded, failed

type : buy, sell

depositAmount / destinationAmount : INR token is rupee denominated and crypto amounts are base value ( e.g wei for ETH )
Internal INR Transfer
This API can be used to internally transfer funds among your users, at zero transaction fees.
HTTP POST Request
{{url}}/fiat/internalTransfer
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
receiverUserID The userID of the receiver
amount Amount to Send
token Please send 'INR'. For sending cryptocurrency use /wallets/send endpoint.
Response Data
Parameter Value Comments
txnID This is the transactionID for debit of token amount from the user's account.
Send crypto
Send
HTTP POST Request
{{url}}/wallets/send
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
token tokenName
amount Amount to withdraw
receiver Address to send token to
Response Data
Parameter Value Comments
txnID value TxnID to track txns
Get txn status
HTTP POST Request
{{url}}/wallets/txnStatus
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
txnID txnID received while trying to send
Response Data
Parameter Value Comments
status success/failed/pending
txnHash If Success
Get network fees
To fetch dynamic network fees prevalent at the time of doing the transaction.
HTTP POST Request
{{url}}/wallets/getNetworkFees
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
userID The userID returned while creating the user
token Token to be sent ( e.g eth, btc)
receiver Receiver address where token is to be sent
sender Vauld platform address from which request is to be initiated
amount Amount to be sent in base value ( For 1 ETH 1000000000000000000 needs to be passed
Response Data
Parameter Comments
fees Fees required for the passed variables in base value ( For 1 ETH 1000000000000000000 will be returned)
Webhooks
For events like user creation, balance change, kyc updates, apart from receiving the details from REST calls, updates are pushed to the webhook URL as well for tracking of such updates.
The default template of webhook sent to the requested URL:
                
{
 "event":<eventName>,
 "subEvent":<subEventName>,
 "eventData":
   {
     "success":<true/false>,
     “data”:
       {
         … //Relevant data in json format pertaining to event type
       }
   }
}
              
              
Event Types
Event Name Comments
user Updates related to users, such as creation of users.
kyc Updates related to kyc, such as when kyc is accepted or rejected.
fiat Updates related to deposits and withdrawal of fiat currencies
crypto Updates related to deposits and withdrawal of crypto tokens.
SubEvent Types
Event Name Comments
userCreated On creation of new user
status Change in kyc status
aadharVerification Aadhar verification data on kyc verification
voterIDVerification VoterID data on kyc verification
passportVerification Passport data on kyc verification
panVerification PAN data on kyc verification
selfieVerification Selfie verification data
deposit On deposit of fiat / crypto tokens
withdrawal On Withdrawal of fiat / crypto tokens
internalTransfer Internal crypto transfer is processed between users of the same organizationID
Add Webhook URL
HTTP POST Request
{{url}}/misc/addWebhook
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
webhookUrl URL where webhooks updates can be received via POST call.
Response Data
Parameter Value Comments
message Webhook added successfully On Successful creation of webhook
Test Webhook URL
To test if the added URL is properly receiving request
HTTP POST Request
{{url}}/misc/testWebhook
Request Parameters
Parameter Comments
orgID Your organisation ID (contact hello@vauld.com if you do not have one)
Response Data
Parameter Value Comments
message Request sent successfully On Successful send of testData.
                            
Test data sent :

{
"event":"testEvent",
"subEvent":"testSubEvent",
"eventData":{
"success":true
}
}