Subscription Management API

Manage the notifications of events that occur during the lifecycle of a contract.

There are many different events that occur during the lifecycle of a contract. ARC has been designed to be integrated into external applications, generally trading desks and other financial services applications. The subscription management API allows you to request to be notified via an API call when any of these various events occur.

Note: if you would like to subscribe to different endpoints for different event types, you can create multiple subscriptions.

EventDescriptionEvent Type CodePayload

Contract Created

Any time a contract is created with your Account ID as a counterparty.

arc.contract.created
{
  contractId: string;
}

Counterparty Approved Contract

When the counterparty to one of your contracts approves the contract.

arc.counterparty.approved
{
  contractId: string;
}

Contract Approved

When both counterparties have approved the contract.

arc.contract.approved
{
  contractId: string;
}

Deposit Address Created

After approval, a contract is then activated and goes through a series of steps to setup the execution environment. Once the execution environment is ready, a Bitcoin Wallet Deposit Address is created allowing the Borrower to fund the contract with the necessary collateral.

arc.deposit.address.created
{
  contractId: string;
  depsoitAddress: string
}

Additional Collateral Needed

During execution of the contract, if the value of the collateral drops and the available collateral dips below the maintenance margin, the Borrower needs to add collateral to bring the collateral value back to the initial collateral required amount.

arc.additional.collateral
{
  contractId: string;
  collateralNeeded: number;
  depositAddress: string;
}

Contract is terminated

Any time a contract is cancelled.

arc.contract.terminated
{
  contractId: string;
}

Create a Subscription

You can request to subscribe to any of the above events. After subscribing, any time you are a counterparty to a contract, and you meet the criteria, the web endpoint you specify in the subscription will receive a POST request with the associated data.

Request format

method: 'POST'
endpoint: '/api/external/arc/webhook'
headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'your api key' }
body: {
    "url": "https://your.webhook.domain/endpoint",
    "eventTypes": [
        "any of the Event Types listed above"
    ]
}

Response format

{}

Get All Subscriptions

You can see all of the events your currently subscribed to.

Request format

method: 'GET'
endpoint: '/api/external/arc/webhook'
headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'your api key' }

Response format

{
    "webhookSubscriptions": [
        {
            "_id": "669d244eec184e90e49c2854",
            "webhookEndpoint": {
                "tenantId": "Your Account ID",
                "url": "https://your.webhook.domain/endpoint"
            },
            "eventType": [
                "all of the event types you are subscribed to"
            ]
        }
    ]
}

Cancel a Subscription

At any time, you can cancel subscriptions.

Request format

method: 'DELETE'
endpoint: '/api/external/arc/webhook'
headers: { 'Content-Type': 'application/json', 'X-API-KEY': 'your api key' }
body: {
    "url": "https://your.webhook.domain/endpoint",
    "eventTypes": [
        "Event types to unsubscribe from"
    ]
}

Response format

{
    "webhookSubscription": {
        "_id": "669d244eec184e90e49c2854",
        "webhookEndpoint": {
            "tenantId": "Your Account ID",
            "url": "https://your.webhook.domain/endpoint"
        },
        "eventType": [
            "Remaining events still subscribed to"
        ]
    }
}

Last updated