Static IP for the Samco Trade API
Samco accepts order placement and modification only from an IPv4 address whitelisted on your Samco API app. You get a primary and an optional secondary IP, and one change every 7 days across your whole account. IPv6 isn't accepted, so you need a dedicated IPv4.
What Samco checks
- Orders and modifications. Rejected orders return HTTP 403, "The IP is not the registered static IP".
- Two addresses per app. Primary (required) and secondary (optional).
- IPv4 only. Both must be public IPv4 addresses.
- One change per 7 days, account-wide. Deleting an IP counts as a change, and a new app doesn't reset the clock.
- One client per IP. If another Samco client has registered the IP, yours is rejected. A shared proxy IP won't work.
- Daily logout. All API sessions end at 8:00 AM IST.
Watch out for IPv6 on the way out
Samco's API host publishes IPv6 addresses even though only IPv4 can be whitelisted. A connection that leaves over IPv6 gets a 403. A TrueIP IPv4 proxy connects out over IPv4 only, so Samco always sees the address you registered.
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 the Samco Trade API dashboard, open Static IPs, Add IP, choose your app and PRIMARY, enter the address and confirm with the OTP.
- Check it with Samco's
GET /ip/whoami, which shows the IP Samco sees without using up your weekly change.
Send Samco orders through the fixed IP
Samco's SDK, stocknotebridge, uses urllib3 and ignores proxy environment variables, so give it a proxy-aware pool:
import os, certifi, urllib3
from snapi_py_client.api_client import ApiClient
from snapi_py_client.snapi_bridge import StocknoteAPIPythonBridge
api = ApiClient()
api.rest_client.pool_manager = urllib3.ProxyManager(
proxy_url=os.environ["PROXY_HOSTPORT"], # http://HOST:PORT
proxy_headers=urllib3.make_headers(proxy_basic_auth=os.environ["PROXY_AUTH"]), # USER:PASS
cert_reqs="CERT_REQUIRED", ca_certs=certifi.where(),
)
samco = StocknoteAPIPythonBridge(api_client=api)
The full Samco proxy guide on GitHub covers login, streaming and troubleshooting.
Getting 403s? See fixing "The IP is not the registered static IP".
Samco static IP: FAQs
Does Samco accept IPv6 for API whitelisting?
No. Samco's docs say both IPs must be valid public IPv4 addresses.
How often can I change my Samco static IP?
Once every 7 days from your last change, counted across your whole Samco account. Deleting an IP counts as a change.
Can I use a shared static IP with Samco?
No. Samco rejects an IP that's already registered to another Samco client. You need an IP that only you use.
Sources
Get your dedicated static IP
IPv6 ₹50 a month, IPv4 ₹200 a month, plus GST. Live in minutes, whitelisted once.