Skip to Main Content

API Structure

Common conventions shared across every Shoonya API endpoint — base URL, request format, authentication, and response shape.

Overview

Every REST endpoint in this documentation follows the same structural conventions. Understanding them once here means you won't need them repeated on every individual API page — only the endpoint-specific jData fields differ.

Base URL

REST basehttps://api.shoonya.com/NorenWClientAPI/
WebSocket basewss://api.shoonya.com/NorenWSAPI/
EOD/historical data basehttps://api.shoonya.com/chartapi/getdata/

All endpoint paths in this documentation are given relative to the REST base — e.g. Logout resolves to https://api.shoonya.com/NorenWClientAPI/Logout.

Authentication

Every authenticated call carries the access token as a Bearer token in the Authorization header, obtained via the OAuth login flow:

text
Authorization: Bearer <AccessToken>

Unlike some other Noren-based gateways, the token is not repeated inside the request body — only in the header.

Request format

All requests use Content-Type: text/plain with a single URL-encoded-style field, jData, carrying the JSON-encoded payload as the request body:

text
jData=<JSON payload>

Example — placing an order:

bash
curl -X POST https://api.shoonya.com/NorenWClientAPI/PlaceOrder \
  -H "Content-Type: text/plain" \
  -H "Authorization: Bearer <AccessToken>" \
  -d 'jData={"exch":"NSE","tsym":"CANBK-EQ","qty":"1","buy_or_sell":"B"}'

Response format

Every response is a JSON object carrying at minimum a stat field:

FieldValuesDescription
statOk / Not_OkPresent on every response — check this first before reading any other field.
emsgstringPresent only when stat is Not_Ok — human-readable error detail. See Error Handling.

Successful responses add endpoint-specific fields alongside stat — these are documented individually on each API's Response section.

Field naming conventions

  • Request/response field names are short, lowercase, and often abbreviated (tsym, qty, prc, trgprc) — see the Glossary for the full list.
  • Coded fields (exch, buy_or_sell, price_type, product_type) take fixed short codes, not free text — see Exchange Segment Codes, Transaction Type Codes, and Order Type Codes.
  • Numeric values (quantity, price) are typically sent as strings within the JSON payload, not native JSON numbers — follow the exact type shown in each endpoint's Request example.

See Authentication Overview for the full OAuth login sequence, Error Handling for the complete error response taxonomy, and Rate Limits for request quotas.