09 - REST API Documentation

New Broker Integeration with OpenAlgo - Checklist

Overview

OpenAlgo provides a comprehensive REST API built with Flask-RESTX at /api/v1/. The API enables trading operations, market data retrieval, and account management across 29 Indian brokers through a unified interface.

Architecture Diagram

API Categories

Order Management

Endpoint
Method
Rate Limit
Description

/api/v1/placeorder

POST

ORDER_RATE

Place single order

/api/v1/placesmartorder

POST

SMART_ORDER

Place smart order (position sizing)

/api/v1/modifyorder

POST

ORDER_RATE

Modify pending order

/api/v1/cancelorder

POST

ORDER_RATE

Cancel single order

/api/v1/cancelallorder

POST

API_RATE

Cancel all orders

/api/v1/basketorder

POST

ORDER_RATE

Place multiple orders (batched concurrent)

/api/v1/splitorder

POST

API_RATE

Split large order

/api/v1/closeposition

POST

ORDER_RATE

Close specific position

/api/v1/optionsorder

POST

ORDER_RATE

Place options order

/api/v1/optionsmultiorder

POST

ORDER_RATE

Place multi-leg options order

/api/v1/orderstatus

POST

API_RATE

Get order status

/api/v1/openposition

POST

API_RATE

Get open positions

Market Data

Endpoint
Method
Rate Limit
Description

/api/v1/quotes

POST

API_RATE

Single symbol quote

/api/v1/multiquotes

POST

API_RATE

Multiple symbols quote

/api/v1/depth

POST

API_RATE

Market depth (L5)

/api/v1/history

POST

API_RATE

Historical OHLCV

/api/v1/intervals

POST

API_RATE

Supported intervals

/api/v1/optionchain

POST

API_RATE

Options chain data

/api/v1/optiongreeks

POST

API_RATE

Single option greeks

/api/v1/multioptiongreeks

POST

API_RATE

Multiple option greeks

/api/v1/optionsymbol

POST

API_RATE

Get option symbol

/api/v1/expiry

POST

API_RATE

Expiry dates

/api/v1/syntheticfuture

POST

API_RATE

Synthetic future price

Account Information

Endpoint
Method
Rate Limit
Description

/api/v1/funds

POST

API_RATE

Account balance

/api/v1/holdings

POST

API_RATE

Portfolio holdings

/api/v1/positions

POST

API_RATE

Open positions

/api/v1/orderbook

POST

API_RATE

Order history

/api/v1/tradebook

POST

API_RATE

Trade history

/api/v1/margin

POST

API_RATE

Margin calculation

Endpoint
Method
Rate Limit
Description

/api/v1/symbol

POST

API_RATE

Symbol lookup

/api/v1/search

POST

API_RATE

Symbol search

/api/v1/instruments

GET

API_RATE

All instruments

Utilities

Endpoint
Method
Rate Limit
Description

/api/v1/ping

POST

API_RATE

Connection test

/api/v1/markettimings

POST

API_RATE

Market hours

/api/v1/marketholidays

POST

API_RATE

Holiday calendar

/api/v1/pnlsymbols

POST

API_RATE

P&L breakdown by symbol

/api/v1/chart

POST

API_RATE

Chart data

/api/v1/ticker

GET

API_RATE

WebSocket ticker info

/api/v1/telegram

POST

API_RATE

Telegram bot integration

/api/v1/analyzer

POST

API_RATE

Sandbox/analyzer mode toggle

Authentication

All API endpoints require API key authentication:

Note: Bearer token authentication is NOT supported. Always use either the apikey field in the request body or the X-API-KEY header.

Request/Response Format

Standard Request

Standard Response

Error Response

Place Order API

Endpoint: POST /api/v1/placeorder

Request Fields

Field
Type
Required
Description

apikey

string

Yes

API key

symbol

string

Yes

Trading symbol

exchange

string

Yes

NSE, BSE, NFO, etc.

action

string

Yes

BUY or SELL

quantity

integer

Yes

Order quantity

product

string

Yes

MIS, CNC, NRML

pricetype

string

Yes

MARKET, LIMIT, SL, SL-M

price

float

No

Limit price

trigger_price

float

No

Trigger for SL orders

disclosed_quantity

integer

No

Disclosed quantity

Example

Smart Order API

Endpoint: POST /api/v1/placesmartorder

Intelligent order with position sizing and management.

Additional Fields

Field
Type
Description

position_size

integer

Target position size

strategy

string

Strategy name for tracking

Position Sizing Logic

Quotes API

Endpoint: POST /api/v1/quotes

Response

History API

Endpoint: POST /api/v1/history

Request

Supported Intervals

Interval
Description

1minute

1-minute candles

3minute

3-minute candles

5minute

5-minute candles

10minute

10-minute candles

15minute

15-minute candles

30minute

30-minute candles

60minute

1-hour candles

1day

Daily candles

1week

Weekly candles

1month

Monthly candles

Option Chain API

Endpoint: POST /api/v1/optionchain

Request

Response Structure

Swagger Documentation

Access interactive API documentation at:

Features:

  • Try endpoints directly

  • View request/response schemas

  • Download OpenAPI spec

File Structure

Key Files Reference

File
Purpose

restx_api/__init__.py

API blueprint and namespace setup

restx_api/schemas.py

Request/response models

blueprints/api_v1.py

API registration

collections/

Bruno/Postman collections

Last updated