Integration Docs

Comprehensive guide and documentation to help you start working with smallcase Gateway

Get Started

Webhooks

Webhook enables partners to receive push notifications to their server as and when the events like single stock (or basket) order update and holding import occur.

Overview ⚓️

Webhook is an event-driven communication method where a webhook provider (smallcase Gateway backend) delivers data to a webhook consumer (Gateway partner backend) as and when an event occurs. A more traditional way to get almost real-time data was for consumers to frequently poll the provider. However, webhooks are considered more efficient and reliable.

smallcase Gateway Webhook enables partners to receive push notifications to their server as and when the events like single stock (or basket) order update and holding import occur.

Consuming a Webhook

  1. Create a public API endpoint in your backend which will listen for new data that would be delivered by the smallcase Gateway backend.
  2. Once the API is up & running, share the endpoint URL with the smallcase Gateway team so that we can register in our system.

smallcase Gateway Webhooks

smallcase Gateway offer webhooks for the following use cases -

  1. Single Stock (Basket Orders)
  2. Holdings Import

Single Stock (Basket) Orders

Sample payload

{
  "batchId": "5ef5b2ef07158b6c4ed3a4b6",
  "buyAmount": 1575.0900000000001,
  "sellAmount": 0,
  "quantity": 2,
  "filled": 2,
  "status": "COMPLETED",
  "variety": "regular",
  "completedDate": "2020-06-26T08:33:54.803Z",
  "orders": [{
    "status": "COMPLETE",
    "quantity": 1,
    "tradingsymbol": "AXISBANK",
    "transactionType": "BUY",
    "averagePrice": 420.1,
    "exchange": "NSE",
    "orderType": "MARKET",
    "product": "CNC",
    "filledQuantity": 1,
    "exchangeOrderId": "1000000010241945"
  }, {
    "status": "COMPLETE",
    "quantity": 1,
    "tradingsymbol": "AXISNIFTY",
    "transactionType": "BUY",
    "averagePrice": 1154.99,
    "exchange": "NSE",
    "orderType": "MARKET",
    "product": "CNC",
    "filledQuantity": 1,
    "exchangeOrderId": "1000000010241980"
  }],
  "unplaced": [],
  "transactionId": "TRX_524c2df431ad435081c60c045a26ae63",
  "smallcaseAuthId": "5d8dc01c1446386d96c4832f",
}

Holdings Import

Sample payload

{
  "smallcases": {
    "public": [{
      "scid": "SCMO_0018",
      "name": "Magic Formula - Low-Cost Version",
      "shortDescription": "High-quality companies trading at attractive prices, screened using Greenblatt's Magic Formula",
      "imageUrl": "https://assets.smallcase.com/images/smallcases/200/SCMO_0018.png",
      "stats": {
        "currentValue": 2800.4999999999995,
        "totalReturns": -3484.330000000001
      },
      "constituents": [{
        "ticker": "BODALCHEM",
        "shares": 5
      }, {
        "ticker": "KEC",
        "shares": 2
      }, {
        "ticker": "GHCL",
        "shares": 1
      }, {
        "ticker": "HSCL",
        "shares": 3
      }, {
        "ticker": "PHILIPCARB",
        "shares": 3
      }, {
        "ticker": "COALINDIA",
        "shares": 1
      }, {
        "ticker": "EIDPARRY",
        "shares": 2
      }, {
        "ticker": "JAMNAAUTO",
        "shares": 6
      }, {
        "ticker": "NCC",
        "shares": 3
      }, {
        "ticker": "NMDC",
        "shares": 3
      }, {
        "ticker": "WSTCSTPAPR",
        "shares": 1
      }]
    }],
    "private": {
      "stats": {
        "currentValue": 0,
        "totalReturns": 0
      }
    }
  },
  "securities": {
    "holdings": [{
      "ticker": "ICICIB22",
      "shares": 834,
      "name": "Bharat 22 ETF",
      "exchange": "NSE",
      "averagePrice": 35.97
    }, {
      "ticker": "ICICINV20",
      "shares": 1,
      "name": "ICICI Prudential NV20 ETF",
      "exchange": "NSE",
      "averagePrice": 56.77
    }, {
      "ticker": "ICICINXT50",
      "shares": 2,
      "name": "ICICI Prudential Nifty Next 50 ETF",
      "exchange": "NSE",
      "averagePrice": 28.77
    }, {
      "ticker": "ITC",
      "shares": 26,
      "name": "ITC Ltd",
      "exchange": "BSE",
      "averagePrice": 273.55
    }, {
      "ticker": "RPOWER",
      "shares": 1,
      "name": "Reliance Power Ltd",
      "exchange": "BSE",
      "averagePrice": 4.25
    }, {
      "ticker": "SUZLON",
      "shares": 1,
      "name": "Suzlon Energy Ltd",
      "exchange": "BSE",
      "averagePrice": 4.95
    }, {
      "ticker": "VIDEOIND",
      "shares": 165,
      "name": "Videocon Industries Ltd",
      "exchange": "BSE",
      "averagePrice": 25.5
    }]
  },
  "updating": false,
  "lastUpdate": "2020-06-23T06:31:28.539Z",
  "snapshotDate": "2020-06-23T06:31:28.539Z",
  "smallcaseAuthId": "5d8dc01c1446386d96c4832f",
  "transactionId": "TRX_c1ca7da87d14430faff75c3815243b36"
}

FAQs

  1. Is there any retry mechanism, in case our webhook could not capture data on the first try?
    Yes, we have a retry mechanism in place which would retry hitting the webhook URL after a certain duration -
    i. First retry after 15 minutes
    ii. Second retry after 24 hours
    iii. Final retry after 48 hours

  2. There's no Webhook support for our use case. Is it possible to add support?
    We are always open to exploring use cases. Let us know your use case for which you need webhook support, we will definitely see what can be done.

Updated 3 months ago


Webhooks


Webhook enables partners to receive push notifications to their server as and when the events like single stock (or basket) order update and holding import occur.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.