SmartAPI API

Finance / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

SmartAPI by Angel Broking is an Indian stock brokerage API that lets developers build automated trading systems, portfolio trackers, and order management tools for the NSE and BSE markets. It requires an API key and supports real-time market data, historical data, order placement, and WebSocket streaming. This API is best suited for developers with some trading domain knowledge.

💡

Beginner Tip

Before placing live orders, always test your integration in the sandbox environment to avoid accidental real trades. Start by exploring the market data endpoints before attempting order management.

Available Data

SmartAPI data via REST API
JSON-formatted response data
Requires API key authentication

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from SmartAPI",
    "description": "Gain access to set of <SmartAPI> and create end-to-end broking services",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

status True if the request was successful, false if it failed.
message Human-readable status message or error description.
data.jwtToken JWT access token to include in the Authorization header for subsequent requests.
data.refreshToken Token used to obtain a new JWT access token after expiry.
data.feedToken Separate token required for WebSocket market data feed connections.

Implementation Example

const url = "https://smartapi.angelbroking.com/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

AG8001 - Invalid Token JWT access token has expired (tokens are short-lived).
Implement token refresh logic using the refresh token endpoint before making subsequent API calls.
AG8002 - Unauthorized API key not activated or IP address not whitelisted.
Log into your Angel Broking account, activate the API key, and add your server IP to the whitelist.
TOTP Required error Angel Broking requires a Time-based One-Time Password for login.
Use an authenticator app or the pyotp/speakeasy library to generate TOTP codes from your TOTP secret.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 10/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Finance
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →