API & Developer Documentation
Integrate TradeInsight AI programmatically. Built by Mohd Shubair for AI agents, quant developers, and automated algorithmic pipelines analyzing 20+ NSE Indian equity sectors.
Command Line Interface (CLI)
Interact with TradeInsight AI directly from your terminal or automation scripts without writing custom HTTP integrations:
npx tradeinsight analyze pharmaceuticalspip install tradeinsight-cli
tradeinsight sectors
tradeinsight analyze technology --format jsonBase URL
https://tradeinsight.shubair.inAll API endpoints are relative to this base URL. Responses are JSON unless otherwise noted.
Authentication
TradeInsight AI uses JWT (JSON Web Token) bearer authentication. Obtain a token pair by registering or logging in, then include the access token in theAuthorizationheader of subsequent requests.
1. Register
{
"username": "your_username",
"email": "you@example.com",
"password": "SecurePass123",
"full_name": "Your Name"
}2. Login
{
"username": "your_username",
"password": "SecurePass123"
}
// Response:
{
"access_token": "eyJhbG...",
"refresh_token": "eyJhbG...",
"token_type": "bearer"
}3. Use the Token
curl -X GET "https://tradeinsight.shubair.in/api/v1/analyze/pharmaceuticals" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Endpoints
Public (No Auth Required)
/API root — service info and endpoint listing
/healthHealth check with system status
/openapi.jsonFull OpenAPI specification (machine-readable)
/api/v1/sectorsList all 20+ sectors available for analysis
Authentication
/api/v1/auth/send-otpSend a 6-digit OTP code to an email address
/api/v1/auth/verify-otpVerify an email OTP code
/api/v1/auth/registerRegister a new user account
/api/v1/auth/loginLogin and receive access + refresh tokens
/api/v1/auth/refreshRefresh an expired access token
/api/v1/auth/logoutInvalidate the current refresh token
Sector Analysis
/api/v1/analyze/{sector}Analyse a sector — returns a cited AI report with opportunities, risks, and recommendations
/api/v1/analyze/compareCompare two sectors side-by-side
/api/v1/historyList past analyses for the current user
/api/v1/history/{id}Retrieve a specific past analysis
/api/v1/history/{id}Delete a specific analysis from history
/api/v1/history/{id}/exportExport an analysis as PDF, PPTX, XLSX, or Markdown
AI & Voice
/api/v1/ai/vision/analyzeAnalyse an uploaded image using AI vision
/api/v1/ai/ttsConvert text to speech
/api/v1/ai/sttConvert speech to text
/api/v1/voice/queryVoice-based market query (text in, speech out)
/api/v1/voice/agentFull voice agent interaction
/api/v1/voice/voicesList available TTS voices
User & Preferences
/api/v1/users/meGet current user profile
/api/v1/users/meUpdate user profile
/api/v1/users/me/statsGet user usage statistics
/api/v1/favoritesList favourite sectors
/api/v1/favoritesAdd a sector to favourites
/api/v1/favorites/{sector}Remove a sector from favourites
Example: Analyse a Sector
curl -X GET "https://tradeinsight.shubair.in/api/v1/analyze/pharmaceuticals?use_cache=true" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Accept: application/json"{
"sector": "Pharmaceuticals",
"analysis": "## Executive Summary\n\nThe Indian pharmaceutical sector...",
"key_opportunities": [
"CDMOs benefiting from US supply-chain reshoring",
"Q1 order books up 18% YoY"
],
"key_risks": [
"USD weakness offsetting margin expansion for exporters"
],
"sources": [
{"title": "...", "url": "...", "reliability": "high"}
],
"generated_at": "2026-08-24T14:00:00Z",
"latency_ms": 12400
}Rate Limits & Response Headers
| Tier | Per Minute | Per Hour |
|---|---|---|
| Free | 10 | 100 |
| Pro | 30 | 500 |
| Enterprise | Custom — contact sales | |
Standard RFC RateLimit Response Headers
Every API response includes IETF/RFC standard rate limit headers enabling AI agents to self-throttle dynamically:
API Versioning & Deprecation Policy
We follow strict semantic URL versioning (/api/v1/...). Deprecated endpoints are guaranteed a minimum 6-month operational grace period and return RFC 8594 Deprecation and Sunset headers.
Error Responses
All errors return structured JSON with consistent fields:
{
"error": "Human-readable error description",
"message": "Detailed message for debugging",
"code": "ERROR_CODE"
}| Status | Code | Description |
|---|---|---|
| 400 | HTTP_400 | Bad request — invalid parameters |
| 401 | HTTP_401 | Unauthorized — missing or invalid token |
| 404 | HTTP_404 | Resource not found |
| 429 | RATE_LIMITED | Rate limit exceeded — retry after Retry-After header |
| 500 | INTERNAL_ERROR | Internal server error |