Static IP for the Shoonya (Finvasia) API
Shoonya accepts API requests only from IP addresses registered against your client ID, and the check covers login and every endpoint, not just orders. You can register a primary and a backup IP. Shoonya's main API host is reachable only over IPv4, so a dedicated IPv4 is the straightforward choice.
What Shoonya checks
- Login and all endpoints. The IP must be whitelisted before the OAuth login works or any endpoint can be called.
- Two addresses. A primary IP and an optional backup IP for a failover server.
- IPv4 and IPv6 fields. Both are accepted, but IPv4 is enabled on
api.shoonya.comand the docs say to usetrade.shoonya.comin the authorize URL for IPv6.
Shoonya's docs present the IP fields as something you update yourself, while its blog says the IP is changed only through the broker. Neither gives a weekly limit. The blog says immediate family can share one IP with the broker's written consent.
Why IPv4 for Shoonya
The official client sends API and WebSocket traffic to api.shoonya.com, which has no IPv6 address, so an IPv6-only exit can't reach it:
dig +short api.shoonya.com AAAA # no ipv6 address
dig +short trade.shoonya.com AAAA # has ipv6
The docs only describe moving the authorize step to trade.shoonya.com for IPv6. With an IPv4 address you don't need to work around that.
How to register your IP
- Get a dedicated IPv4 and check its exit address:
curl -x http://USER:PASS@HOST:PORT https://ifconfig.co - In Shoonya web, click the profile icon, then API Key Generation.
- Enter the address as Primary IP Address, add a Backup IP Address if you have one, and click Update.
Send Shoonya calls through the fixed IP
Use the current OAuth client linked from Shoonya's docs (NorenRestApiOAuth with the repository's api_helper.py). It calls requests directly, so set the proxy variables before logging in:
import os
PROXY = os.environ["PROXY_URL"] # http://USER:PASS@HOST:PORT
for v in ("HTTPS_PROXY", "HTTP_PROXY"):
os.environ[v] = PROXY
from api_helper import NorenApiPy
api = NorenApiPy()
access_token, uid, refresh_token, actid = api.getAccessToken(auth_code, secret_code, client_id, uid)
api.injectOAuthHeader(access_token, uid, actid)
The full Shoonya proxy guide on GitHub covers the OAuth steps and troubleshooting.
Shoonya static IP: FAQs
Does Shoonya support IPv6?
The IP fields accept IPv6, and Shoonya says to use trade.shoonya.com in the authorize URL for IPv6. But the main API host, api.shoonya.com, has no IPv6 address, so we recommend a dedicated IPv4.
Is only order placement IP-checked on Shoonya?
No. Shoonya's docs say the IP must be whitelisted before login and before calling any endpoint.
Sources
- Shoonya API docs: IP whitelisting guide
- Shoonya API docs: Python SDK
- Shoonya blog: SEBI's algo trading rules
- Shoonya OAuth Python client
Get your dedicated static IP
IPv6 ₹50 a month, IPv4 ₹200 a month, plus GST. Live in minutes, whitelisted once.