Quick answer
Alpaca is an API-first US broker for stocks, ETFs, options and crypto. You authenticate with two headers (APCA-API-KEY-ID and APCA-API-SECRET-KEY), every account has a free paper-trading twin at paper-api.alpaca.markets, and the free Basic data plan includes real-time IEX quotes and history back to 2016. Paper and live accounts use separate keys.
Alpaca API at a glance
- Pricing
- Free account; free IEX market data plan
- Availability
- US and most international residents
- Paper trading
- Paper trading account with simulated fills
- Integration type
- REST + API key
- In AlgoGP
- Built in: broker and data adapter (Free)
- Trading API
paper-api.alpaca.markets/api.alpaca.markets- Market data API
data.alpaca.markets(stocks, crypto, news)- Auth
- Key id + secret in
APCA-API-KEY-ID/APCA-API-SECRET-KEYheaders - Order types
- Market, limit, stop, stop-limit, trailing stop, brackets, OCO
What Alpaca is and who it suits
Alpaca Securities is a FINRA member broker-dealer (SIPC) offering commission-free trading in US-listed stocks and ETFs, fractional shares, and spot crypto through Alpaca Crypto. It has no desktop platform to speak of: the product is the API, which is why it is so popular with developers, quant hobbyists and fintech apps.
- Good fit: daily or intraday strategies on US equities, ETFs and major crypto pairs; anyone who wants paper trading that behaves like the live account.
- Less suited: forex, futures or non-US equities (not offered), and high-frequency strategies that need co-location.
Paper vs live: two accounts, two key pairs
Every Alpaca user gets a paper account with simulated cash that can be reset at any time. Paper and live accounts have separate API keys and separate base URLs: paper keys only work against https://paper-api.alpaca.markets and live keys only against https://api.alpaca.markets. Mixing them is the single most common cause of a 401 Unauthorized or 403 Forbidden response.
Alpaca market data plans
The same key pair also authenticates the Market Data API. The free Basic plan streams real-time IEX quotes for up to 30 WebSocket symbols, serves historical stock bars back to 2016 and allows about 200 historical calls per minute. Algo Trader Plus ($99/month) adds all US exchanges (SIP), unlimited WebSocket symbols and up to 10,000 historical calls per minute. Crypto data is free on every plan.
| Endpoint | Use |
|---|---|
GET /v2/stocks/bars | Historical stock and ETF bars (1Min to 1Month) |
GET /v1beta3/crypto/us/bars | Historical crypto bars, e.g. BTC/USD |
GET /v2/account | Cash, equity and buying power |
POST /v2/orders | Submit an order |
GET /v2/positions | Open positions |
Rate limits and practical limits
The trading API allows about 200 requests per minute per account, and returns 429 Too Many Requests beyond that. A bar-close strategy that checks once per bar is nowhere near the limit; a loop that polls every second for many symbols can be. Stocks trade only in US market hours (plus extended hours for limit orders); crypto trades around the clock.
- Alpaca moved to FINRA’s new intraday-margin framework on June 4, 2026, replacing its old pattern-day-trader handling; older guides quoting the $25,000 PDT rule as an Alpaca limit are out of date.
- Crypto orders support
gtcandioctime-in-force; stock market orders are usuallyday. - Fractional orders are market or limit orders during regular hours only.
Use Alpaca in AlgoGP
Open a project, go to the APIs & keys tab and, under Platforms, pick Alpaca as the market data source (market_data.py) and the broker (brokers.py). The choice is saved to config.json as a new strategy version:
{
"platforms": {
"data": "alpaca",
"broker": "alpaca"
}
}backtest.py and live.py connect to when you run the exported code.| Key | What it is |
|---|---|
ALPACA_API_KEY_ID | Alpaca API key id (paper or live), from the Alpaca dashboard. |
ALPACA_API_SECRET_KEY | Alpaca API secret key; shown once when the key is generated. |
ALPACA_BASE_URL (optional) | Optional override. Sandbox mode uses https://paper-api.alpaca.markets, live mode https://api.alpaca.markets. |
.env.TRADING_MODE=paper(default): simulated fills on your machine; the broker is never contacted.TRADING_MODE=sandbox: orders go to Alpaca’s paper trading account with simulated fills.TRADING_MODE=live: real orders, and only onceLIVE_TRADING_ACKNOWLEDGED=yesis set.
New to Alpaca? Follow the step-by-step Alpaca API key guide.
Alpaca API: frequently asked questions
Is the Alpaca API free?
Yes. Opening an account, paper trading and the basic market data plan are free, and US stock and ETF trades are commission-free. Paid market data and regulatory fees on sells are the main costs.
Can I paper trade with Alpaca without funding an account?
Yes. A paper account is created with every signup and never needs funding. Generate paper keys from the paper dashboard and point your code at https://paper-api.alpaca.markets.
Does Alpaca support crypto through the same API?
Yes. Crypto pairs such as BTC/USD use the same orders, positions and account endpoints, trade 24/7, and their market data is free.
Can I trade from outside the US?
Alpaca accepts residents of many countries for brokerage accounts; availability, especially for crypto, varies by jurisdiction. Check the signup flow for your country.
Build an Alpaca trading bot in minutes
Describe the strategy in plain English, backtest it on years of data, then export Python that already talks to Alpaca: paper, sandbox and live modes, keys handled for you.
- Generated adapter for Alpaca orders and balances
- Backtests with costs, slippage and walk-forward checks
- Paper first; live trading only after you opt in
Free plan, no card required.
Alpaca alternatives
- Interactive Brokers API GuideThe broadest multi-asset broker API: stocks, options, futures, FX and bonds on 150+ markets, through TWS or IB Gateway.
- Tradier API Built into AlgoGPDeveloper-focused US brokerage for stocks and options, with a REST API and a free sandbox token.
- TradeStation API GuideUS broker with a v3 REST and streaming API for stocks, options and futures, OAuth 2.0 and a simulated account.
- Charles Schwab Trader API GuideThe successor to the TD Ameritrade API: stocks, ETFs and options trading plus quotes and history, via OAuth 2.0.
Independent guide. AlgoGP is not affiliated with Alpaca. Limits, prices and availability change; confirm them in the official documentation. Nothing here is investment advice.