How Span Margin Percentages of stock and indices are calculated

Is there any free API available to fetch Total Margin required

@harshvardhan_sharma You can create a free version of Kite Connect and retrieve the margin details accordingly. Read more.