Products Solutions Technology Pricing Resources Contact Log in Book Demo
Home/Resources/API Reference

API Reference

REST and WebSocket APIs for market data, orders, portfolio and strategy control — with a sandbox that runs on virtual capital and live market data.

01

Overview

The AlphaSync API gives programmatic access to market data, order management, portfolio state and strategy control — the same infrastructure behind the platform UI. All endpoints accept and return JSON over HTTPS.

# Production https://api.alphasync.app/v1 # Sandbox (virtual capital, live market data) https://sandbox-api.alphasync.app/v1
  • All timestamps are ISO 8601 in IST (+05:30).
  • Prices are decimal strings in INR; quantities are integers (shares) or lots (derivatives).
  • Instrument identifiers use EXCHANGE:SYMBOL format — e.g. NSE:RELIANCE, NFO:NIFTY30JUN26F, MCX:GOLD.
Access & status. API access is available on Enterprise plans and to approved developers. This reference describes API v1; request credentials at contact — endpoints may evolve before general availability.
02

Authentication

Authenticate with a scoped API key sent as a Bearer token. Keys are created from Settings → Data & Privacy (Enterprise accounts) and carry explicit scopes — request only what your application needs.

curl https://api.alphasync.app/v1/portfolio/positions \ -H "Authorization: Bearer as_live_xxxxxxxxxxxxxxxx"
ScopeGrants
market:readQuotes, candles, option chains, indices
orders:readOrderbook and order status
orders:writePlace, modify and cancel orders
portfolio:readPositions, holdings, P&L
strategies:manageStart/stop strategies, read signals
  • Keys are environment-specific: as_live_… vs as_sandbox_….
  • Order-placing systems must call from whitelisted static IPs, in line with SEBI's algo trading framework.
  • Never embed keys in client-side code; rotate immediately if exposed.
03

Rate limits

CategoryLimitNotes
Market data (REST)10 req/sUse WebSocket streams for continuous data
OrdersPer exchange-mandated thresholdsThrottled automatically for SEBI/exchange compliance
Other endpoints5 req/sBurst up to 20

Every response includes X-RateLimit-Remaining and X-RateLimit-Reset headers. Exceeding a limit returns 429 with a retry_after field — back off and retry; repeated abuse suspends the key.

04

Market data

GET/market/quote/{instrument}

Live quote — LTP, OHLC, bid/ask depth, volume, OI for derivatives.

GET/market/candles/{instrument}?interval=5m&from=…&to=…

Historical OHLCV candles. Intervals: 1m, 5m, 15m, 1h, 1d. Up to 5 years of history.

GET/market/optionchain/{underlying}?expiry=2026-06-30

Full option chain with per-strike IV, Greeks, OI and chain analytics (PCR, max pain, expected move).

GET/market/indices

Benchmark indices snapshot — NIFTY 50, SENSEX, BANK NIFTY, NIFTY IT.

# Example: live quote curl https://api.alphasync.app/v1/market/quote/NSE:RELIANCE \ -H "Authorization: Bearer $KEY" { "instrument": "NSE:RELIANCE", "ltp": "1264.50", "change_pct": "0.86", "ohlc": { "open": "1255.10", "high": "1304.00", "low": "1248.00", "close": "1253.70" }, "volume": 1882340, "ts": "2026-06-11T15:29:58+05:30" }
05

Orders

POST/orders

Place an order. Automated orders are tagged with your algo ID automatically.

GET/orders?status=filled&from=…

List orders with filters: status, side, product, source (manual / algo / alpha_auto), date range.

GET/orders/{order_id}

Single order with full lifecycle history.

DELETE/orders/{order_id}

Cancel a pending order.

# Example: place a limit order curl -X POST https://api.alphasync.app/v1/orders \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{ "instrument": "NSE:RELIANCE", "side": "BUY", "quantity": 100, "order_type": "LIMIT", "price": "1264.00", "product": "MIS" }' { "order_id": "ord_9f8e7d6c", "status": "PENDING", "ts": "2026-06-11T10:15:02+05:30" }
  • order_type: MARKET, LIMIT, SL, SL-M · product: MIS, CNC, NRML
  • Every order passes the pre-trade risk engine (capital limits, drawdown caps, rate checks) before acceptance — a rejected check returns 422 with the failed rule.
06

Portfolio

GET/portfolio/positions

Open positions with side, quantity, average price, LTP and M2M.

GET/portfolio/holdings

Delivery holdings with average cost and current value.

GET/portfolio/pnl?period=today

P&L summary — realised, unrealised, gross exposure, win rate. Periods: today, week, month, custom range.

07

Strategies

GET/strategies

List your strategies with status, symbol, template and risk parameters.

POST/strategies/{id}/start

Start live evaluation. Strategy trades during market hours within its configured limits.

POST/strategies/{id}/stop

Stop the strategy. Open positions remain yours to manage (or square off via the orders API).

GET/strategies/{id}/signals?from=…

Signal log with timestamps, direction, confidence and the indicator readings behind each signal.

Strategy creation is currently done in the platform UI (no-code builder); the API controls execution and reads telemetry. Programmatic strategy definition is planned for a future version.

08

WebSocket streams

For continuous data, connect to the stream endpoint and subscribe to channels. One connection supports multiple subscriptions.

wss://stream.alphasync.app/v1?token=as_live_xxxxxxxx # subscribe { "action": "subscribe", "channel": "ticks", "instruments": ["NSE:RELIANCE", "NSE:NIFTY50"] } # tick message { "channel": "ticks", "instrument": "NSE:RELIANCE", "ltp": "1264.55", "ts": "2026-06-11T10:15:03.412+05:30" }
ChannelPushes
ticksLive prices for subscribed instruments
ordersOrder lifecycle events (placed, filled, rejected, cancelled)
positionsPosition and M2M updates
signalsStrategy and Alpha Auto signals as they fire

The server sends ping every 30s; reply pong or the connection is dropped. Reconnect with exponential backoff.

09

Errors

Errors return a consistent envelope:

{ "error": { "code": "risk_check_failed", "message": "Daily loss limit reached for this account." } }
HTTPCodeMeaning
400invalid_requestMalformed parameters or body
401unauthorizedMissing or invalid API key
403forbiddenKey lacks the required scope or IP not whitelisted
404not_foundUnknown instrument, order or strategy
422risk_check_failedPre-trade risk engine rejected the order (reason in message)
429rate_limitedLimit exceeded — honour retry_after
503market_closedEndpoint requires an open market session
10

Python SDK & sandbox

The Python SDK wraps the REST and WebSocket APIs with typed helpers:

# install pip install alphasync from alphasync import AlphaSync client = AlphaSync(api_key="as_sandbox_xxxx") # sandbox key quote = client.market.quote("NSE:RELIANCE") order = client.orders.place(instrument="NSE:RELIANCE", side="BUY", quantity=100, order_type="LIMIT", price="1264.00", product="MIS") for tick in client.stream.ticks(["NSE:NIFTY50"]): print(tick.ltp, tick.ts)

Sandbox

  • The sandbox mirrors production endpoints against your virtual-capital account with live market data — the same environment as the demo platform.
  • Build and test end-to-end (orders fill against simulated execution) before requesting live credentials.
Compliance reminder. Live API trading routes through your SEBI-registered broker under the retail algo framework: orders are tagged, rate-limited and logged. You are responsible for your broker's algo approval requirements. See the SEBI framework guide.

Questions or access requests: alphasync@vianmax.com.