As an authorized custodian
As an authorized custodian, here are the steps to use the API
Create a sub-account
With this API, you will pass an email address that represents that account, a password to secure their account and an optional identifier that can represent an identifier on your side to find that account. The return from this call will provide you with an API key to be used to call ARC as your customer. Please make sure you store the API key and password in a secure location. Additionally, we will return their account ID which will be used when creating contracts with that customer as a counter-party.
Subscribe the sub-account to events
If your system can receive events that occur surrounding your customer's account and/or any contracts they are a counter-party to, using the sub-account API key, you will want to use the Webhook/Subscription Management API. With this API, you can choose to be notified when various events occur, like any time the account is added as a counter-party to a contract, when a contract needs collateral or approvals, when a contract has terminated, etc.
Create a contract
Using the sub-account API key, call the Create Contract API within the Contract Management API. Currently, we only support creating Loan type contracts, but more are coming soon. When creating the Loan contract, specify the account ID for the borrower and the lender. The sub-account API key needs to match one of the counter-party's API key. The request includes all of the terms and conditions associated with the loan, including term, interest rate, loan amount, collateral amount, etc. After successful creation, the contract ID is returned.
If the sub-account is also subscribed to the contract created event, a notification will be sent to the specified endpoint with the information regarding the creation of the contract.
Set the withdrawal address
Once the contract is created, you will want to use the Set Withdrawal Address API to set the Bitcoin wallet address for funds to be withdrawn to when the contract is fulfilled or closed out.
Terminate a contract
Before a contract has been approved by BOTH counter-parties, a contract can be terminated by either counter-party using the Terminate a Contract API. Once approved by BOTH counter-parties, the contract can no longer be terminated. If the sub-account is subscribed to the terminate a contract event, there will be a notification sent to the endpoint specified with the subscription.
Update a contract
Before a contract has been approved by EITHER counter-party, a contract can be updated by either counter-party using the Update a Contract API. Once a contract has been approved by one counter-party, it is locked for updates, but can be terminated.
Approve a contract
Once a contract is created and as a counter-party, your sub-account agrees to the terms and conditions, a request on their behalf can be sent to Approve the Contract. Once the contract is approved, ARC establishes a secure contract environment for the execution of the contract.
If subscribed to the counter-party approved event, a notification will be sent when the other counter-party has approved the contract, alerting this counter-party that they need to approve or terminate the contract.
If subscribed to the contract approved event, a notification will be sent when both parties have approved the contract.
If subscribed to the deposit address created event, when the secure contract environment is established and the contract is ready, an alert will notify the borrower to deposit collateral to the deposit address created with the contract. To find the deposit address, use the Get Deposit Address API.
The borrower will need to deposit the specified Fiat Loan Value equivalent BTC amount to the deposit address specified.
Deposit additional collateral if needed
If the price of BTC drops to a point where the borrower needs to provide additional collateral, an event will be sent to the endpoint specified on the endpoint associated with the subscription for the additional collateral required event. If needed, you can again call the Get Deposit Address API to get the wallet address to send additional BTC.
Last updated